Re: [R] Help with gam

From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>
Date: Wed, 11 May 2011 19:08:38 +0200

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_at_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_at_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. Received on Wed 11 May 2011 - 17:12:30 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 11 May 2011 - 17:20:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive