5
$\begingroup$

Given a linear regression model with all the assumptions checked and validated, I would like to obtain the probability that $Y>y|X=x$. For example for the iris dataset, I would do the following to obtain the probability of $Y>5|X=1,2,3...7$:

plot(Sepal.Length~Petal.Length, data=iris)
lm1<-lm(Sepal.Length~Petal.Length, data=iris)
summary(lm1)
abline(lm1)
predict(lm1, newdata=data.frame(Petal.Length=1:7))
(summary(lm1))$sigma
    pnorm(5, mean = predict(lm1, newdata=data.frame(Petal.Length=1:7)),
        sd = (summary(lm1))$sigma, lower.tail = F)

Is such an approach correct assuming constant variance?

$\endgroup$

1 Answer 1

2
$\begingroup$

You are making various assumptions including constant variance.

Others include that a linear regression is appropriate and that the errors are normally distributed. So you might want to look at something like the following to reassure yourself:

plot(lm1$residuals ~ iris$Petal.Length)
abline(h=0)

qqnorm(lm1$residuals)

enter image description here

enter image description here

$\endgroup$
4
  • $\begingroup$ Thanks. Yes I am aware about the underlying assumptions. My question is, if the regression assumptions are valid, is this a correct methodology? $\endgroup$
    – ECII
    Mar 15, 2014 at 10:38
  • 1
    $\begingroup$ Yes: if the model is $y_i= x_i \beta+ \varepsilon_i$ with the $\varepsilon_i$ normally distributed with mean zero and a constant variance, then what you have done looks reaonable, though of course the numbers are overprecise. plot(Sepal.Length~Petal.Length, data=iris); abline(h=5) gives you a view of the information you actually have. $\endgroup$
    – Henry
    Mar 15, 2014 at 10:46
  • $\begingroup$ If X is time, would this methodology be better than a survival analysis (time to Y=y)? And how would the probability estimates (the one I used and the survival analysis) would differ? $\endgroup$
    – ECII
    Mar 15, 2014 at 11:02
  • $\begingroup$ I doubt linear regression would work then without some adjustments to justify a linear model and perhaps deal with any autocorrelation. $\endgroup$
    – Henry
    Mar 15, 2014 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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