Function(rms)
Function()所属R语言包:rms
Compose an S Function to Compute X beta from a Fit
从飞度,撰写的S函数计算X测试版
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Function is a class of functions for creating other S functions. Function.rms is the method for creating S functions to compute X beta, based on a model fitted with rms in effect. Like latex.rms, Function.rms simplifies restricted cubic spline functions and factors out terms in second-order interactions. Function.rms will not work for models that have third-order interactions involving restricted cubic splines. Function.cph is a particular method for handling fits from cph, for which an intercept (the negative of the centering constant) is added to the model. sascode is a function that takes an S function such as one created by Function and does most of the editing to turn the function definition into a fragment of SAS code for computing X beta from the fitted model, along with assignment statements that initialize predictors to reference values. perlcode similarly creates Perl code to evaluate a fitted regression model.
Function是一类函数用于创建其他S系列功能。 Function.rms的方法创建S函数来计算X测试版,一个模型的基础上配备rms的影响。 latex.rms,Function.rms简化了三次样条函数和因素限制了二阶相互作用。 Function.rms不会工作模式,有限制三次样条函数的三阶交互。 Function.cph是适合从cph,其中的截距(负的定心常数)被添加到模型中一个特定的方法,用于处理。 sascode是一个函数,它接受一个S的功能,如创建的Function的编辑把函数的定义SAS代码片段的拟合模型计算x测试,以及用赋值语句初始化的预测参考值。 perlcode同样,Perl代码评估拟合回归模型。
用法----------Usage----------
## S3 method for class 'rms'
Function(object, intercept=NULL,
digits=max(8, .Options$digits), ...)
## S3 method for class 'cph'
Function(object, intercept=-object$center, ...)
# Use result as fun(predictor1=value1, predictor2=value2, \dots)
sascode(object, file='', append=FALSE)
perlcode(object)
参数----------Arguments----------
参数:object
a fit created with rms in effect
一个合适的创建rms的影响
参数:intercept
an intercept value to use (not allowed to be specified to Function.cph). The intercept is usually retrieved from the regression coefficients automatically.
截距的值使用(不允许指定Function.cph)。截距通常是从回归系数自动检索。
参数:digits
number of significant digits to use for coefficients and knot locations
一些重要的数字系数和结位置
参数:file
name of a file in which to write the SAS code. Default is to write to standard output.
名的文件,在其中写的SAS代码。默认是输出到标准输出。
参数:append
set to TRUE to have sascode append code to an existing file named file.
设置为TRUEsascode代码附加到现有文件名为file。
参数:...
arguments to pass to Function.rms from Function.cph
参数传递给Function.rmsFunction.cph
值----------Value----------
Function returns an S-Plus function that can be invoked in any usual context. The function has one argument per predictor variable, and the default values of the predictors are set to adjust-to values (see datadist). Multiple predicted X beta values may be calculated by specifying vectors as arguments to the created function. All non-scalar argument values must have the same length. perlcode returns a character string with embedded newline characters.
Function返回一个S-Plus功能,可以在任何通常情况下调用。每个预测变量的函数有一个参数被设置为默认值的预测adjust-to值(见datadist)。多预测,通过指定所创建的函数的参数向量X beta值可以计算。所有非标量参数值必须具有相同的长度。 perlcode返回一个字符串,嵌入的换行符。
(作者)----------Author(s)----------
Frank Harrell, Jeremy Stephens, and Thomas Dupont<br>
Department of Biostatistics<br>
Vanderbilt University<br>
f.harrell@vanderbilt.edu
参见----------See Also----------
latex.rms, transcan, predict.rms, rms, rms.trans
latex.rms,transcan,predict.rms,rms,rms.trans
实例----------Examples----------
set.seed(1331)
x1 <- exp(rnorm(100))
x2 <- factor(sample(c('a','b'),100,rep=TRUE))
dd <- datadist(x1, x2)
options(datadist='dd')
y <- log(x1)^2+log(x1)*(x2=='b')+rnorm(100)/4
f <- ols(y ~ pol(log(x1),2)*x2)
f$coef
g <- Function(f, digits=5)
g
sascode(g)
cat(perlcode(g), '\n')
g()
g(x1=c(2,3), x2='b') #could omit x2 since b is default category[,可以省略X2因为b是默认类别]
predict(f, expand.grid(x1=c(2,3),x2='b'))
g8 <- Function(f) # default is 8 sig. digits[默认值是8信号。数字]
g8(x1=c(2,3), x2='b')
options(datadist=NULL)
## Not run: [#不运行:]
# Make self-contained functions for computing survival probabilities[自足的生存概率计算功能]
# using a log-normal regression[使用一个log正常回归]
f <- psm(Surv(d.time, death) ~ rcs(age,4)*sex, dist='gaussian')
g <- Function(f)
surv <- Survival(f)
# Compute 2 and 5-year survival estimates for 50 year old male[计算2年和5年生存率估计为50岁的男性]
surv(c(2,5), g(age=50, sex='male'))
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|