Hi,

I am comparing the observed and fitted values of my GAM model, which includes 
the explanatory variables: longitude, depth, ssh, year and month. When I 
compare observed and fitted values for longitude, depth and ssh it works. But 
when I try to do it for month and year (which are as factors in the GAM model) 
it doesn't work. My observed and fitted values are exactly the same.. How is 
that possible?  Thanks

> Obs_factor1<-aggregate(x=albdata$turtles,by=list(albdata$Year),FUN=mean)
> names(Obs_factor1)=c("Bin","Observed")
> Obs_factor1
    Bin    Observed
1  1997 0.017094017
2  1998 0.010652463
3  1999 0.023000000
4  2000 0.017167382
5  2001 0.030465950
6  2002 0.007446809
7  2003 0.010568032
8  2004 0.011450382
9  2005 0.016270338
10 2006 0.017006803
11 2007 0.030969031
12 2008 0.066455696
> Fit_factor1<-aggregate(x=predict(gam.def.lon,type="response"),by=list(albdata$Year),FUN=mean)
> names(Fit_factor1)=c("Bin","Fitted")
> Fit_factor1
    Bin      Fitted
1  1997 0.017094017
2  1998 0.010652463
3  1999 0.023000000
4  2000 0.017167382
5  2001 0.030465950
6  2002 0.007446809
7  2003 0.010568032
8  2004 0.011450382
9  2005 0.016270338
10 2006 0.017006803
11 2007 0.030969031
12 2008 0.066455696





      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to