On 11.05.2011 17:22, Zsolt Macskasi wrote:
Hi,

I am a brand new user of R and I am trying to use the gam procedure with the 
package mgcv. I did a bit of my homework by consulting the R-manual, as well as 
the mgcv manual written by Simon Wood. I admit it was just a few hours, but 
what I am trying to do is really basic. Essentially, what I am trying to do is 
to generate the fitted values after the execution of the gam procedure and 
export them into Excel.

Here is my program:

ABC<- read.table("Incidence Data.csv", header=TRUE, sep=",")

probably the next three lines can be omitted if you just say:

fit <- gam(incidence~te(age,birthyear), data=ABC, family=poisson, fit=TRUE)


incidence<- ABC[,1]
age<- ABC[,2]
birthyear<- ABC[,3]
fit<-gam(incidence~te(age,birthyear), family=poisson, fit=TRUE)


All this works. Now, how can I see the fitted values and copy them back to 
Excel?


As for most fitted models, you can get

Fitted values:

  predict(fit)

Coefficients:

 coef(fit)

etc.


Uwe Ligges



Thank you very much,

Zsolt

        [[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.

______________________________________________
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