[R] plotting gam models

Lucia Zarauz lzarauz at pas.azti.es
Wed Jul 25 12:43:01 CEST 2007


Hi again,

I have found a post in R.help archives made from someone who had the same problem when exporting the smooth function estimate got from a GAM, to plot it into another graphic software (http://finzi.psych.upenn.edu/R/Rhelp02a/archive/23136.html)

However, I haven't found any reply to this post. 

She suggested the function preplot() and I have hound that function in gam package, but not in mgcv package. Is it possible to do this in mgcv package or do I have to move to gam package?

Thank you very much

Lucía zarauz


_____________________________________________ 
AZTI - TecnaliaLucia Zarauz 
AZTI - Tecnalia / Unidad de Investigación Marina
Herrera kaia portualdea z/g
20110 Pasaia (Gipuzkoa)
Tel: 943 004 800 - Fax: 943 004 801
e-mail: lzarauz at pas.azti.es
www.azti.es ; www.tecnalia.info	 

_____________________________________________ 

  

**************** LEGE OHARRA **************** AVISO LEGAL **************** DISCLAIMER ****************


Mezu hau pertsonala eta isilpekoa da eta baimenik gabeko erabilera debekatua dago legalki. Jasotzailea ez bazara ezabatu mezua, bidali eta kontserbatu gabe. 


Este mensaje es personal y confidencial y su uso no autorizado está prohibido legalmente. Si usted no es el destinatario, proceda a borrarlo, sin reenviarlo ni conservarlo.


This message is personal and confidential, unauthorised use is legally prohibited. If you are not the intended recipient, delete it without resending or backing it.

-----Mensaje original-----
De: Lucia Zarauz 
Enviado el: martes, 24 de julio de 2007 13:53
Para: 'Henrique Dallazuanna'
CC: r-help at stat.math.ethz.ch
Asunto: RE: [R] plotting gam models

Hi Henrique,

Thank you for your suggestion. 

Actually, I have already tried it, but I am confused because the plot I get is not the same as the output of plot(model) or plot.gam(model). The yaxis is different

On the other hand, if I build a more complex model, as for example:

model<- gam(x ~ s(lat,long) + s(temperature))

I would like to extract the information to build the effects for each explanatory factor (one graph for s(lat,long) and another for s(temperature)), as R does when you use 'plot(model)' and you press return for subsequent pages.

My final aim is to plot the influence of s(lat,long) as a contourplot superposed on a geographical map. Maybe there is an easier way to do it...

Thank you very much

lucía



_____________________________________________ 
Lucia Zarauz 
AZTI - Tecnalia / Unidad de Investigación Marina
Herrera kaia portualdea z/g
20110 Pasaia (Gipuzkoa)
Tel: 943 004 800 - Fax: 943 004 801
e-mail: lzarauz at pas.azti.es
www.azti.es ; www.tecnalia.info
_____________________________________________ 
  
**************** LEGE OHARRA **************** AVISO LEGAL **************** DISCLAIMER ****************
Mezu hau pertsonala eta isilpekoa da eta baimenik gabeko erabilera debekatua dago legalki. Jasotzailea ez bazara ezabatu mezua, bidali eta kontserbatu gabe. 
Este mensaje es personal y confidencial y su uso no autorizado está prohibido legalmente. Si usted no es el destinatario, proceda a borrarlo, sin reenviarlo ni conservarlo.
This message is personal and confidential, unauthorised use is legally prohibited. If you are not the intended recipient, delete it without resending or backing it.

________________________________________
De: Henrique Dallazuanna [mailto:wwwhsd at gmail.com] 
Enviado el: martes, 24 de julio de 2007 13:36
Para: Lucia Zarauz
CC: r-help at stat.math.ethz.ch
Asunto: Re: [R] plotting gam models

see ?predict.gam

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O 
On 24/07/07, Lucia Zarauz <lzarauz at pas.azti.es> wrote:

Hi everybody,

I am working with gams and I have found some questions when plotting gams models.

I am using mgcv, and my model looks something like this:

model<- gam(x ~ s(lat,long))

I can plot the output of the model using plot(model) or plot.gam(model) and I get a surface plot.

That is ok, but what I want to do now is to extract the data used to perform the surface plot. Like that I would be able to superpose them to a geographical map, and to plot these data using other programs. 

Thank you very much in advance

Lucía
_____________________________________________
Lucia Zarauz
AZTI - Tecnalia / Unidad de Investigación Marina
Herrera kaia portualdea z/g
20110 Pasaia (Gipuzkoa) 
Tel: 943 004 800 - Fax: 943 004 801
e-mail: lzarauz at pas.azti.es
www.azti.es ; www.tecnalia.info
_____________________________________________

**************** LEGE OHARRA **************** AVISO LEGAL **************** DISCLAIMER ****************
Mezu hau pertsonala eta isilpekoa da eta baimenik gabeko erabilera debekatua dago legalki. Jasotzailea ez bazara ezabatu mezua, bidali eta kontserbatu gabe. 
Este mensaje es personal y confidencial y su uso no autorizado está prohibido legalmente. Si usted no es el destinatario, proceda a borrarlo, sin reenviarlo ni conservarlo.
This message is personal and confidential, unauthorised use is legally prohibited. If you are not the intended recipient, delete it without resending or backing it. 

______________________________________________
R-help at 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.



More information about the R-help mailing list