This question already has an answer here:

I have two questions about this test in R:

  1. How do you read the result of p-value? I assume that the bigger it is the more successful it is. When I do a multiple dummy variable regression, I get a p-value of 0.02758. How to understand this number with my result?

  2. When using the lm function to fit a model, I'm not able to draw the fitted line on the scatterplot. I am using the lines function like this:

    lm8 <- lm(H$weight~lga, data=H)
    reset(lm8, power=2, type=c("fitted"), data=H)
    Fit8 <- data.frame(predict(lm8))
    lines(Fit8, data=H)

And what do Fit8 and predict(lm8) mean essentially?


marked as duplicate by gung - Reinstate Monica, mdewey, Matthew Gunn, whuber Oct 28 '16 at 21:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Have you first checked the help page of lm, data.frame and abline? $\endgroup$ – utobi Oct 28 '16 at 20:34
  • $\begingroup$ Please add a reproducible example for people to work with. $\endgroup$ – gung - Reinstate Monica Oct 28 '16 at 20:41
  • 3
    $\begingroup$ I'm voting to close this question as off-topic because it is about how to use R without a reproducible example. $\endgroup$ – gung - Reinstate Monica Oct 28 '16 at 20:41

to the first question:

It is not very easy to say what your p-value exactly means, because it is general very hard to say what p-values exactly are. If you are testing in the intention of Neyman- Pearson you could say that your result is under the threshold of 0.05 and thus significant. But as you wrote that you have done more NHST Tests you have to correct your p-values for Family-wise error rates, because your Type 1 error increases every time you do a test using the alpha Niveau of 5%. Even though it may be significant a low p-value doesn't say something about external validity or how big your effect is. So it would be nice to look for effect sizes, in this case the Multiple R-squared that is printed in the summary output in R. Maybe the official ASA statement for p-values gives you a clue how to interpret them: ASA statement. It would be nice if you could describe your hypotheses more precise and how many tests you used.

Second question: To answer this question it would be nice if you could give an example of data that you use. I created an example with the airquality data set that is a base R data set. So you could reproduce my code.

fit <- lm(Ozone~ Wind,data=airquality) #setting up a linear regression model

plot(Ozone~Wind,airquality) # plotting the correlation

summary(fit) # get an overview about the model

abline(fit) # plotting the regression line

Given your question I thought that you wanted to visualise the regression line that would predict values from your model. I don't know what the reset function does, I can't find it in the base packages. The predict function would predict values of your output variable using your model. May you want to see what your model thinks the Ozone would be if the Wind has an value of e.g. 5. For more info you could look here.

I hope I could help you

  • $\begingroup$ Thanks so really much for what you have for me. I learned something. And the reset test is in the package of "AER" I think. I really appreciated. Thank you. $\endgroup$ – Charlie Sugerman Oct 29 '16 at 4:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.