How to get prediction of classes in gam?
I have a problem with getting predicted classes from a gam-model using 
the gam function in the "mgcv"-package.
I have a dataset where I have classified the response variable into 5 
classes (i. e. 1, 2, 3, 4, 5) and I want to use a gam-model generated on 
a training dataset (traindata) to predict the class beloning of data 
from a test-dataset (testdata) but I can't get it to work.

I generated the gam-model using:
model<-gam(growthclass~Vol+Expo+distance+......+temperature,family=binomial, 
type="classification",data=traindata)

When I then try to predict the class beloning of the test-dataset using:
pred<-predict(model,newdata=testdata)
I get results like this:

         2           4           6           7           9
-1.93680872  2.28422570  0.99747563  0.03627236  0.74235160

But I really want the results to look like this:

         2           4           6           7           9
        1           3           2           1           2


i.e. the predicted classes for the new samples.

Obviously I am doing something wrong and it is probably very simple to solve 
but I've got stuck on it for a while and would appreciate some help solving it.

Thanks
Per




        [[alternative HTML version deleted]]

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

Reply via email to