parse.par(Zelig)
parse.par()所属R语言包:Zelig
Select and reshape parameter vectors
选择和重塑参数向量
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The parse.par function reshapes parameter vectors for comfortability with the output matrix from model.matrix.multiple. Use parse.par to identify sets of parameters; for example, within optimization functions that require vector input, or within qi functions that take matrix input of all parameters as a lump.
parse.par功能的舒适性与重塑参数向量输出矩阵model.matrix.multiple。使用parse.par确定的参数集,例如,在需要输入矢量的优化功能,或在qi功能,并以矩阵输入的所有参数作为整。
用法----------Usage----------
parse.par(par, terms, shape = "matrix", eqn = NULL)
参数----------Arguments----------
参数:par
the vector (or matrix) of parameters
向量(或矩阵)的参数
参数:terms
the terms from either model.frame.multiple or model.matrix.multiple
是model.frame.multiple或model.matrix.multiple
参数:shape
a character string (either "matrix" or "vector") that identifies the type of output structure
输出结构的类型,标识字符字符串("matrix"或"vector")
参数:eqn
a character string (or strings) that identify the parameters that you would like to subset from the larger par structure
一个字符串(或字符串)的子集确定的参数,你想从更大的par结构
值----------Value----------
A matrix or vector of the sub-setted (and reshaped) parameters for the specified parameters given in "eqn". By default, eqn = NULL, such that all systematic components are selected. (Systematic components have ExpVar = TRUE in the appropriate describe.model function.)
在"eqn"给出的指定的参数的矩阵或矢量的子设播(及重构)参数。默认情况下,eqn = NULL,这样,所有的系统部件的选择。 (系统组件有ExpVar = TRUE在合适的describe.model函数)。
If an ancillary parameter (for which ExpVar = FALSE in describe.model) is specified in eqn, it is always returned as a vector (ignoring shape). (Ancillary parameters are all parameters that have intercept only formulas.)
如果的辅助参数(ExpVar = FALSEdescribe.model)中指定的eqn,它总是返回一个向量(忽略shape)。 (辅助参数是所有参数,拦截唯一的公式。)
(作者)----------Author(s)----------
Kosuke Imai <<a href="mailto:kimai@princeton.edu">kimai@princeton.edu</a>>; Gary King
<<a href="mailto:king@harvard.edu">king@harvard.edu</a>>; Olivia Lau <<a href="mailtolau@fas.harvard.edu">olau@fas.harvard.edu</a>>; Ferdinand Alimadhi
<<a href="mailto:falimadhi@iq.harvard.edu">falimadhi@iq.harvard.edu</a>>
参见----------See Also----------
model.matrix.multiple, parse.formula and the full Zelig manual at
model.matrix.multiple,parse.formula和完整的Zelig手册在
实例----------Examples----------
# Let's say that the name of the model is "bivariate.probit", and[比方说,该模型的名称是“bivariate.probit”,并]
# the corresponding describe function is describe.bivariate.probit(), [相应形容的功能是describe.bivariate.probit(),]
# which identifies mu1 and mu2 as systematic components, and an [标识MU1,MU2作为系统组件,和一个]
# ancillary parameter rho, which may be parameterized, but is estimated [辅助参数rho沸石,这可能是参数化的,但估计]
# as a scalar by default. Let par be the parameter vector (including [默认情况下,作为一个标量。让看齐的参数向量(包括]
# parameters for rho), formulae a user-specified formula, and mydata[rho沸石的参数),公式用户指定的式,MYDATA的]
# the user specified data frame. [用户指定的数据框。]
# Acceptable combinations of parse.par() and model.matrix() are as follows:[上可接受的组合parse.par()和model.matrix()如下:]
## Setting up[#设置]
## Not run: [#不运行:]
data(sanction)
formulae <- cbind(import, export) ~ coop + cost + target
fml <- parse.formula(formulae, model = "bivariate.probit")
D <- model.frame(fml, data = sanction)
terms <- attr(D, "terms")
## Intuitive option[#直观的选项]
Beta <- parse.par(par, terms, shape = "vector", eqn = c("mu1", "mu2"))
X <- model.matrix(fml, data = D, shape = "stacked", eqn = c("mu1", "mu2")
eta <- X
## Memory-efficient (compact) option (default)[#内存效率(紧凑型)选项(默认)]
Beta <- parse.par(par, terms, eqn = c("mu1", "mu2"))
X <- model.matrix(fml, data = D, eqn = c("mu1", "mu2"))
eta <- X
## Computationally-efficient (array) option[#计算效率(阵列)选项]
Beta <- parse.par(par, terms, shape = "vector", eqn = c("mu1", "mu2"))
X <- model.matrix(fml, data = D, shape = "array", eqn = c("mu1", "mu2"))
eta <- apply(X, 3, '
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|