iwlsm(RSiena)
iwlsm()所属R语言包:RSiena
Function to fit an iterated weighted least squares model.
函数来拟合一个迭代加权最小二乘模型。
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Fits an iterated weighted least squares model.
适合一个迭代加权最小二乘模型。
用法----------Usage----------
iwlsm(x, ...)
## S3 method for class 'formula'[类formula的方法]
iwlsm(formula, data, weights, ses, ..., subset, na.action,
method = c("M", "MM", "model.frame"),
wt.method = c("inv.var", "case"),
model = TRUE, x.ret = TRUE, y.ret = FALSE, contrasts = NULL)
## Default S3 method:[默认方法]
iwlsm(x, y, weights, ses, ..., w = rep(1/nrow(x), nrow(x)),
init = "ls", psi = psi.iwlsm,
scale.est = c("MAD", "Huber", "proposal 2"), k2 = 1.345,
method = c("M", "MM"), wt.method = c("inv.var", "case"),
maxit = 20, acc = 1e-4, test.vec = "resid", lqs.control = NULL)
psi.iwlsm(u, k, deriv = 0, w, sj2, hh)
参数----------Arguments----------
参数:formula
a formula of the form y ~ x1 + x2 + ....
公式的形式y ~ x1 + x2 + ...。
参数:data
data frame from which variables specified in formula are preferentially to be taken.
从数据框中指定的变量formula优先措施。
参数:weights
a vector of prior weights for each case.
每种情况下的现有的权重的矢量。
参数:subset
An index vector specifying the cases to be used in fitting.
索引向量指定接头的情况下被使用。
参数:ses
Estimated variance of the responses. Will be paseed to psi as sj2
估计变化的响应。 ,将paseedpsiSJ2
参数:na.action
A function to specify the action to be taken if NAs are found. The "factory-fresh" default action in R is na.omit, and can be changed by options(na.action=).
如果NAs的函数指定动作。在R的出厂时的默认操作是na.omit,,可以改变options(na.action=)。
参数:x
a matrix or data frame containing the explanatory variables.
的矩阵或数据框中包含的解释变量。
参数:y
the response: a vector of length the number of rows of x.
响应:ax的数量的行向量,长度。
参数:method
Must be "M". (argument not used here).
必须是“M”。 (参数不是用在这里)。
参数:wt.method
are the weights case weights (giving the relative importance of case, so a weight of 2 means there are two of these) or the inverse of the variances, so a weight of two means this error is half as variable? This will not work at present.
的权重的情况下的权重(施与的相对重要性的情况下,这样的重量的2装置有两个这样的)或方差的倒数,所以2的重量的装置,该错误的一半变量?这目前还没有起作用。
参数:model
should the model frame be returned in the object?
返回的对象模型框架?
参数:x.ret
should the model matrix be returned in the object?
返回的对象模型矩阵?
参数:y.ret
should the response be returned in the object?
响应返回的对象吗?
参数:contrasts
optional contrast specifications: se lm.
可选的对比度指标:SElm。
参数:w
(optional) initial down-weighting for each case. Will not work at present.
(可选)首期权重为每一种情况下。目前还没有起作用。
参数:init
(optional) initial values for the coefficients OR a method to find initial values OR the result of a fit with a coef component. Known methods are "ls" (the default) for an initial least-squares fit using weights w*weights, and "lts" for an unweighted least-trimmed squares fit with 200 samples. Probably not functioning.
(可选)的初始值系数的方法找到的初始值或一个coef组件一个适合的结果。已知的方法是"ls"(默认值),初步最小二乘拟合使用权w*weights和"lts"非加权至少修剪广场的适应与200个样本。可能无法正常工作。
参数:psi
the psi function is specified by this argument. It must give (possibly by name) a function g(x, ..., deriv, w) that for deriv=0 returns psi(x)/x and for deriv=1 returns some value. Extra arguments may be passed in via ....
该参数所指定PSI的功能。它必须给(可能的名称)的函数g(x, ..., deriv, w),deriv=0回报PSI(x)/ x和deriv=1返回一定的价值。额外的参数可以通过在通过...。
参数:scale.est
method of scale estimation: re-scaled MAD of the residuals (default) or Huber's proposal 2 (which can be selected by either "Huber" or "proposal 2").
规模估算方法:重新调整MAD的残差(默认)或Huber的建议(可以选择是"Huber"或"proposal 2"“)。
参数:k2
tuning constant used for Huber proposal 2 scale estimation.
时间常数用于胡贝尔建议规模估算。
参数:maxit
the limit on the number of IWLS iterations.
限制的数目IWLS迭代。
参数:acc
the accuracy for the stopping criterion.
停止标准的准确性。
参数:test.vec
the stopping criterion is based on changes in this vector.
停止标准,基于此向量的变化。
参数:...
additional arguments to be passed to iwlsm.default or to the psi function.
额外的参数被传递到iwlsm.default或psi功能。
参数:lqs.control
An optional list of control values for lqs.
可选列表的控制值lqs。
参数:u
numeric vector of evaluation points.
数字矢量评估点。
参数:k
tuning constant. Not used.
时间常数。未使用。
参数:deriv
0 or 1: compute values of the psi function or of its first derivative. (Latter not used).
0或1:PSI的功能或它的一阶导数的计算值。 (后期不使用)。
参数:sj2
Estimated variance of the responses
估计变化的响应
参数:hh
Diagonal values of the hat matrix
的帽子矩阵对角线值
Details
详细信息----------Details----------
This function is very slightly adapted from rlm in packages MASS. It alternates between weighted least squares and estimation of variance on the basis of a common variance. The function psi.iwlsm calculates the weights for the next iteration. Used by siena08 to combine estimates from different sienaFits.
这个功能是非常轻微改编自rlm包中的MASS。它交替之间的共同变异的基础上,加权最小二乘法和方差的估计。的功能psi.iwlsm为下一次迭代中计算的权重。用于通过siena08相结合的估计,从不同的sienaFits。
值----------Value----------
An object of class "iwlsm" inheriting from "lm". Note that the df.residual component is deliberately set to NA to avoid inappropriate estimation of the residual scale from the residual mean square by "lm" methods.
类的一个对象"iwlsm"继承"lm"。需要注意的是df.residual组件是故意设置NA,以避免不适当的剩余规模估计剩余均方"lm"方法。
The additional components not in an lm object are
在lm对象的附加组件
参数:s
the robust scale estimate used
使用强大的规模估计
参数:w
the weights used in the IWLS process
使用的加权数在IWLS过程
参数:psi
the psi function with parameters substituted
PSI的功能与参数取代
参数:conv
the convergence criteria at each iteration
在每次迭代的收敛准则
参数:converged
did the IWLS converge?
在IWLS收敛吗?
参数:wresid
a working residual, weighted for "inv.var" weights only.
一个工作"inv.var"重量仅残留,加权。
注意----------Note----------
The function has been changed as little as possible, but has only been used with default arguments. The other options have been retained just in case they may prove useful.
尽可能少的功能已经改变,但只使用默认参数。其他的选项都得到了保留,以防万一,他们可能被证明是有用的。
(作者)----------Author(s)----------
Ruth Ripley
参考文献----------References----------
Modern Applied Statistics with S. Fourth edition. Springer. See also http://www.stats.ox.ac.uk/~snijders/siena/
参见----------See Also----------
siena08, sienaMeta, sienaFit
siena08,sienaMeta,sienaFit
实例----------Examples----------
## Not run: [#不运行:]
##not enough data here for a sensible example, but shows the idea.[没有足够的数据在这里一个明智的例子,但显示出的主意。]
mymodel <- sienaModelCreate(fn=simstats0c, nsub=2, n3=100)
mynet1 <- sienaNet(array(c(s501, s502), dim=c(50, 50, 2)))
mynet2 <- sienaNet(array(c(s502, s503), dim=c(50, 50, 2)))
mydata1 <- sienaDataCreate(mynet1)
mydata2 <- sienaDataCreate(mynet2)
myeff1 <- getEffects(mydata1)
myeff2 <- getEffects(mydata2)
myeff1 <- setEffect(myeff1, transTrip, fix=TRUE, test=TRUE)
myeff2 <- setEffect(myeff2, transTrip, fix=TRUE, test=TRUE)
myeff1 <- setEffect(myeff1, cycle3, fix=TRUE, test=TRUE)
myeff2 <- setEffect(myeff2, cycle3, fix=TRUE, test=TRUE)
ans1 <- siena07(mymodel, data=mydata1, effects=myeff1, batch=TRUE)
ans2 <- siena07(mymodel, data=mydata2, effects=myeff2, batch=TRUE)
meta <- siena08(ans1, ans2)
metadf <- split(meta$thetadf, meta$thetadf$effects)[[1]]
metalm <- iwlsm(theta ~ tconv, metadf, ses=se^2)
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|