Getting flagged values in residual plot in R

  • Thread starter FallenApple
  • Start date
  • Tags
    Plot
In summary, the conversation discusses flagged values in a program-specific situation. The 8 and 50 represent the lowest and highest residuals, and the question suggests using a model variable to identify the row numbers in the data. It is recommended to seek further help on a programming platform such as Stack Overflow.
  • #1
FallenApple
566
61
ResidualsVsFitted.png

What does the 8 and the 50 mean? I know that they are flagged values. Often, this happens. The plot is off because of some extreme points, the plot flags them, and I go into the dataset and cannot find them. Are they the built in row numbers of the dataframe? or are they something else?
 
Computer science news on Phys.org
  • #2
This is a very program-specific question, which is not really in the main subject area of physicsforums. If you have no luck here the best place to ask is stack overflow, tagging your question as about R, graphics and regression. Stack overflow is designed for programming-specific questions, and I have always been able to find answers there.

That said, I have one suggestion. Since the plot points flagged with 8 and 50 have respectively the lowest and highest residuals, you could identify the numbers of the rows in the data to which they relate by which.min(mod$residuals) and which.max(mod$residuals) where mod is the name you have given to the model variable holding the results of the regression.
 
  • Like
Likes FallenApple

FAQ: Getting flagged values in residual plot in R

1. What is a residual plot and why is it useful in R?

A residual plot is a graph that displays the difference between observed values and predicted values in a regression model. It is useful in R because it allows you to visually assess the fit of the model and identify any patterns or trends in the residuals.

2. How do I create a residual plot in R?

To create a residual plot in R, you can use the "residuals()" function, which calculates the residuals for a given model. Then, you can use the "plot()" function to plot the residuals against the predicted values. Alternatively, you can use the "plot()" function on the model object itself, which will automatically generate a residual plot.

3. What do flagged values in a residual plot indicate?

Flagged values in a residual plot indicate that there are potential outliers or influential points in the data. These values may significantly impact the results of the regression model and should be further investigated.

4. How can I identify flagged values in a residual plot in R?

In R, you can use the "identify()" function to interactively label points on a plot. If you use this function on a residual plot, it will allow you to click on any points that you want to label and then display their corresponding data values. This can help you identify flagged values that may need further analysis.

5. What should I do if I find flagged values in a residual plot?

If you find flagged values in a residual plot, it is important to investigate them further to determine their potential impact on the model. This may involve removing outliers, transforming the data, or using a different regression model. It is also helpful to consult with other experts in the field to get their perspective on the flagged values and potential solutions.

Similar threads

Replies
17
Views
2K
Replies
2
Views
1K
Replies
1
Views
2K
Replies
7
Views
2K
Replies
7
Views
2K
Replies
13
Views
3K
Replies
11
Views
2K
Replies
11
Views
27K
Back
Top