2
$\begingroup$

Say I have $y$ as a function of $x_1$ and $x_2$. Can I use the predict function to get a CI for a single value of $x_2$? It doesn't seem to work - I get an error saying that the object for $x_1$ isn't found.

$\endgroup$
2
  • $\begingroup$ Do you mean you would like a CI for the coefficient of x1 in the regression model? Or are you 'backwards inferring' the x from the y using the regression model? $\endgroup$ May 11, 2018 at 6:37
  • $\begingroup$ If x1 is 100, find the CI for y. X2 is not specificed but is part of the model. $\endgroup$ May 11, 2018 at 14:52

1 Answer 1

4
$\begingroup$

Your model postulates that the mean value of y dependes on both x1 and x2 - in other words, both x1 and x2 help determine the mean value of y. So if you would like to find a confidence interval for the mean value of y when you know the value of x2, you also have to specify the value of x1, since both of these variables feature in your model.

If you wanted the confidence interval for the mean value of y to only depend on the value of x2, you would have to fit a simple linear regression model regressing y on x2 and use that model as a basis for computing your confidence interval.

$\endgroup$
1
  • $\begingroup$ @BlakeShurtz you should have access to a "check" mark between the up and down vote arrows. Select this to mark Isabella's answer as the one you want. $\endgroup$
    – AdamO
    May 11, 2018 at 20:39

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.