SVD.smooth.cv(SpatioTemporal)
SVD.smooth.cv()所属R语言包:SpatioTemporal
Cross-validation for Smooth Basis Functions
平滑基函数的交叉验证
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Function that uses cross-validation to evaluate the number of smooth functions needed to describe a data matrix with missing values (c.f. Fuentes et. al. (2006). Can be used to determine reasonable values for n.basis in SVD.smooth.
功能使用交叉验证评估数的光滑函数来描述数据矩阵,遗漏值(CF富恩特斯等人(2006年),可用于确定合理的值n.basis<X >。
The function uses leave-one-column-out cross-validation; holding one column out from data, calling SVD.smooth, and then regressing the held out column on the resulting smooth functions. Cross-validation statistics computed include RMSE, R-squared and BIC.
该函数使用留一列,一列从data交叉验证,调用SVD.smooth,然后回归伸出柱产生的流畅的功能。交叉验证统计计算包括RMSE,R-平方和BIC。
用法----------Usage----------
SVD.smooth.cv(data, n.basis, date.ind=NA, scale.data=TRUE,
niter=100, conv.reldiff=0.001, df=NULL, spar=NULL)
参数----------Arguments----------
参数:data
Data matrix, with missing values marked by NA.
数据矩阵,缺失值标记NA。
参数:n.basis
A vector with the number of basis functions for which to run the <br> cross-validation.
一个向量的数量到运行的<br>的交叉验证的基础功能。
参数:date.ind
Vector giving the observation time of each row in data. Same as date.ind in SVD.smooth.
矢量的观察时间中的每一行data。同date.ind中SVD.smooth。
参数:scale.data
Uses scale to scale the data matrix before calling SVD.miss.
使用scale扩展数据矩阵前调用SVD.miss。
参数:niter, conv.reldiff
Controls convergence for SVD.miss.
控制收敛SVD.miss。
参数:df, spar
The desired degrees of freedom/smoothing parameter for the spline, <br> see smooth.spline.
程度的自由/平滑样条曲线的参数,参考看smooth.spline。
值----------Value----------
Returns a list with the following components:
返回一个列表,与以下组件:
参数:CV.stat
A data.frame with cross-validation statistics for each of the number of basis functions evaluated. Contains RMSE, R2 (R-squared) and BIC (Bayesian information criterion).
交叉验证的统计信息的数量的基础函数评价中的每一个与甲数据框。包含RMSE,R2(R-平方)和BIC(贝叶斯信息标准)。
参数:BIC.all
A data.frame with the individual BIC values for each column in the data matrix and for each number of basis functions evaluated. Can be used to evaluate how many of the columns would benefit from using more/fewer basis functions.
甲与个别BIC为每列中的数据矩阵和用于评估的基函数的每个数字的值的数据框。可用于评估有多少列将受益于使用更多/更少的基础功能。
参数:smooth.SVD
A list with length(n.basis) components. Each component contains an array where smooth.SVD[[j]][,,i] is the result of SVD.smooth applied to data[,-i] with n.basis[j] smooth functions. Can be used to investigate how different the smooth functions vary when different columns of the data matrix are dropped.
一个列表,length(n.basis)部件。每个组件都包含一个数组,其中smooth.SVD[[j]][,,i]是SVD.smoothdata[,-i]n.basis[j]光滑函数的结果。可用于探讨不同顺利的功能各不相同,不同的列都将被丢弃的数据矩阵。
(作者)----------Author(s)----------
Paul D. Sampson and Johan Lindstr枚m
参考文献----------References----------
Analyze Space-Time Processes in Statistical methods for spatio-temporal systems (B. Finkenst盲dt, L. Held, V. Isham eds.) 77-150
参见----------See Also----------
See also SVD.smooth, SVD.miss, svd, and smooth.spline.
请参阅SVD.smooth,SVD.miss,svd和smooth.spline。
create.data.matrix can be used to create a data matrix from a mesa.data object.
create.data.matrix从mesa.data对象,可用于创建一个数据矩阵。
Used by calc.smooth.trends to compute smooth trends for mesa.data.
calc.smooth.trends来计算平滑的趋势mesa.data使用。
实例----------Examples----------
#create a data matrix[创建一个数据矩阵]
t <- seq(0,4*pi,len=50)
X <- matrix(cbind(cos(t),sin(2*t)),length(t),2) %*%
matrix(rnorm(20),2,10)
#add some normal errors[添加一些正常的错误]
X <- X + .25*rnorm(length(X))
#and mark some data as missing[并标记为丢失一些数据]
X[runif(length(X))<.25] <- NA
#compute cross-validation for 1 to 4 basis functions[为1至4个基函数计算交叉验证]
res.cv <- SVD.smooth.cv(X, n.basis=1:4, niter=100)
#plot cross-validation statistics[图交叉验证统计]
par(mfcol=c(2,2),mar=c(4,4,.5,.5))
plot(res.cv$CV.stat$RMSE,type="l",ylab="RMSE")
plot(res.cv$CV.stat$R2,type="l",ylab="R2")
plot(res.cv$CV.stat$BIC,type="l",ylab="BIC")
#plot the BIC for each column, illustrates how many columns that[绘制BIC的每一列,说明有多少列]
#improve and how many that worsen when increasing the number of[改善和多少,恶化时,增加的数目]
#basis functions.[基函数。]
pairs(res.cv$BIC.all,panel=function(x,y){points(x,y);abline(0,1)})
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|