Question

Currently I'm replicating the exercise did by Wood (2006) about the relationship between air pollution and death rates in Chicago, using GAM models.

So, I followed the code he used in his book. The library is called "gamair" and the data frame is "chicago".

I put this (exactly like the book):

gam(death~s(time,bs="cr",k=200)+pm10median+so2median+o3median+tmpd,data=chicago,family=poisson)

But I got an error:

Error in s(time, bs = "cr", k = 200) : 
  unused argument(s) (bs = "cr", k = 200)

Somebody could explain me this?

Thank you so much.

Was it helpful?

Solution

Did you load the mgcv package as well as gamair?

library(gamair)
library(mgcv)
data(chicago)
gam(death~s(time,bs="cr",k=200)+pm10median+so2median+o3median+tmpd,data=chicago,family=poisson)

Works fine for me.

I can reproduce your error if I use the package gam not mgcv for the function gam.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top