[R] Generalized additive models: Plots for Qualitative Data

David Winsemius dwinsemius at comcast.net
Thu Sep 6 19:36:45 CEST 2012


On Sep 6, 2012, at 4:50 AM, Dontrece Smith wrote:

> Hello,
> My name is Dontrece Smith. I am creating figures for my GAMs. I change my
> qualitative variables to 1 or 2 in my dataset, so I would be able to run my
> GAMs. However, R will only display plots for my quantitative variables and
> not my qualitative variables. Is there any way to fix this issue? I listed
> some of my code below:
> 
>> library(mgcv)
> This is mgcv 1.7-13. For overview type 'help("mgcv-package")'.
>> Final <- read.csv("Final.csv", header=TRUE)
>> gam4<-gam(Bonnet ~ s(Depth, bs="cs", k=4) + s(Distance, bs="cs", k=4) +
> s(Width, bs="cs", k=4) + as.factor (System) + as.factor(Channel) +
> as.factor (Profile)  + s(Slope, bs="cs", k=4), data = Final)
>> plot(gam4, shade=TRUE, pages=1)

Why not use predict()?

-- 

David Winsemius, MD
Alameda, CA, USA




More information about the R-help mailing list