Dear list members,
I am fitting a logistic regression with 5 explanatory factors (which I
converted to factors):
mod6 = glm(condicion ~ iluminacion + animales + cielo.raso + piso +
paredes, family=binomial, data=reglog)
I want to obtain the predicted probabilities and the se using the
function "predict" for some combination of the factors.
iluminacion = 1
animales = 0
cielo.raso = 0
piso = 0
paredes = 0
newdata1 = data.frame(iluminacion, animales, cielo.raso, piso, paredes)
newdata1$cond = predict(mod6, newdata = newdata1, type="response")
> newdata1$cond = predict(mod6, newdata = newdata1, type="response")
Aviso en model.frame.default(Terms, newdata, na.action = na.action, xlev
= object$xlevels) :
variable 'iluminacion' is not a factor
Aviso en model.frame.default(Terms, newdata, na.action = na.action, xlev
= object$xlevels) :
variable 'animales' is not a factor
Aviso en model.frame.default(Terms, newdata, na.action = na.action, xlev
= object$xlevels) :
variable 'cielo.raso' is not a factor
Aviso en model.frame.default(Terms, newdata, na.action = na.action, xlev
= object$xlevels) :
variable 'piso' is not a factor
Aviso en model.frame.default(Terms, newdata, na.action = na.action, xlev
= object$xlevels) :
variable 'paredes' is not a factor
Error: variables 'iluminacion', 'animales', 'cielo.raso', 'piso',
'paredes' were specified with different types from the fit
I don't understand what is wrong.
Any help will be appreciated.
Best,
Manuel
--
Manuel Spínola, Ph.D.
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
mspin...@una.ac.cr
mspinol...@gmail.com
Teléfono: (506) 2277-3598
Fax: (506) 2237-7036
_______________________________________________
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology