I tried with: ``` library(chemCal) inverse.predict(model, 0.95) > inverse.predict(model, 0.95) $Prediction [1] 0.4565871
$`Standard Error` [1] 5.525725e-10 $Confidence [1] 1.758532e-09 $`Confidence Limits` [1] 0.4565871 0.4565871 ``` but the value 0.457 does not sound good, it should be about 1.7. Could it be that model is based on glm whereas inverse.predict uses linear regression? On Sat, Oct 2, 2021 at 10:14 AM Luigi Marongiu <marongiu.lu...@gmail.com> wrote: > > Hello, > I have set a glm model using probit. I would like to use it to predict > X given Y. I have followed this example: > ``` > f2<-data.frame(age=c(10,20,30),weight=c(100,200,300)) > f3<-data.frame(age=c(15,25)) > f4<-data.frame(age=18) > mod<-lm(weight~age,data=f2) > > predict(mod,f3) > 1 > 150 > > predict(mod,f4) > 1 > 180 > ``` > > I have set the following: > ``` > df <- data.frame(concentration = c(1, 10, 100, 1000, 10000), > positivity = c(0.86, 1, 1, 1, 1)) > model <- glm(positivity~concentration,family = binomial(link = > "logit"), data=df) > > e3<-data.frame(concentration=c(11, 101), positivity=c(1, 1)) > > predict(model, e3) > 1 2 > 5.645045 46.727573 > ``` > but: > ``` > > e4<-data.frame(positivity=0.95) > > e4 > positivity > 1 0.95 > > predict(model, e4) > Error in eval(predvars, data, env) : object 'concentration' not found > ``` > Why did the thing worked for f4 but not e4? How do I get X given Y? > Do I need to find the inverse function of logit (which one?) and apply > this to the regression or is there a simpler method? > Also, is it possible to plot the model to get a smooter line than > `plot(positivity ~ concentration, data = df, log = "x", type="o")`? > Thanks > -- > Best regards, > Luigi -- Best regards, Luigi ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.