[R] gam parameter predictions --Sorry for double posting

2007-03-27 Thread Luis Ridao Cruz
R-help,

Sorry for posting again the same question (dated 26-03-2007) but 
all my mails have been sent to the recycle bin without possibility
of recovering and thus I don't know if anyone has answer my query.

Here is the original message:

I'm applying a gam model (package mgcv) to predict
relative abundances of a fish species.

The covariates are year, month, vessel and statistical rectangle.


The model looks like this:

g1 - gam(log(cpue) ~  s(rekt1) + s(year) + s(mon) + s(reg1), data =
dataTest)


Once the model is fitted to the data I want to get the mean model
estimates by year.

I do the following:

obsPred - data.frame(year = dataTest$year, pred = predict(g1, type =
response))

gamFit - tapply(obsPred$pred, list(year = obsPred$ar), mean)



Is this correct?



Thanks in advance


 version
   _   
platform   i386-pc-mingw32 
arch   i386
os mingw32 
system i386, mingw32   
status 
major  2   
minor  4.1 
year   2006
month  12  
day18  
svn rev40228   
language   R   
version.string R version 2.4.1 (2006-12-18)

__
R-help@stat.math.ethz.ch 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.


[R] gam parameter predictions

2007-03-26 Thread Luis Ridao Cruz
R-help,

I'm applying a gam model (package mgcv) to predict
relative abundances of a fish species.

The covariates are year, month, vessel and statistical rectangle.


The model looks like this:

g1 - gam(log(cpue) ~  s(rekt1) + s(year) + s(mon) + s(reg1), data =
dataTest)


Once the model is fitted to the data I want to get the mean model
estimates by year.

I do the following:

obsPred - data.frame(year = dataTest$year, pred = predict(g1, type =
response))

gamFit - tapply(obsPred$pred, list(year = obsPred$ar), mean)



Is this correct?



Thanks in advance


 version
   _   
platform   i386-pc-mingw32 
arch   i386
os mingw32 
system i386, mingw32   
status 
major  2   
minor  4.1 
year   2006
month  12  
day18  
svn rev40228   
language   R   
version.string R version 2.4.1 (2006-12-18)

__
R-help@stat.math.ethz.ch 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.