I am using logistic regression to predict the distribution of plants in an
area, and one model I have includes 3 variables, one of which has a 2nd
degree polynomial fit. I would like to be able to make the predictions
within arcinfo (my GIS program) rather than splus (because at a fine scale
over large regions I've got too much data to handle in splus). I've
succeeded in replicating the predictions from splus as follows:
(splus3.3 on win95 & winNT,
options(contrasts=c("contr.treatment","contr.poly"))
1. from model data frame (~250 records) create a basis matrix on the
required variable (here, "roughness"):
basis.mat<-poly.raw(model.dat[,"roughness"],2)
2. Use this on all values in the prediction region (~600000 records) by
reading the roughness variable into splus from arcinfo, and calling:
new.mat<-poly.raw(roughness.region, 2, coefs = attr(basis.mat, "coefs"))
3. Write out cols 1 and 2 of the new.mat (separately) from splus into
arcinfo, and within arcinfo construct the prediction layer by using the
intercept and coefficients of the model, and for the polynomial term using
the reported coefficients on the newly constructed orthogonal transforms of
"roughness":
linear predictor = int + coef1*var1 + coef2*var2 + coef3*roughness.poly1 +
coef4*roughness.poly2
preds = exp(linear predictor) / (1 + (exp(linear predictor))
In this case I have a small enough data set to also make the predictions in
splus (using predict.gam, type = "response") and my results with both
methods are identical.
My question is: How can I check that the orthogonal polynomial basis fit to
the model data is appropriate for the data in the whole region? (In other
words, I want to replicate what predict.gam does). And if I manage to do it
and find a discrepancy, what options do I have?
I'd appreciate any help you can offer.
many thanks,
jane elith
j.elith@botany.unimelb.edu.au
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|