rmsMisc(rms)
rmsMisc()所属R语言包:rms
Miscellaneous Design Attributes and Utility Functions
其他设计属性和实用的功能
译者:生物统计家园网 机器人LoveR
描述----------Description----------
These functions are used internally to anova.rms, fastbw, etc., to retrieve various attributes of a design. These functions allow some fitting functions not in the rms series (e.g,, lm, glm) to be used with rms.Design, fastbw, and similar functions.
使用这些函数内部anova.rms,fastbw等,检索各种属性的设计。这些功能允许在rms系列(例如,一些拟合函数,lm,glm)被用于rms.Design,fastbw,和类似的功能。
For vcov, there are these functions: vcov.default, vcov.lm, vcov.glm. The oos.loglik function for each type of model implemented computes the -2 log likelihood for out-of-sample data (i.e., data not necessarily used to fit the model) evaluated at the parameter estimates from a model fit. Vectors for the model's linear predictors and response variable must be given. oos.loglik is used primarily by bootcov.
对于vcov,有以下功能:vcov.default,vcov.lm,vcov.glm。 oos.loglik功能,实现每种类型的模型计算评价参数的样本数据(即数据不一定会被使用,以适应模型)-2对数似然估计,从模型的拟合。模型的线性预测和响应变量的向量必须提供。 oos.loglik主要是由bootcov。
The Getlim function retrieves distribution summaries from the fit or from a datadist object. It handles getting summaries from both sources to fill in characteristics for variables that were not defined during the model fit. Getlimi returns the summary for an individual model variable.
Getlim函数检索分配摘要从适合或从datadist对象的。它处理从两个来源得到的摘要填写没有定义的变量在模型拟合的特征。 Getlimi返回一个单独的模型变量的摘要。
The related.predictors function returns a list containing variable numbers that are directly or indirectly related to each predictor. The interactions.containing function returns indexes of interaction effects containing a given predictor. The param.order function returns a vector of logical indicators for whether parameters are associated with certain types of effects (nonlinear, interaction, nonlinear interaction). combineRelatedPredictors creates of list of inter-connected main effects and interations for use with predictrms with type='ccterms' (useful for gIndex).
related.predictors函数返回一个列表,其中包含可变数量有直接或间接关系到每一个预测。 interactions.containing函数返回的互动效应,包含一个给定的预测指标。 param.order函数返回一个向量,逻辑指标参数是否与某些类型的影响(非线性,交互性,非线性相互作用)。 combineRelatedPredictors创建列表,用于相互关联的主要影响及相互作用predictrmstype='ccterms'(gIndex)。
The Penalty.matrix function builds a default penalty matrix for non-intercept term(s) for use in penalized maximum likelihood estimation. The Penalty.setup function takes a constant or list describing penalty factors for each type of term in the model and generates the proper vector of penalty multipliers for the current model.
Penalty.matrix函数建立非惩罚最大似然估计的截距项(s)为违约金矩阵。 Penalty.setup函数需要一个恒定的或惩罚因子模型中的每种类型的术语描述的列表,并产生适当的电流模型的矢量的惩罚乘法器。
logLik.rms returns the maximized log likelihood for the model, whereas AIC.rms returns the AIC. The latter function has an optional argument for computing AIC on a "chi-square" scale (model likelihood ratio chi-square minus twice the regression degrees of freedom. logLik.ols handles the case for ols, just by invoking logLik.lm in the stats package.
logLik.rms返回最大化对数似然的模型,而AIC.rms返回AIC。后者的功能有一个可选参数的计算AIC在“卡方”的规模(模型似然比卡方减去两倍的回归自由度。logLik.ols处理的情况下为ols,只是通过调用logLik.lm stats包。
nobs.rms returns the number of observations used in the fit.
nobs.rms返回适合的观测。
The lrtest function does likelihood ratio tests for two nested models, from fits that have stats components with "Model L.R." values. For models such as psm, survreg, ols, lm which have scale parameters, it is assumed that scale parameter for the smaller model is fixed at the estimate from the larger model (see the example).
lrtest函数似然比检验两个嵌套模型,有成分stats值的"Model L.R."的适合。如psm, survreg, ols, lm有规模的参数的模型中,假设在较大的模型估计,规模较小的模型的参数是固定的(参见示例)。
univarLR takes a multivariable model fit object from rms and re-fits a sequence of models containing one predictor at a time. It prints a table of likelihood ratio chi^2 statistics from these fits.
univarLR一个多变量模型的拟合对象rms和重新适应一个预测模型在时间序列。它打印出的似然比chi^2从这些千篇一律的统计数据表。
The Newlabels function is used to override the variable labels in a fit object. Likewise, Newlevels can be used to create a new fit object with levels of categorical predictors changed. These two functions are especially useful when constructing nomograms.
Newlabels功能是用来覆盖在一个合适的对象变量标签。同样,Newlevels可以使用,与分类预测变化的水平,以创建一个新的合适的对象。这两个函数是构建诺模图时特别有用。
rmsFit is used to convert a fit from non-rms functions (e.g., glm) that were invoked with rms in effect to rms functions so that anova.rms will be called by anova(), etc. So that the original fit's residuals and print methods, if they exist, will be called, there are functions print.rms and residuals.rms to dispatch them.
rmsFit是用来转换一个合适的非RMS功能(例如,glm)调用与有效值RMS功能生效anova.rms将被称为anova() 等,使原来适合的residuals和print方法,如果存在的话,会被调用,有功能print.rms和residuals.rms派遣他们。
rmsArgs handles ... arguments to functions such as Predict, summary.rms, nomogram so that variables to vary may be specified without values (after an equals sign).
rmsArgs处理...如Predict,summary.rms,nomogram改变的变量值(等号后)没有指定给函数的参数。
prModFit is the workhorse for the print methods for highest-level rms model fitting functions, handling both regular and LaTeX printing, the latter resulting in LaTeX code written to the terminal, automatically ready for Sweave. The work of printing summary statistics is done by prStats, which uses the Hmisc print.char.matrix function to print overall model statistics if latex=FALSE, otherwise it generates customized LaTeX code. The LaTeX longtable package must be in effect to use these LaTeX functions.
prModFit是print最高级别的rms模型拟合函数的方法,处理的定期和LaTeX印刷,后者在LaTeX代码写入到终端,自动准备好主力Sweave。如果prStats,否则它会产生定制的LaTeX代码是通过print.char.matrix,使用Hmisc latex=FALSE打印功能,整体模型的统计汇总统计数据印刷的工作。的乳胶longtable包必须在使用这些胶乳的功能。
reVector allows one to rename a subset of a named vector, ignoring the previous names and not concatenating them as R does. It also removes (by default) elements that are NA, as when an optional named element is fetched that doesn't exist.
reVector允许一个重命名一个名为向量的一个子集,忽略了以前的名称,而不是串联为R。它也消除了(默认情况下)是NA的元素,一个可选的命名元素中取出时,不存在。
formatNP is a function to format a vector of numerics. If digits is specified, formatNP will make sure that the formatted representation has digits positions to the right of the decimal place. If latex=TRUE it will translate any scientific notation to LaTeX math form. If pvalue=TRUE, it will replace formatted values with "< 0.0001" (if digits=4).
formatNP是一个函数格式化一个向量的数值计算。如果digits指定,formatNP将确保的格式化表示digits到正确的小数位的位置。如果latex=TRUE将翻译任何科学记数法LaTeX的数学形式。如果pvalue=TRUE,它会替换格式的值“0.0001”(如果digits=4“)。
用法----------Usage----------
## S3 method for class 'cph'
vcov(object, regcoef.only=TRUE, ...)
## S3 method for class 'Glm'
vcov(object, ...)
## S3 method for class 'Gls'
vcov(object, ...)
## S3 method for class 'lrm'
vcov(object, regcoef.only=TRUE, ...)
## S3 method for class 'ols'
vcov(object, regcoef.only=TRUE, ...)
## S3 method for class 'psm'
vcov(object, regcoef.only=TRUE, ...)
oos.loglik(fit, ...)
## S3 method for class 'ols'
oos.loglik(fit, lp, y, ...)
## S3 method for class 'lrm'
oos.loglik(fit, lp, y, ...)
## S3 method for class 'cph'
oos.loglik(fit, lp, y, ...)
## S3 method for class 'psm'
oos.loglik(fit, lp, y, ...)
## S3 method for class 'Glm'
oos.loglik(fit, lp, y, ...)
num.intercepts(fit)
Getlim(at, allow.null=FALSE, need.all=TRUE)
Getlimi(name, Limval, need.all=TRUE)
related.predictors(at, type=c("all","direct"))
interactions.containing(at, pred)
combineRelatedPredictors(at)
param.order(at, term.order)
Penalty.matrix(at, X)
Penalty.setup(at, penalty)
## S3 method for class 'ols'
logLik(object, ...)
## S3 method for class 'rms'
logLik(object, ...)
## S3 method for class 'rms'
AIC(object, ..., k=2, type=c('loglik', 'chisq'))
## S3 method for class 'rms'
nobs(object, ...)
lrtest(fit1, fit2)
## S3 method for class 'lrtest'
print(x, ...)
univarLR(fit)
Newlabels(fit, ...)
Newlevels(fit, ...)
## S3 method for class 'rms'
Newlabels(fit, labels, ...)
## S3 method for class 'rms'
Newlevels(fit, levels, ...)
rmsFit(fit) # fit from glm, lm, etc.,then use anova etc. on result
prModFit(x, title, w, digits=4, coefs=TRUE, latex=FALSE, lines.page=40,
long=TRUE, needspace, ...)
prStats(labels, w, latex=FALSE)
reVector(..., na.rm=TRUE)
formatNP(x, digits=NULL, pvalue=FALSE, latex=FALSE)
参数----------Arguments----------
参数:fit
result of a fitting function
结果的拟合函数
参数:object
result of a fitting function
结果的拟合函数
参数:regcoef.only
For fits such as parametric survival models which have a final row and column of the covariance matrix for a non-regression parameter such as a log(scale) parameter, setting regcoef.only=TRUE causes only the first p rows and columns of the covariance matrix to be returned, where p is the length of object$coef.
对于适合如参数生存模型有一个最终的协方差矩阵的行和列的一个非回归如log(尺度)参数的参数,设置regcoef.only=TRUE仅使第一p行和要返回的协方差矩阵的列,,其中p的长度object$coef。
参数:at
Design element of a fit
Design元素的一个合适的
参数:pred
index of a predictor variable (main effect)
指数的预测变量(主要作用)
参数:fit1
参数:fit2
fit objects from lrm,ols,psm,cph etc. It doesn't matter which fit object is the sub-model.
适合对象从lrm,ols,psm,cph等,这并不重要,合适的对象是子模型。
参数:lp
linear predictor vector for oos.loglik. For proportional odds ordinal logistic models, this should have used the first intercept only. If lp and y are omitted, the -2 log likelihood for the original fit are returned.
线性预测向量oos.loglik。的比例优势的有序模型,这应该只在第一次拦截。如果lp和y省略,原合适的-2对数似然返回。
参数:y
values of a new vector of responses passed to oos.loglik.
一个新的响应向量的值传递给oos.loglik。
参数:name
the name of a variable in the model
在模型中的变量的名称
参数:Limval
an object returned by Getlim
返回的对象的Getlim
参数:allow.null
prevents Getlim from issuing an error message if no limits are found in the fit or in the object pointed to by options(datadist=)
防止Getlim发出错误讯息,如果没有任何限制中找到适合的对象所指向的options(datadist=)
参数:need.all
set to FALSE to prevent Getlim or Getlimi from issuing an error message if data for a variable are not found
设置FALSE防止Getlim或Getlimi发出错误讯息,如果一个变量的数据未找到
参数:type
For related.predictors, set to "direct" to return lists of indexes of directly related factors only (those in interactions with the predictor). For AIC.rms, type specifies the basis on which to return AIC. The default is minus twice the maximized log likelihood plus k times the degrees of freedom counting intercept(s). Specify type='chisq' to get a penalized model likelihood ratio chi-square instead.
对于related.predictors设置为"direct"返回列表直接相关的因素相互作用的预测指标。对于AIC.rms,type指定的基础上,返回AIC。缺省值是减去两倍的最大对数似然加k倍程度的自由计数截距()。指定type='chisq',而不是一个惩罚模型似然比卡方。
参数:term.order
1 for all parameters, 2 for all parameters associated with either nonlinear or interaction effects, 3 for nonlinear effects (main or interaction), 4 for interaction effects, 5 for nonlinear interaction effects.
1,所有的参数,所有相关的参数是非线性相互作用的效应,非线性效应(主要或交互),4,互作效应,非线性相互作用影响。
参数:X
a design matrix, not including columns for intercepts
一个设计矩阵,不包括列拦截
参数:penalty
a vector or list specifying penalty multipliers for types of model terms
一个向量或列表,指定刑罚的乘数模型项的类型
参数:k
the multiplier of the degrees of freedom to be used in computing AIC. The default is 2.
乘法器中要使用的计算的AIC的自由度。默认值是2。
参数:x
a result of lrtest, or the result of a high-level model fitting function (for prModFit
因lrtest,或一个高层次的模型拟合函数的结果(prModFit
参数:labels
a character vector specifying new labels for variables in a fit. To give new labels for all variables, you can specify labels of the form labels=c("Age in Years","Cholesterol"), where the list of new labels is assumed to be the length of all main effect-type variables in the fit and in their original order in the model formula. You may specify a named vector to give new labels in random order or for a subset of the variables, e.g., labels=c(age="Age in Years",chol="Cholesterol"). For prStats, is a list with major column headings, which can themselves be vectors that are then stacked vertically.
字符向量指定的变量在一个合适的新标签。为了让所有变量的新标签,你可以指定labels的形式labels=c("Age in Years","Cholesterol"),新的标签列表中被认为是所有主要的效果类型的变量在合适的长度,在他们的模型公式中的原始顺序。你可以指定一个命名的向量,新的标签以随机顺序或变量的一个子集,例如,labels=c(age="Age in Years",chol="Cholesterol")。对于prStats,是一个主要的列标题,也可以是向量,然后垂直堆叠。
参数:levels
a list of named vectors specifying new level labels for categorical predictors. This will override parms as well as datadist information (if available) that were stored with the fit.
列表中指定新的标签分类预测命名的向量。这将覆盖parms和datadist信息(如果有的话),存储与契合。
参数:title
a single character string used to specify an overall title for the regression fit, which is printed first by prModFit. Set to "" to suppress the title
一个字符串,用于指定一个总冠军的回归拟合,这是印第一个由prModFit。设置为""抑制标题
参数:w
For prModFit, a special list of lists, which each list element specifying information about a block of information to include in the print. output for a fit. For prStats, w is a list of statistics to print, elements of which can be vectors that are stacked vertically. Unnamed elements specify number of digits to the right of the decimal place to which to round (NA means use format without rounding, as with integers and floating point values). Negative values of digits indicate that the value is a P-value to be formatted with formatNP. Digits are recycled as needed.
对于prModFit,一个特殊的列表的列表,每个列表元素指定的信息块的信息,包括在print.输出一个合适的。对于prStats,w是打印统计数据的列表,其中的要点可以垂直叠放的向量。未命名的元素指定的位数,小数位四舍五入(NA是指使用format不四舍五入,整数和浮点值)的权利。 digits负值表明,该值是一个被格式化为formatNPP-值。位数根据需要再循环。
参数:digits
number of digits to the right of the decimal point, for formatting numeric values in printed output
小数点右侧的数字的数目,打印输出中的数值的格式
参数:coefs
specify coefs=FALSE to suppress printing the table of model coefficients, standard errors, etc. Specify coefs=n to print only the first n regression coefficients in the model.
指定coefs=FALSE抑制打印表格模型系数,标准误差等指定coefs=n要打印只有第一个n回归系数的模型。
参数:latex
a logical value indicating whether information should be formatted as plain text or as LaTeX markup
一逻辑值,表示信息是否应该被格式化为纯文本或乳胶标记
参数:lines.page
see latex
看到latex
参数:long
set to FALSE to suppress printing of formula and certain other model output
设置为FALSE抑制印刷式及若干其他模型输出
参数:needspace
optional character string to insert inside a LaTeX needspace macro call before the statistics table and before the coefficient matrix, to avoid bad page splits. This assumes the LaTeX needspace style is available. Example: needspace='6\baselineskip' or needspace='1.5in'.
可选的字符串内插入一个LaTeX needspace之前的统计信息表和宏调用前的系数矩阵,避免坏的页面分割。这是假设LaTeX的needspace风格是可用的。例如:needspace='6\baselineskip'或needspace='1.5in'。
参数:na.rm
set to FALSE to keep NAs in the vector created by reVector
设置为FALSENA的矢量创建的reVector
参数:pvalue
set to TRUE if you want values below 10 to the minus digits to be formatted to be less than that value
设置为TRUE,“如果你想值低于10负digits被格式化为小于该值
参数:...
other arguments. For reVector this contains the elements being extracted. For prModFit this information is passed to the Hmisc latexTabular function when a block of output is a vector to be formatted in LaTeX.
其他参数。对于reVector包含的元素被提取。对于prModFit这个信息传递给Hmisc latexTabular功能块的输出是一个向量,在LaTeX格式。
值----------Value----------
vcov returns a variance-covariance matrix, and num.intercepts returns an integer with the number of intercepts in the model. oos.loglik returns a scalar -2 log likelihood value. Getlim returns a list with components limits and values, either stored in fit or retrieved from the object created by datadist and pointed to in options(datadist=). related.predictors and combineRelatedPredictors return a list of vectors, and interactions.containing returns a vector. param.order returns a logical vector corresponding to non-strata terms in the model. Penalty.matrix returns a symmetric matrix with dimension equal to the number of slopes in the model. For all but categorical predictor main effect elements, the matrix is diagonal with values equal to the variances of the columns of X. For segments corresponding to c-1 dummy variables for c-category predictors, puts a c-1 x c-1 sub-matrix in Penalty.matrix that is constructed so that a quadratic form with Penalty.matrix in the middle computes the sum of squared differences in parameter values about the mean, including a portion for the reference cell in which the parameter is by definition zero. Newlabels returns a new fit object with the labels adjusted. rmsFit returns the original object but with oldClass of "rms" and with a new attribute "fitFunction" containing the original vector of classes.
vcov返回的方差 - 协方差矩阵,并num.intercepts返回一个整型数截距模型中的。 oos.loglik返回一个标-2对数似然值。 Getlim返回一个列表的组件limits和values,无论是存储在fit或检索的datadist创建的对象,并指出,在options(datadist=) 。 related.predictors和combineRelatedPredictors返回一个列表的向量,和interactions.containing返回一个向量。 param.order返回一个逻辑向量对应的非地层模型中的。 Penalty.matrix返回的数量模型中的斜坡尺寸等于一个对称矩阵。但对于所有的分类预测的主要影响要素,矩阵是对角的X列的方差等于的值。段对应c-1虚拟变量c类的预测,提出一个c-1Xc-1子矩阵Penalty.matrix构造,二次形式与Penalty.matrix在中间计算的总和的平方差有关的平均参数值中的,包括一个参考单元的部分,用于在该参数被定义为零。 Newlabels返回一个新的标签调整合适的对象。 rmsFit返回原来的对象,但oldClass"rms"和一个新的属性"fitFunction"包含原始向量的类。
reVector returns a vector of named (by its arguments) elements. formatNP returns a character vector.
reVector返回一个向量的命名元素(参数)。 formatNP返回一个字符向量。
参见----------See Also----------
rms, fastbw, anova.rms, summary.lm, summary.glm, datadist, vif, bootcov, latex, latexTabular, latexSN, print.char.matrix
rms,fastbw,anova.rms,summary.lm,summary.glm,datadist,vif,bootcov,latex,latexTabular,latexSN,print.char.matrix
实例----------Examples----------
## Not run: [#不运行:]
f <- psm(S ~ x1 + x2 + sex + race, dist='gau')
g <- psm(S ~ x1 + sex + race, dist='gau',
fixed=list(scale=exp(f$parms)))
lrtest(f, g)
g <- Newlabels(f, c(x2='Label for x2'))
g <- Newlevels(g, list(sex=c('Male','Female'),race=c('B','W')))
nomogram(g)
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|