...ben bolker's glmm wiki has several examples (in faqs and "owl"-example) how to get model predictions and se's by the use of the model- and var/covar-matrices.

best,
kay


 and Zitat von Gavin Simpson <gavin.simp...@ucl.ac.uk>:

On Wed, 2010-07-07 at 20:44 -0300, Luciano Selzer wrote:
Hi Manuel, your problem is that the new variables you created are of numeric
type, while the model was fitted using factor. So the fix is to convert the
new variables to factors so the type matchs

It may need more than that; not tested but I have often run into
problems where I had slightly different levels for factors in the
prediction data than in the fitting.

G

Luciano


2010/7/7 Manuel Spnola <mspinol...@gmail.com>

> 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 Spnola, Ph.D.
> Instituto Internacional en Conservacin y Manejo de Vida Silvestre
> Universidad Nacional
> Apartado 1350-3000
> Heredia
> COSTA RICA
> mspin...@una.ac.cr
> mspinol...@gmail.com
> Telfono: (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
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

_______________________________________________
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology



_______________________________________________
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

Reply via email to