找回密码
 注册
查看: 499|回复: 0

R语言 RMC包 RMC.pred()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-26 23:56:37 | 显示全部楼层 |阅读模式
RMC.pred(RMC)
RMC.pred()所属R语言包:RMC

                                        Prediction of local area stationary distribution for an arbitrary number of covariate combinations.
                                         预测中的协变量的组合任意数量的本区域域平稳分布。

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Predicts the "local area stationary distribution" (with standard errors), and the average of all predictions (with standard errors). The latter prediction and the standard error can be taken to be an areal prediction if the number of points in the area is large and the covariance is not too high.
“区域固定分配”(标准误差),和所有的预测(标准误差)的平均预测。后者的预测及标准误差可采取的面积的预测,如果在区域的点的数量是大的,和协方差不太高。


用法----------Usage----------


RMC.pred( fit, fit2=NULL, pts)



参数----------Arguments----------

参数: fit
an object resulting from an RMC fit. This model must relate to the set of observations whose marginal distribution is required.
产生的对象从一个RMC拟合。此模型必须涉及到的一组观测,其边缘分布是必需的。


参数: fit2
an object resulting from an RMC fit whose outcomes are covariates for the outcomes in the object fit. See Foster et al. (2009) for details on the process.
从RMC合适的协变量的对象配合的结果,其结果是产生的对象。见Foster等。 (2009)的过程。


参数: pts
a data matrix whose covariates must match those in the RMC objects fit and fit2. This matrix defines the points where the predictions are to occur.
数据矩阵的协变量必须符合在RMC对象的配合和FIT2。此矩阵定义点的预测发生。


Details

详细信息----------Details----------

Predictions are made at each specified point by calculating the stationary distribution of the transition matrix for that combination of covariates. The variance, due to parameter uncertainty, of these prediction is obtained using the delta approximation. For predictions of a univariate model these derivatives are found using automatic differentiation (see Griewank 2001) implemented using the CppAD tool (Bell 2007). For predictions of a bivariate model the derivatives are found using finite differences and hence this procedure can run a little slow (well, a lot slow). If this causes problems then a more sophisticated implementation can be considered.
在每一个指定的点,通过计算该组合的协变量的平稳分布的过渡矩阵进行预测。由于参数的不确定性,这些预测的方差,得到的德尔塔近似。单变量模型预测这些衍生工具发现使用自动微分(看到Griewank 2001)的实施,使用CppAD工具(贝尔2007)。一个双变量模型预测的衍生工具发现用有限差分法,因此这个程序可以运行有点慢(当然,有很多很慢)。如果这会导致问题,那么可以考虑一个更复杂的实施。

Global (or areal if the points come from a contiguous region of space) predictions are also calculated as the simple average of the predicted points. The variance of this average can be used as a prediction variance if the number of prediction points is large and the covariance between them is not too severe.
全球(或面点来自一个连续的空间区域)预测的预测点的简单平均值计算。作为预测方差,如果预测点的数目是大的,和它们之间的协方差是不是太严重,可以使用该平均方差。

Predictions for univariate chained data are obtained by specifying a single model to the "fit" argument (keeping the "fit2" argument NULL). Predictions for the second variable of bivariate chained data are obtained by specifying the target univariate model in the "fit" argument, and the non-target univariate model in "fit2". This methodology was developed to predict fauna types where geomorphology (also chained data) was used as a covariate in the fauna model.
为单变量链接数据的预测是通过指定一个单一的模式,“适合”的说法(保持“FIT2”的说法NULL)。第二个变量的二元链数据的预测是通过指定的目标单因素模型中的“合体”的说法,,在“FIT2”单因素分析和非目标。这种方法也发展来预测动物区系类型的地貌(也链接数据)被用来作为协变量在动物模型。

Details are given in Foster et al. 2009.
有关详情载于Foster等人。 2009年。


值----------Value----------

<table summary="R valueblock"> <tr valign="top"><td> area</td> <td> the average of the predictions. Can be used as an areal prediction</td></tr> <tr valign="top"><td> pts</td> <td> point predictions for each of the rows in the prediction matrix</td></tr> <tr valign="top"><td> vcov</td> <td> variance and covariance matrix of the areal predictions. This is only calculated if the parameter estimate's variance for fit (and fit2 if not null) are present</td></tr> </table>
<table summary="R valueblock"> <tr valign="top"> <TD>  area</ TD> <TD>的平均预测。可作为面积预测</ TD> </ TR> <tr valign="top"> <TD> pts </ TD> <TD>点预测的预测矩阵中的行< / TD> </ TR> <tr valign="top"> <TD> vcov</ TD> <TD>方差和协方差矩阵的面积的预测。如果只计算参数估计的方差适合(和FIT2如果不为null),是目前</ TD> </ TR> </ TABLE>


(作者)----------Author(s)----------


Scott D. Foster



参考文献----------References----------

