문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top