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

R语言 relaimpo包 calc.relimp()函数中文帮助文档(中英文对照)

  [复制链接]
发表于 2012-9-25 20:19:53 | 显示全部楼层 |阅读模式
calc.relimp(relaimpo)
calc.relimp()所属R语言包:relaimpo

                                        Function to calculate relative importance metrics for linear models
                                         函数来计算的相对重要性指标线性模型

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

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

calc.relimp calculates several relative importance metrics for the linear model.  The recommended metrics are lmg (R^2 partitioned by averaging over orders, like in Lindemann, Merenda and Gold (1980, p.119ff))  and pmvd (a newly proposed metric by Feldman (2005) that is provided in the non-US version of the package only).  For completeness and comparison purposes, several other metrics are also on offer (cf. e.g. Darlington (1968)).
calc.relimp计算的线性模型的的几个相对重要性度量。建议的指标是lmg(R^2分区的平均订单,如林德曼,MERENDA和黄金(1980年,p.119ff))和pmvd(新提出的度量费尔德曼( 2005),其设置在非美国版本的包只)。 ,其他几个指标为了完整性和比较的目的是提供(参见例如达林顿管(1968))。


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



## generic function
calc.relimp(object, ...)

## default S3 method, should be called without suffix ".default"
calc.relimp.default(object, x = NULL, ...,
       type = "lmg", diff = FALSE, rank = TRUE, rela = FALSE, always = NULL,
       groups = NULL, groupnames = NULL, weights=NULL, design=NULL)

## S3 method for formula object, should be called without suffix ".formula"
calc.relimp.formula(formula, data, weights, na.action, ..., subset=NULL)

## S3 method for objects of class lm
calc.relimp.lm(object, type = "lmg", groups = NULL, groupnames=NULL, always = NULL, ...)




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

参数:object   
The class of this object determines which of the methods is used: There are special methods for output objects from function lm  (or linear model objects inheriting from class lm  generated by other functions like glm and svyglm) and for formula objects. For all other types of object, the default method is used.
这个对象的类的方法是:有特殊的方法来输出对象从功能lm(或线性模型对象继承类流明所产生的其他功能,如glm和<X >)和公式对象。对于所有其他类型的对象,默认的方法。

Thus, object can be
因此,对象可以是

