On Mon, 5 Feb 2001, Trevor Parker wrote:
> Hello S-plus enthusiasts,
>
>
> I have run a GLM using 2 degree poynomials as independents. The model looks
> like this:
>
> forest.object <- glm(forest ~ poly(slope,2) + poly(aspectns,2),
> family=binomial(logit), data=train)
>
> When I use the coefficients from forest.object to predict forest I get
> erroneous results. i.e very small values
>
> The predictive GLM form I am using is:
>
> log(p/1-p) = intercept + coef1*slope + coef2*sqr(slope) + coef3*aspectns +
> coef4*sqr(aspectns)
>
> where intercept and coef1 to 4 are from forest.object.
>
> When I run the model:
>
> forest.object <- glm(forest ~ slope + aspectns, family=binomial(logit),
> data=train)
>
> and use the coefficents to predict forest i.e log(p/1-p) = intercept +
> coef1*slope + coef2*aspectns
>
> it works well.
>
> I have tried using poly.transform but it appears to only work for models with
> one independent variable.
>
> Am I using the polynomial form correctly. Your help would be appreciated.
This is well known and well documented. You need to use predict.gam, not
predict.glm. See for example Venables & Ripley (1999, p.166).
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
|