SVD.smooth(SpatioTemporal)
SVD.smooth()所属R语言包:SpatioTemporal
Smooth Basis Functions for Data Matrix with Missing Values
数据矩阵缺失值的平滑基函数
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Function that computes smooth functions for a data matrix with missing values, as described in Fuentes et. al. (2006). The function uses SVD.miss to complete the matrix and then computes smooth basis functions by applying smooth.spline to the svd of the completed data matrix.
数据矩阵缺失值,如在富恩特斯等函数,计算光滑函数。人。 (2006年)。该函数使用SVD.miss能完成矩阵,然后计算平滑的基础功能应用smooth.spline完整的数据矩阵的奇异值分解。
用法----------Usage----------
SVD.smooth(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
Number of smooth basis functions to compute, will be passed as ncomp to SVD.miss.
将传递的平滑基础函数来计算,数ncomp到SVD.miss。
参数:date.ind
Vector giving the observation time of each row in data, used as x in <br> smooth.spline when computing the smooth basis functions. If set to NA it will try to coerce the rownames of data to dates <br> date.ind = as.Date(rownames(data)). <br> If data has no rownames it will assume equidistant data points, <br> date.ind = 1:dim(data)[1].
矢量给的观察时间中的每一行data,作为x在参考smooth.spline计算时顺利的基础功能。如果设置为NA,它会尝试,强迫行名data是日期<br>date.ind = as.Date(rownames(data))。 data <br>如果没有行名,将假设距离相等数据点,<BR> date.ind = 1:dim(data)[1]中。
参数:scale.data
If TRUE, will use scale to scale the data matrix before calling SVD.miss.
如果TRUE,将使用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----------
The function returns a matrix where each column is a smooth basis function based on the svd of the completed data matrix. The left most column contains the smooth of the most important svd.
该函数返回一个矩阵,其中每列是一个平稳的基础功能完整的数据矩阵的奇异值分解的基础上。最左边的列中包含的最重要的SVD的顺利。
(作者)----------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.org <- matrix(cbind(cos(t),sin(2*t)),length(t),2) %*%
matrix(rnorm(20),2,10)
#add some normal errors[添加一些正常的错误]
X <- X.org + .25*rnorm(length(X.org))
#and mark some data as missing[并标记为丢失一些数据]
X[runif(length(X))<.25] <- NA
#compute two smooth basis functions[计算两个光滑的基础功能]
res <- SVD.smooth(X, n.basis=2, niter=100)
#plot the two smooth basis functions[绘制两个光滑的基础功能]
par(mfcol=c(3,2),mar=c(4,4,.5,.5))
plot(t,res[,1],ylim=range(res),type="l")
lines(t,res[,2],col=2)
#and some of the data fitted to the smooths[和某些数据的平滑嵌合]
for(i in 1:5){
plot(t,X[,i])
lines(t,predict.lm(lm(X[,i]~res),data.frame(res)))
lines(t,X.org[,i],col=2)
}
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|