a formula (e.g. y\~x1+x2+x3+x2:x3) (cf. below for details)
公式(例如&#376;\~X1 + X2 + X3 + X2:X3)(参见下面的详细信息)

OR


the output of a linear model call (inheriting from class lm, but not mlm);  output objects from lm, glm, svyglm or aov work  (if linear with identity link in case of glm's); there may be further functions that output objects inheriting from lm  which may or may not work reasonably with calc.relimp;  for calc.relimp to be appropriate, the underlying model must at least be linear!
输出的线性模型调用(继承自类lm,但不是mlm);输出对象lm,glm,svyglm或<X工作(线性与身份联系GLM的情况下,),可能有更多的功能输出对象继承aov可能会或可能无法正常工作合理的lm,calc.relimp的要适当,底层模型必须至少是线性的!

The restrictions on usage of interactions listed under item formula below also  apply to linear model objects.  
项以下公式所列的互动使用上的限制也适用于线性模型对象。

OR  


the covariance matrix of a response y and regressors x,  (e.g. obtained by cov(cbind(y,x)), if y is a column vector of response values  and x a corresponding matrix of regressors)  
的响应y和回归量x的协方差矩阵,(例如,通过以下方式获得覆盖(CBIND(y中,x)),如果y是响应值和xa相应的回归矩阵的列向量)

OR  


a (raw) data matrix or data frame with the response variable in the first column
(原料)的矩阵数据的帧或数据框的响应变量的第一列中




OR


a response vector or one-column matrix,  if x contains the corresponding matrix or data frame of regressors.
响应向量或一列的矩阵,如果x包含了相应的回归系数矩阵或数据框。


参数:formula   
The first object, if a formula is to be given;  one response only.  
的第一个对象,如果一个公式是要给出一个响应只。

Interaction terms are currently limited to second-order.
目前仅限于二阶交互条款。

Note: If several interaction terms are given, calculations may be very  resource intensive, if these are all connected (e.g. with A:B, B:C, C, all A,B,C,D are connected,  while with A:B, C, D:E there are separate groups A,B and C,D,E).  
注:如果有多个交互项,计算可能会是非常耗费资源,如果这些都连接(例如:A:B,B:C,C:D,A,B,C,D的连接,而与A :B,C:D,D:E有不同的组A,B,C,D,E)。

Interaction terms occurring in always do not increase resource usage  (but are only permitted if the respective main effects also occur in always).
发生的交互项中始终不增加资源的使用(但如果只被允许在各自的主效应也发生在总)。

Interactions and groups currently cannot be used simultaneously.  
相互作用和组目前还不能同时使用。


参数:x   
a (raw) data matrix or data frame containing the regressors,  if object is a response vector or one-column matrix
(RAW)数据矩阵或数据框包含的回归系数,如果object是一个的响应向量或一列的矩阵

OR  


NULL, if object is anything else
NULL,如果object是别的


参数:type   
can be a character string, character vector or list of character strings. It is the collection of metrics that are to be calculated.  Available metrics: lmg, pmvd (non-US version only), last, first,  betasq, pratt, genizi and car. For brief sketches of their meaning cf. details section.
可以是一个字符串,字符向量或字符串列表。以计算的度量,它是集合。可用的度量:lmg,pmvd(非美国版本),last,first,betasq,pratt,genizi 和car。对于短暂的草图,其意义比照。详细信息部分。


参数:diff   
logical; if TRUE, pairwise differences between the relative contributions are calculated; default FALSE
逻辑,如果TRUE,两两之间的差异的相对贡献计算值,默认为false


参数:rank   
logical; if TRUE, ranks of regressors in terms of relative contributions are calculated; default TRUE
逻辑,如果TRUE,队伍的相对贡献的回归系数计算,默认为true


参数:rela   
is a logical requesting relative importances summing to 100% (rela=TRUE).  If rela is FALSE (default), some of the metrics sum to R^2 (lmg, pmvd, pratt),  others do not have a meaningful sum (last, first, betasq).
是一个逻辑请求相对重要性求和至100%(rela=TRUE)。如果关系是FALSE(默认值),一些的指标总和R^2(lmg,pmvd,pratt),别人没有一个有意义的总和(<X >,last,first)。


参数:always
is a vector of column numbers or names of variables to be always in the  model (adjusted for). Valid numbers are 2 to (number of regressors + 1) (1 is reserved for the response),  valid character strings are all column names of object or x respectively  that refer to regressor variables. Numbers and names cannot be mixed.  
是一个向量,列编号或名称的变量总是在模型中(调整)。有效的数字是2(数字+ 1)的回归系数(响应)被保留,有效的字符串是所有列名object或x引用回归量的变量。编号和名称不能混用。

Relative importance is only assessed for the variables not selected in always.  
相对重要性的评估变量中选择always。

This option currently does not work for metrics genizi and car.
目前,此选项不工作的指标genizi和car。


参数:groups
is a list of vectors of column numbers or names of variables to be combined into groups.  If only one group is needed, a vector can be given. The numbers and character strings needed are of the same form  as for always.  
是向量的列数或组合成组的变量的名称的列表。如果只有一个组是必要的,可以给出一个矢量。需要的数字和字符串是相同的形式为always。

Relative importance is only allocated between groups of regressors, no subdivision within groups is calculated.  Regressors that do not occur in any group are included as singletons. A regressor must not occur in always and in groups. Also, groups cannot be used with a linear model or a formula  in case of higher order effects (interactions). Finally, groups only works with the four metrics  lmg, pmvd, last and first.
仅分配的相对重要性的回归量组之间,组内没有细分的计算方法。回归量,不会出现在任何一组为单身。一个回归量不能发生在always和groups。此外,基团可以不被使用的一个线性模型或高阶效应(相互作用)的箱子中的公式。最后,groups只适用于四个度量标准lmg,pmvd,last和first。


参数:groupnames
is a vector of names for the variable groups to be used for annotation of output.
是一个向量,用于输出注解的变量组的名称。


参数:weights
is a vector of case weights for the observations in the data frame (or matrix). You can EITHER specify weights OR a design. Note that weights must not be specified for linear model objects (since these should contain their weights as  part of the model).
是一个向量,在数据框中的观察(或矩阵)的情况下的权重。您可以指定weights或design。请注意,权重必须被指定为线性模型对象(因为这些模型的一部分,应该有其权重)。


参数:design
is a design object of class survey.design (cf. package survey). You can EITHER specify a design OR weights. For calc.relimp, the design is used  for calculating weights only. Note that it is discouraged (though possible) to specify a design for a conventional linear model object  (since a survey-specific linear model should be used for survey data, cf. function svyglm).  
是一家集设计类的对象survey.design(参见套件“survey)。您可以指定一个design或weights。对于calc.relimp,仅用于计算权重的设计。需要注意的是它不鼓励(尽管可能)指定一个设计为常规的线性模型对象(自一项调查特定的线性模型应该用于调查数据,比照。功能svyglm)。

Also note that care is needed when using subset together with design:  the subset-Option only treats the data handed directly to calc.relimp, the design has to be equivalently treated beforehand.
还要注意的时,需要谨慎使用subset一起design,subset选项只把data直接交给calc.relimp,<X >等效预先处理。


参数:data
if first object is of class formula:  an optional matrix or data frame that the variables in formula and subset come from;  if it is omitted, all names must be meaningful in the environment from which calc.relimp is called
如果第一个对象是类的公式:一个可选的矩阵或数据框公式中的变量和子集;如果它被省略,所有名称都必须是有意义的,从被称为这calc.relimp的环境


参数:subset
if first object is of class formula:  an optional expression indicating the subset of the observations of data that should be used in the fit.  This can be a logical vector, or a numeric vector indicating which observation numbers are to be included,  or a  character  vector of the row names to be included.  All (non-missing) observations are included by default.
如果第一对象是类的公式:一个可选的表达式表示的子集的意见data,应使用在拟合。这可以是一个逻辑向量,或一个数值向量表示观察号码将被包括,或者被包含的行的名称的字符矢量。默认情况下,所有观察(非缺失)。


参数:na.action
if first object is of class formula:  an optional function that indicates what should happen when the data contain 'NA's.  The default is first, any na.action attribute of data, second the setting given in the call to calc.relimp, third the na.action setting of options. Possible choices are "na.fail",   (print an error message and terminate if there are any incomplete observations),  "na.omit" or "na.exclude" (equivalent for package relaimpo,  both analyse complete cases only and print a warning, this is also what is done the default method ).
如果第一个对象是类的公式:一个可选的功能,显示时会发生什么数据包含“NA”。默认是第一,任何na.action的属性数据,第二个是在调用calc.relimp,第三na.action设置的选项的设置。可能的选择是“na.fail”(打印错误消息并终止,如果有任何不完整的观察),“na.omit”或“na.exclude”(相当于包relaimpo的,同时分析完整的情况下只和打印一个警告,这也是做了什么默认的方法)。


参数:...
usable for further arguments,  particularly most arguments of default method can be given to all other methods  (exception: weights and design cannot be given to lm-method)
可用于进一步的论据,特别是大多数参数的默认方法,可以给所有其他的方法(例外:重量和设计不能给LM-法)


Details

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

  


lmg is the R^2 contribution averaged over orderings among regressors, cf. e.g. Lindeman, Merenda and Gold 1980,  p.119ff or Chevan and Sutherland (1991).  
LMG是R^2贡献之间的回归系数的平均值排序,比照。例如林德曼,MERENDA黄金1980年,p.119ff谢旺和Sutherland(1991)。

pmvd is the proportional marginal variance decomposition as proposed by Feldman (2005) (non-US version only). It can be interpreted as a weighted average over orderings among regressors, with data-dependent weights.   
pmvd是成正比的边际方差分解费尔德曼(2005)(非美国版本)所提出的。它可以被解释为加权平均超过序之间回归,与依赖于数据的权重。

last is each variables contribution when included last, also sometimes called usefulness.  
最后是每个变量的贡献,包括去年的时候,有时也被称为用处。

first is each variables contribution when included first, which is just the squared covariance between y and the variable.
首先是每个变量的贡献时,首先,这仅仅是y和变量之间的协方差平方。

betasq is the squared standardized coefficient.  
betasq是标准化系数的平方。

pratt is the product of the standardized coefficient and the correlation.
pratt中的标准化系数和相关性的产品。

genizi is the R^2 decomposition according to Genizi 1993
根据Genizi 1993年,genizi是R^2分解

car is the R^2 decomposition according to Zuber and Strimmer 2010, also available from package care  (squares of scores produced by function carscore    Each metric is calculated using the internal function &ldquo;metric&rdquo;calc, e.g. lmgcalc.
汽车是R^2分解,根据二零一零年朱伯与Strimmer的,也可从包装care(广场的分数产生的功能carscore每公吨计算的内部函数“公制” calc,例如lmgcalc。

Five of the metrics in calc.relimp (lmg, pmvd, pratt, genizi and car),  decompose the model R^2.  calc.relimp (lmg, pmvd, pratt, genizi and car) sum to the R^2 that is to be decomposed,  if rela = FALSE and to 100pct if rela = TRUE.
五的指标calc.relimp(lmg,pmvd,pratt,genizi和car),分解模型R^2 。 calc.relimp(lmg,pmvd,pratt,genizi和car)的总和R^2是被分解的,如果rela = FALSE如果rela = TRUE和100pct。

The other metrics also (artificially) sum to 100pct if rela = TRUE.  If rela = FALSE, they are given relative to var(y) (or the conditional variance of y after adjusting out the variables  requested in always) but do not sum to R^2.
其他指标也(人工)的总和100pct rela = TRUE。如果rela = FALSE,他们给出相对于VAR(Y)(或条件方差为y后调整出请求的变量在always),但总和不等于R^2。

If always requests some variables to be always in the model, these are conditioned upon  (i.e. included into the model first). Only the remaining R^2 that is not explained by  these variables is decomposed among the other regressors. This currently does not work for metrics genizi and car.
如果always请一些变量来一直在模型中,这些条件(即模型首次纳入)。仅剩下R^2不能解释这些变量之间的回归系数分解。目前不适用于度量genizi和car。

Four of the metrics, lmg, pmvd, first and last,  are related to the order in which the variables are included into the model.  For these it is possible to consider the variables in groups that are always entered into the model together.
四的指标,lmg,pmvd,first和last,有关的变量纳入到模型中的顺序。对于这些有可能考虑组总是一起输入到模型中的变量。

Note that relaimpo can only provide metric lmg for models with interactions (2-way interactions only).  It averages only over those orders, for which the interactions enter the model after both their main effects.
需要注意的是relaimpo只能提供的公制lmg模型与相互作用的(仅2双向互动)。平均只有那些订单,其中的互动进入模型后,其主要作用。

Note that there are different types of weights, weights indicating the variability of the response  (observations with a more variable responses receive a lower weight than those with a less variable response, like in the Aitken estimator), frequency weights indicating the number of observations with exactly the observed  data pattern of the current observation, or weights indicating the number of population units represented by the  current observation (inverse sampling probability, weights typically used in survey situations). All three types of  weight alike can be handed to function calc.relimp using the weights= option. Note, however, that they  have to be treated differently for bootstrapping (cf. boot.relimp).
请注意,有不同类型的权重,重量表示的可变性的响应(观测与更可变的响应收到较低的权重比那些具有较少变量响应,如在艾特肯估计),频率的权重表示观测值的个数与完全观测到的数据模式的当前的观测值,或重量表示的数目表示的当前的观测值(逆抽样概率,通常在调查的情况中使用的权重)的人口单位。所有这三种类型的重量,都可以传递给函数calc.relimp使用weights=选项。但是,请注意,他们必须区别对待,对引导(参见boot.relimp)。

Data from complex surveys can be treated by providing a survey design with design=-option.  For calc.relimp, it is also sufficient to provide the weights derived from the design using the  weights=-option.
从复杂的调查数据可以提供的一项调查处理的设计与design=选项。对于calc.relimp,它也足以提供的设计是来自于使用weights=选项的权重。

calc.relimp cannot handle data with missing values directly. It applies complete-case analysis,  i.e. drops all units with any missing values by default. While this can be appropriate, if there are only few  missing values, data with more severe missingness issues need special treatment. Package relaimpo  offers the function mianalyze.relimp that handles multiply-imputed datasets (that can be created  by several other R-packages). Currently, possibilities in this function are limited due to the fact that  it uses complex survey designs and bootstrapping which do not (yet) go together well with factors, interactions  and calculated quantities in formulae.
calc.relimp不能处理带有缺失值的直接的数据。它适用于完成情况的分析,即下降到任何遗漏值默认情况下,所有单位。虽然这可能是适当的,如果只有少数的缺失值,数据更严重的missingness问题需要特殊治疗。套件relaimpo提供的功能mianalyze.relimp会处理乘法估算的数据集(可以创建其他几个R-包)。目前,在这个函数中的可能性是有限的,由于事实上,它使用复杂的调查设计和自举不(还)走在一起的因素,相互作用和计算公式中的数量。


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

<table summary="R valueblock"> <tr valign="top"><td>var.y </td> <td> the variance of the response</td></tr> <tr valign="top"><td>R2 </td> <td> the coefficient of determination, R^2</td></tr> <tr valign="top"><td>R2.decomp </td> <td> the part of the coefficient of determination that is decomposed among the  variables under investigation </td></tr> <tr valign="top"><td>lmg </td> <td> vector of relative contributions obtained from the lmg method, if lmg has been requested in type</td></tr> <tr valign="top"><td>lmg.diff </td> <td> vector of pairwise differences between relative contributions obtained from the lmg method,  if lmg has been requested in type and diff=TRUE</td></tr> <tr valign="top"><td>lmg.rank </td> <td> rank of the regressors relative contributions obtained from the lmg method,  if lmg has been requested in type and rank=TRUE</td></tr> <tr valign="top"><td>metric, metric.diff, metric.rank </td> <td> analogous to lmg for other metrics</td></tr> <tr valign="top"><td>ave.coeffs</td> <td> average coefficients for variables not not requested by always only  for models of different sizes;
<table summary="R valueblock"> <tr valign="top"> <TD> var.y </ TD> <TD>响应的方差</ TD> </ TR> <TR VALIGN =“顶“<TD> R2  </ TD> <TD>的决定系数,R^2</ TD> </ TR> <tr valign="top"> <TD><X > </ TD> <TD>正在调查中变量之间的决定系数分解的部分</ TD> </ TR> <tr valign="top"> <TD>R2.decomp </ TD> <TD>矢量lmg 方法获得的相对贡献,lmg如果已被要求在lmg</ TD> </ TR> <tr valign="top"> <TD> type </ TD> <TD>矢量lmg.diff 方法获得的相对贡献两两之间的差异,如果lmg已要求在lmg和type </ TD> </ TR> <tr valign="top"> <TD> diff=TRUE </ TD> <TD>排名的回归量的相对贡献获得lmg.rank 方法,如果lmg已要求lmg和type </ TD> </ TR> <tr valign="top"> <TD> rank=TRUE</ TD> < TD>类似于metric, metric.diff, metric.rank 其他指标</ TD> </ TR> <tr valign="top"> <TD>lmg </ TD> <TD>平均系数的变量不要求总是只大小不同的模型;

note that coefficients refer to modeling residuals after adjusting out variables  listed in always (both from response and other explanatory variables)</td></tr> <tr valign="top"><td>namen</td> <td> names of variables, starting with response</td></tr> <tr valign="top"><td>type</td> <td> character vector of metrics available</td></tr> <tr valign="top"><td>rela</td> <td> Have metrics been normalized to sum 100% ?</td></tr> <tr valign="top"><td>always</td> <td> column numbers of variables always in the model;  in case of factors, the column numbers given here are not identical to those in  the call to calc.relimp, but refer to the columns of the model matrix</td></tr> <tr valign="top"><td>alwaysnam</td> <td> names of variables always in the model</td></tr> <tr valign="top"><td>call</td> <td> contains the call that generated the object</td></tr> </table>
请注意,系数调整后的变量总是(无论是从反应和其他解释变量)</ TD> </ TR> <tr valign="top"> <TD>namen</ TD参考模型的残差> <TD>的变量名,开始响应</ TD> </ TR> <tr valign="top"> <TD>type </ TD> <TD>字符向量的指标</ TD > </ TR> <tr valign="top"> <TD> rela</ TD> <TD>的指标被标准化,合计100%</ TD> </ TR> <TR VALIGN =“顶“<TD> always </ TD> <TD>列号的变量总是在模型中因素的情况下,这里给出的列号是不相同的,在调用calc.relimp ,而是指对模型的列矩阵</ TD> </ TR> <tr valign="top"> <TD>alwaysnam </ TD> <TD>的变量名总是在模型中< / TD> </ TR> <tr valign="top"> <TD>call </ TD> <TD>包含调用生成的对象</ TD> </ TR> </ TABLE>


警告----------Warning ----------

lmg and pmvd are computer-intensive. Although they are calculated based on the  covariance matrix, which saves substantial computing time in comparison to carrying out actual regressions,  these methods still take quite long for problems with many regressors.
lmg和pmvd是计算密集型的。虽然他们计算协方差矩阵,从而节省了大量的计算时间进行实际的回归相比,这些方法仍然需要相当长的问题,许多回归系数。

relaimpo is a package for univariate linear models.  Using relaimpo on objects that inherit from class lm but are not univariate linear model objects  may produce nonsensical results without warning. Objects of class mlm or glm with link functions other than identity  or family other than gaussian lead to an error message.
relaimpo是一个单变量线性模型的包。使用relaimpo,继承自类lm的,但不是没有警告的情况下,单变量线性模型对象可能会产生荒谬的结果的对象。类的对象mlm或glm链接功能以外的其他身份或家庭以外的高斯导致的错误消息。


注意----------Note----------

There are two versions of this package. The version on CRAN is globally licensed under GPL version 2 (or later).  There is an extended version with the interesting additional metric pmvd that is licensed according to GPL version 2 under the geographical restriction "outside of the US" because of potential issues with US patent 6,640,204.  This version can be obtained from Ulrike Groempings website (cf. references section).
这个包有两个版本。 CRAN上的版本全球许可在GPL版本2(或更高版本)。有一个有趣的附加度量pmvd会根据GPL版本2许可下的地域限制“在美国以外的”,因为潜在的问题与美国专利6640204的扩展版本。这个版本可以从的乌尔里克·Groempings网站(参见参考资料一节)。


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


Ulrike Groemping, BHT Berlin



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

Chevan, A. and Sutherland, M. (1991) Hierarchical Partitioning. The American Statistician 45, 90&ndash;96.
Darlington, R.B. (1968) Multiple regression in psychological research and practice. Psychological Bulletin 69, 161&ndash;182.
Feldman, B. (2005) Relative Importance and Value. Manuscript (Version 1.1, March 19 2005), downloadable at http://www.prismanalytics.com/docs/RelativeImportance050319.pdf
Genizi, A. (1993) Decomposition of R2 in multiple regression with correlated regressors. Statistica Sinica 3, 407&ndash;420.  Downloadable at http://www3.stat.sinica.edu.tw/statistica/password.asp?vol=3&num=2&art=10
Groemping, U. (2006) Relative Importance for Linear Regression in R: The Package relaimpo  Journal of Statistical Software 17, Issue 1.  Downloadable at http://www.jstatsoft.org/v17/i01
Lindeman, R.H., Merenda, P.F. and Gold, R.Z. (1980) Introduction to Bivariate and Multivariate Analysis, Glenview IL: Scott, Foresman.
Zuber, V. and Strimmer, K. (2010) Variable importance and model selection by decorrelation. Preprint, downloadable at http://www.uni-leipzig.de/strimmer/lab/publications/preprints/carscore2010.pdf
Go to http://prof.beuth-hochschule.de/groemping/relaimpo/ for further information and references.

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

relaimpo, booteval.relimp, mianalyze.relimp,
relaimpo,booteval.relimp,mianalyze.relimp,


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


#####################################################################[################################################## ##################]
### Example: relative importance of various socioeconomic indicators [##示例:各种社会经济指标的相对重要性。]
###          for Fertility in Switzerland[##在瑞士土壤肥力]
### Fertility is first column of data set swiss[##生育是第一列的数据集瑞士]
#####################################################################[################################################## ##################]
data(swiss)
    calc.relimp(swiss,
       type = c("lmg", "last", "first", "betasq", "pratt", "genizi", "car") )
    # calculation of all available relative importance metrics [所有可用的相对重要性指标的计算]
        # non-US version offers the additional metric "pmvd", [非美国版本提供了额外的的度量“pmvd”]
        # i.e. call would be [即通话将]
        # calc.relimp(cov(swiss), [calc.relimp(COV(瑞士),]
        # type = c("lmg", "pmvd", "last", "first", "betasq, "pratt"), [= C(“LMG”中,“pmvd”,“最后的”,“第一”,“betasq,”普惠“),]
        # rela = TRUE )[关系= TRUE)]
    ## same analysis with formula or lm method and a few modified options[#同样的分析公式或LM的方法和一些修改过的选项]
    crf <- calc.relimp(Fertility~Agriculture+Examination+Education+Catholic+Infant.Mortality,swiss,
        subset = Catholic>40,
        type = c("lmg", "last", "first", "betasq", "pratt"), rela = TRUE )
    crf
    linmod <- lm(Fertility~Agriculture+Examination+Education+Catholic+Infant.Mortality,swiss)
    crlm <- calc.relimp(linmod,
        type = c("lmg", "last", "first", "betasq", "pratt", "genizi", "car"), rela = TRUE )
    plot(crlm)
    # bar plot of the relative importance metrics[条形图的相对重要性指标]

    #of statistical interest in this context: correlation matrix[统计在这方面的兴趣:相关矩阵]
       cor(swiss)

    #demonstration of conditioning on one regressor using always[示范的空调总是使用一个回归量]
    calc.relimp(swiss,
       type = c("lmg", "last", "first", "betasq", "pratt"), rela = FALSE,
       always = "Education" )

    # using calc.relimp with grouping of two regressors[使用calc.relimp两个回归系数分组]
    # and weights (not reasonable here, purely for demo purposes)[重量(不合理的,纯粹是为了演示目的)]
    calc.relimp(swiss,
       type = c("lmg", "last", "first"), rela = FALSE,
       groups = c("Education","Examination"), weights = abs(-23:23) )

    # using calc.relimp with grouping of two regressors[使用calc.relimp两个回归系数分组]
    # and a design object (not reasonable here, purely for demo purposes)[设计对象(而不是合理的,纯粹是为了演示目的)]
    des <- svydesign(~1, data=swiss, weights=~abs(-23:23))
    calc.relimp(swiss,
       type = c("lmg", "last", "first"), rela = FALSE,
       groups = c("Education","Examination"), groupnames ="EduExam", design = des)

    # calc.relimp with factors (betasq and pratt not possible)[calc.relimp因素(betasq和普惠不可能)]
      # (calc.relimp would not be necessary here, [(calc.relimp就没有必要在这里,]
      # because the experiment is balanced)[因为实验是要平衡)。]
    calc.relimp(1/time~poison+treat,data=poisons, rela = FALSE,
         type = c("lmg", "last", "first"))
    # including also the interaction (lmg possible only)[还包括的相互作用(LMG可能只)]
    calc.relimp(1/time~poison*treat,data=poisons, rela = FALSE)

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-23 19:38 , Processed in 0.035049 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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