model.matrix.multiple(Zelig)
model.matrix.multiple()所属R语言包:Zelig
Design matrix for multivariate models
多变量模型的设计矩阵
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Use model.matrix.multiple after parse.formula to
使用model.matrix.multiple后parse.formula
用法----------Usage----------
## S3 method for class 'multiple'
model.matrix(object, data, shape = "compact", eqn = NULL, ...)
参数----------Arguments----------
参数:object
the list of formulas output from parse.formula
列表中的公式输出parse.formula
参数:data
a data frame created with model.frame.multiple
一个数据框创建model.frame.multiple
参数:shape
a character string specifying the shape of the outputed matrix. Available options are
一个字符的字符串,指定的形状的outputed矩阵。可用的选项有
"compact"(default) the output matrix will be an n x v, where v is the number of unique variables in all of the equations (including the intercept term)
“紧凑型”(默认),输出矩阵将是一个n x v,其中v是在所有的方程中的唯一变量(包括截距项)
"array"the output is an n x K x J array where J is the total number of equations and K is the total number of parameters across all the equations. If a variable is not in a certain equation, it is observed as a vector of 0s.
“阵列”输出是一个n x K x J阵列J总数的方程和K是在所有的方程中的参数的总数。如果变量是没有在一定的方程,它是观察到的0为一个向量。
"stacked"the output will be a 2n x K matrix where K is the total number of parameters across all the equations. </ul>
“堆叠”的输出将是一个2n x K矩阵K的总人数在所有的方程中的参数。 </ ul>
参数:eqn
a character string or a vector of character strings identifying the equations from which to construct the design matrix. The defaults to NULL, which only uses the systematic parameters (for which DepVar = TRUE in the appropriate describe.model function)
一个字符串或字符串识别从构造设计矩阵方程的矢量。 NULL,它仅使用系统参数(默认为DepVar = TRUE在适当的describe.model函数)
参数:...
additional arguments passed to model.matrix.default
额外的参数传递给model.matrix.default
值----------Value----------
A design matrix or array, depending on the options chosen in shape, with appropriate terms
一个设计矩阵或数组,取决于选择在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----------
parse.par, parse.formula and the full Zelig manual at
parse.par,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:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|