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

______________________________________________
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.

Reply via email to