bam.update(mgcv)
bam.update()所属R语言包:mgcv
Update a strictly additive bam model for new data.
更新为新的数据严格添加剂BAM模型。
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Gaussian with identity link models fitted by bam can be efficiently updated as new data becomes available, by simply updateing the QR decomposition on which estimation is based, and re-optimizing the smoothing parameters, starting from the previous estimates. This routine implements this.
高斯模型拟合身份链接bam可以有效地更新为新的数据成为可用的QR分解的估计是基于简单updateing,并重新优化平滑参数,从原先的估计出发。这个例程实现。
用法----------Usage----------
bam.update(b,data,chunk.size=10000)
参数----------Arguments----------
参数:b
A gam object fitted by bam and representing a strictly additive model (i.e. gaussian errors, identity link).
一个gambam和较严格的添加剂模型(即gaussian错误identity链接)对象安装。
参数:data
Extra data to augment the original data used to obtain b. Must include a column of weights if the original fit was weighted.
额外的数据,以增加用于获取b原始数据。如果原来的拟合,加权,必须包括一个重列。
参数:chunk.size
size of subsets of data to process in one go when getting fitted values.
数据子集的大小,处理于一体,走时,得到的拟合值。
Details
详情----------Details----------
bam.update updates the QR decomposition of the (weighted) model matrix of the GAM represented by b to take account of the new data. The orthogonal factor multiplied by the response vector is also updated. Given these updates the model and smoothing parameters can be re-estimated, as if the whole dataset (original and the new data) had been fitted in one go. The function will use the same AR1 model for the residuals as that employed in the original model fit (see rho parameter of bam).
bam.update更新b采取新的数据帐户所代表的自由亚齐运动(加权)模型矩阵的QR分解。乘以响应向量的正交因子也被更新。鉴于这些更新模型和平滑参数可以重新估计,如果整个数据集(原有的和新的数据)已安装一气呵成。该函数将使用相同AR1的模型残差,在原有的模型拟合就业(看到rho的bam参数“)。
Note that there may be small numerical differences in fit between fitting the data all at once, and fitting in stages by updating, if the smoothing bases used have any of their details set with reference to the data (e.g. default knot locations).
请注意,有可能是装修的所有数据一次,和装修阶段更新,如果使用的平滑基地有参考的数据(例如,默认情况下结的位置)设置的任何细节,在适合小数值之间的差异。
值----------Value----------
An object of class "gam" as described in gamObject.
一个类的对象"gam"所述gamObject,。
作者(S)----------Author(s)----------
Simon N. Wood <a href="mailto:simon.wood@r-project.org">simon.wood@r-project.org</a>
参考文献----------References----------
参见----------See Also----------
mgcv-package, bam
mgcv-package,bam
举例----------Examples----------
library(mgcv)
## following is not *very* large, for obvious reasons...[#后是不是很*大,原因很明显...]
set.seed(8)
n <- 5000
dat <- gamSim(1,n=n,dist="normal",scale=5)
dat[c(50,13,3000,3005,3100),]<- NA
dat1 <- dat[(n-999):n,]
dat0 <- dat[1n-1000),]
bs <- "ps";k <- 20
method <- "GCV.Cp"
b <- bam(y ~ s(x0,bs=bs,k=k)+s(x1,bs=bs,k=k)+s(x2,bs=bs,k=k)+
s(x3,bs=bs,k=k),data=dat0,method=method)
b1 <- bam.update(b,dat1)
b2 <- bam.update(bam.update(b,dat1[1:500,]),dat1[501:1000,])
b3 <- bam(y ~ s(x0,bs=bs,k=k)+s(x1,bs=bs,k=k)+s(x2,bs=bs,k=k)+
s(x3,bs=bs,k=k),data=dat,method=method)
b1;b2;b3
## example with AR1 errors...[#例如AR1的错误...]
e <- rnorm(n)
for (i in 2:n) e[i] <- e[i-1]*.7 + e[i]
dat$y <- dat$f + e*3
dat[c(50,13,3000,3005,3100),]<- NA
dat1 <- dat[(n-999):n,]
dat0 <- dat[1n-1000),]
method <- "ML"
b <- bam(y ~ s(x0,bs=bs,k=k)+s(x1,bs=bs,k=k)+s(x2,bs=bs,k=k)+
s(x3,bs=bs,k=k),data=dat0,method=method,rho=0.7)
b1 <- bam.update(b,dat1)
summary(b1);summary(b2);summary(b3)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|