Bell BM. 2007. CppAD: a package for C++ algorithmic differentiation, COIN-OR. http://www.coin-or.org/CppAD/, version 2007/02/07.
Foster, S.D., Bravington, M.V., Williams, A., Althaus, F, Laslett, G.M., and Kloser, R.J. (2008) Analysis and prediction of faunal distributions from video and multi-beam sonar data using Markov models. Environmetrics, 20: 541-560.
Griewank A. (2001) Evaluating Derivatives: Principles and Techniques of Algorithmic Differentiation. SIAM. Philadelphia.

参见----------See Also----------

RMC.mod to estimate the Markov model, MVfill to impute any missing values in a particular sub-set of covariates, and sim.chain to simulate chained data.
RMC.mod估计的马尔可夫模型,MVfill归咎于任何遗漏值在一个特定的子集协变量,和sim.chain的来模拟链接数据。


实例----------Examples----------


#fit model to non-stationary data including all covariates[包括所有协变量非平稳数据的拟合模型]
fm.est1 &lt;- RMC.mod( states=dataEG2[,2], chain.id=dataEG2[,1], X=dataEG2[,3:4], vcov=TRUE)        #estimate the model[估计模型]
#perform predictions[执行预测]
pred1 <- RMC.pred( fit=fm.est1, fit2=NULL, pts=dataEG2[,3:4])
tmp <- cbind( table( dataEG2[,"state"]) / nrow( dataEG2), pred1$area, sqrt( diag( pred1$vcov)))
colnames( tmp) <- c( "observed", "predicted", "se")
rownames( tmp) <- paste( "cat",1:fm.est1$stuff$n.cats, sep="_")
print( tmp)
####Simulate and predict from bivariate non-stationary chained data[###从二元非固定链接数据模拟和预测]
n.cats1 <- fm.est1$stuff$n.cats; n.cats2 <- 5; n.covars <- 2; n.covars2 <- n.covars*n.cats1 + n.covars
#fill in missing values (if any) for the previous outcomes that are now covariates[填写以前的成果,现在协变量的遗漏值(如果有的话)]
level1Probs <- MVfill( fm.est1, states=dataEG2[,2], chain.id=dataEG2[,1], X=dataEG2[,3:4])
#setting up design matrix -- note the order, it is important for RMC.pred[建立设计矩阵 - 注意顺序,重要的是,RMC.pred]
X2 <- matrix( rep( dataEG2[,3:4], n.cats1+1), nrow=nrow( dataEG2))
for( ii in 1:n.cats1)
  X2[,ii*n.covars+1:n.covars] <- X2[,ii*n.covars+1:n.covars] * rep( level1Probs[,ii], n.covars)
colnames(X2) <- paste( c( "const", "rand"), rep(c("",1:n.cats1), each=2), sep="")
#specify parameter values, note that parameterisation gives state 1 as a reference state for all categories. This is for convenience only.[指定参数值,请注意,参数化提供了状态为参考状态的所有类别。这是为了方便。]
gamma &lt;- matrix( rnorm( n.covars2*n.cats2, sd=0.5), nrow=n.covars2, ncol=n.cats2)        #initial design matrix[最初的设计矩阵]
for( ii in 1:n.cats2)
  gamma[sample( 2:n.covars2, sample(n.covars2-1:4, 1)), ii] <- 0
beta <- matrix( rnorm( n.covars2*n.cats2, sd=0.5), nrow=n.covars2, ncol=n.cats2)
beta[n.covars+1:n.covars,] <- 0
beta[,n.cats2] <- 0
#simulate chains[模拟链]
chains2 &lt;- sim.chain( n.chains=5, n.obs=rep( 1000, 5), n.cats=n.cats2, n.covars=n.covars2, beta=beta, gamma=gamma, X=X2)        #simulate the chained categorical data[模拟链接的分类数据]
#specify RMC model to be estimated[指定RMC模型进行估计]
my.phi.id &lt;- ifelse( gamma!=0, 1, 0)        #model controlling matrix[模型控制矩阵]
my.pi.id &lt;- apply( beta, FUN=function(x){if( any( x!=0)) 1 else 0}, MARG=1)        #model controlling matrix[模型控制矩阵]
#fit model[拟合模型]
fm.est2 &lt;- RMC.mod( states=chains2[,2], chain.id=chains2[,1], X=X2, phi.id=my.phi.id, pi.id=my.pi.id, vcov=TRUE)        #estimate the model[估计模型]
#perform predictions[执行预测]
pred2cond <- RMC.pred( fit=fm.est2, fit2=NULL, pts=X2)
pred2marg <- RMC.pred( fit=fm.est2, fit2=fm.est1, pts=dataEG2[,3:4])
#check against empirical value[检查的经验值]
tmp <- cbind( table( chains2[,"state"]) / nrow( chains2), pred2cond$area, sqrt( diag( pred2cond$vcov)), pred2marg$area, sqrt( diag( pred2marg$vcov)))
colnames( tmp) <- c("observed","conditional prediction", "conditional se", "marginal prediction", "marginal se")
rownames( tmp) <- paste( "category", 1:n.cats2, sep="_")
print( tmp)

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2024-11-24 00:15 , Processed in 0.029631 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表