calc.smooth.trends(SpatioTemporal)
calc.smooth.trends()所属R语言包:SpatioTemporal
Smooth Basis Functions for a mesa.data Structure
光滑的基函数的mesa.data结构
译者:生物统计家园网 机器人LoveR
描述----------Description----------
A front end function for calling SVD.smooth (and SVD.smooth.cv), with either a <br> mesa.data structure or vectors containing observations, observations times and locations. The function uses create.data.matrix to create a data matrix which is passed to SVD.smooth (and SVD.smooth.cv).
一个前端函数调用SVD.smooth(和SVD.smooth.cv),一个<br>mesa.data结构或向量的观测,观测时间和地点。该函数使用create.data.matrix创建一个数据是传递到SVD.smooth(SVD.smooth.cv的矩阵)。
用法----------Usage----------
calc.smooth.trends(mesa.data = NA, obs = mesa.data$obs$obs,
date = mesa.data$obs$date, ID = mesa.data$obs$ID,
subset = NA, n.basis = 2, cv = FALSE, niter = 100,
conv.reldiff = 0.001, df = NULL, spar = NULL)
参数----------Arguments----------
参数:mesa.data
A data structure containing the observations, see mesa.data. Use either this or the obs, date, and idx inputs.
的数据结构,其中包含的意见,请参阅mesa.data。使用或obs,date和idx输入。
参数:obs
A vector of observations, see mesa.data.
一个向量的意见,请参阅mesa.data。
参数:date
A vector of observation times, see mesa.data.
一个向量的观测时间,请参阅mesa.data。
参数:ID
A vector of observation locations, see mesa.data.
一个向量的观察位置,请参阅mesa.data。
参数:subset
A subset of locations to use when computing the smooth basis functions, see create.data.matrix.
计算时顺利的基础功能的一个子集的位置,以便使用,请参阅create.data.matrix。
参数:n.basis
Number of basis functions to compute, see SVD.smooth.
数计算的基础功能,请参阅SVD.smooth。
参数:cv
Also compute smooth functions using leave one out cross-validation, <br> see SVD.smooth.cv.
还可以计算使用交叉验证,留下一个光滑函数,参考看SVD.smooth.cv。
参数: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
返回与以下组件的列表
参数:svd
A data.frame containing the smooth trends and the dates. This can be used as the trend in mesa.data$trend.
数据框的顺利发展趋势和日期。这可以被用来作为trend在mesa.data$trend。
参数:svd.cv
If cv==TRUE this is list of dataframes. Each dataframe contains the smooth trend obtained when leaving one site out. Similar to <br> SVD.smooth.cv(data)$smooth.SVD[[1]]). If cv==FALSE this is set to NA.
如果cv==TRUE这是列表dataframes。“每一个数据框包含留下一个站点时所获得的平稳态势。类似<BR>SVD.smooth.cv(data)$smooth.SVD[[1]]“)。如果cv==FALSE这是设置为NA。
(作者)----------Author(s)----------
Johan Lindstr枚m and Paul D. Sampson
参考文献----------References----------
Analyze Space-Time Processes in Statistical methods for spatio-temporal systems (B. Finkenst\"adt, L. Held, V. Isham eds.) 77-150
参见----------See Also----------
Front end for calling SVD.smooth and SVD.smooth.cv, using create.data.matrix to create a data matrix from a mesa.data structure.
前端调用SVD.smooth和SVD.smooth.cv,使用create.data.matrix从mesa.data结构创建一个数据矩阵。
See also SVD.miss, svd, and smooth.spline.
请参阅SVD.miss,svd,smooth.spline。
实例----------Examples----------
##let's load some data[#让我们加载一些数据]
data(mesa.data)
##let's compute two smooth trend functions[#让我们计算两个平稳态势功能]
trend <- calc.smooth.trends(mesa.data, n.basis = 2)
##and study the trends[#和研究的发展趋势]
par(mfrow=c(2,1), mar=c(2.5,2.5,.5,.5))
plot(trend$svd$date, trend$svd$V1, type="l", ylab="",xlab="",
ylim=range(c(trend$svd$V1,trend$svd$V2)))
lines(trend$svd$date, trend$svd$V2, col=2)
##Let's exclude locations with fewer than 100 observations[#让我们排除有少于100个观测]
IND <- names(which(table(mesa.data$obs$ID) >= 100))
##now we also compute the CV trends.[#现在我们也计算的CV趋势。]
trend2 <- calc.smooth.trends(mesa.data, n.basis = 2, subset=IND,
cv = TRUE)
##Let's compare to the previous result[#让我们比较先前的结果]
lines(trend2$svd$date, trend2$svd$V1, lty=2)
lines(trend2$svd$date, trend2$svd$V2, lty=2, col=2)
##we can also study the cross validated results to examine the[#我们也可以研究的交叉验证结果检查]
##possible variation in the estimated trends.[#可能的估计趋势变化。]
plot(trend$svd$date, trend2$svd$V1, type="n", ylab="",xlab="",
ylim=range(c(trend2$svd$V1,trend2$svd$V2)))
for(i in 1:length(trend2$svd.cv)){
lines(trend2$svd.cv[[i]]$date, trend2$svd.cv[[i]]$V1, col=1)
lines(trend2$svd.cv[[i]]$date, trend2$svd.cv[[i]]$V2, col=2)
}
##Let's use our new trend functions in the mesa.data[#让我们使用我们的新趋势在mesa.data功能]
mesa.data$trend <- trend2$svd
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|