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)
predict(lm1, newdata=data.frame(Petal.Length=1:7))
    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?


1 Answer 1


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)


enter image description here

enter image description here

  • $\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
    Commented 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
    Commented 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
    Commented 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
    Commented Mar 15, 2014 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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