English 中文(简体)
关于在 R 中使用 GAM 模型
原标题:About using GAM Models in R

目前我仿照Wood(2006年)关于空气污染与芝加哥死亡率之间关系的研究,

所以,我遵循了他在书中所用的代码。图书馆叫做“gamair”,数据框架是“Chicago”。

我写了这个(和这本书完全一样):

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

但我有一个错误:

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

有人能解释一下吗?

非常感谢

最佳回答

您是否装入了 mgcv 包以及 gamair ?

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

对我很好

如果我使用软件包 gam ,而不是 mgcv 来进行函数 gam ,我可以复制您的错误。

问题回答

暂无回答




相关问题
How to manage a pageview DB

I am interested in tracking my users pageviews on my site. Being that traffic is expanding very quickly, I am worried about robots, etc, and I also want to be able to use tracked data live to alter ...

Statistics Question

Suppose I conduct a survey of 10 people asking whether to rank a movie as 0 to 4 stars. Allowable answers are 0, 1, 2, 3, and 4. The mean is 2.0 stars. How do I calculate the certainty (or ...

Calculating variance with large numbers

I haven t really used variance calculation that much, and I don t know quite what to expect. Actually I m not too good with math at all. I have a an array of 1000000 random numeric values in the ...

R statistical package: wrapping GOFrame objects

I m trying to generate GOFrame objects to generate a gene ontology mapping in R for unsupported organisms (see http://www.bioconductor.org/packages/release/bioc/vignettes/GOstats/inst/doc/...

Generating correlated numbers

Here is a fun one: I need to generate random x/y pairs that are correlated at a given value of Pearson product moment correlation coefficient, or Pearson r. You can imagine this as two arrays, array ...

Multivariate time series modelling in R

I want do fit some sort of multi-variate time series model using R. Here is a sample of my data: u cci bci cpi gdp dum1 dum2 dum3 dx 16.50 14.00 53.00 45.70 80....

热门标签