inverse of 'predict' function

后端 未结 5 627
有刺的猬
有刺的猬 2021-02-08 07:33

Using predict() one can obtain the predicted value of the dependent variable (y) for a certain value of the independent variable (x) for a

5条回答
  •  一生所求
    2021-02-08 07:35

    Saw the previous answer is deleted. In your case, given n=50 and the model is binomial, you would calculate x given y using:

    f <- function (y,m) {
      (logit(y/50) - coef(m)[["(Intercept)"]]) / coef(m)[["x"]]
    }
    > f(30,model)
    [1] 48.59833
    

    But when doing so, you better consult a statistician to show you how to calculate the inverse prediction interval. And please, take VitoshKa's considerations into account.

提交回复
热议问题