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

R语言 rms包 survplot()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-27 19:16:56 | 显示全部楼层 |阅读模式
survplot(rms)
survplot()所属R语言包:rms

                                         Plot Survival Curves and Hazard Functions
                                         绘制生存曲线和危险的功能

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

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

Plot estimated survival curves, and for parametric survival models, plot hazard functions.  There is an option to print the number of subjects at risk at the start of each time interval.  Curves are automatically labeled at the points of maximum separation (using the labcurve function), and there are many other options for labeling that can be specified with the label.curves parameter.  For example, different plotting symbols can be placed at constant x-increments and a legend linking the symbols with category labels can automatically positioned on the most empty portion of the plot.
图估计生存曲线,参数生存模型,图危害的功能。有一个选项,打印的受试者的风险在每个时间间隔的开始。曲线自动标记的在最大分离(使用labcurve函数)的点,还有许多其他的选项标签中可以指定与label.curves参数。例如,不同的绘图符号可以被放置在x为常数递增,并可以自动定位在最空的部分图与类别标签,一个传奇的符号链接。

For the case of a two stratum analysis by survfit, survdiffplot plots the difference in two Kaplan-Meier estimates along with approximate confidence bands for the differences, with a reference line at zero.  The number of subjects at risk is optionally plotted.  This number is taken as the minimum of the number of subjects at risk over the two strata.
有关的情况下的两个阶层分析survfit,survdiffplot图的Kaplan-Meier估计以及具有近似置信带的差异,与参考线在零的两个差异。在风险科目任选绘制。此号码被视为处于危险的受试者的两个阶层的数量最小。


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


survplot(fit, ...)
## S3 method for class 'rms'
survplot(fit, ..., xlim,
         ylim=if(loglog) c(-5, 1.5) else if
                 (what == "survival" & missing(fun)) c(0, 1),
         xlab, ylab, time.inc,
         what=c("survival","hazard"),
         type=c("tsiatis","kaplan-meier"),
         conf.type=c("log","log-log","plain","none"),
         conf.int=FALSE, conf=c("bands","bars"),
         add=FALSE, label.curves=TRUE,
         abbrev.label=FALSE, levels.only=FALSE,
         lty, lwd=par("lwd"),
         col=1, col.fill=gray(seq(.95, .75, length=5)),
         adj.subtitle=TRUE, loglog=FALSE, fun,
         n.risk=FALSE, logt=FALSE, dots=FALSE, dotsize=.003,
         grid=FALSE, srt.n.risk=0, sep.n.risk=0.056, adj.n.risk=1,
         y.n.risk, cex.n.risk=.6, pr=FALSE)
## S3 method for class 'survfit'
survplot(fit, xlim,
         ylim, xlab, ylab, time.inc,
         conf=c("bands","bars","none"), add=FALSE,
         label.curves=TRUE, abbrev.label=FALSE,
         levels.only=FALSE, lty,lwd=par('lwd'),
         col=1, col.fill=gray(seq(.95, .75, length=5)),
         loglog=FALSE,fun,n.risk=FALSE,logt=FALSE,
         dots=FALSE,dotsize=.003,
         grid=FALSE,
         srt.n.risk=0,sep.n.risk=.056,adj.n.risk=1,
         y.n.risk,cex.n.risk=.6, pr=FALSE, ...)
survdiffplot(fit, order=1:2,
           xlim, ylim, xlab, ylab="Difference in Survival Probability",
           time.inc, conf.int=.95,
           conf=c("shaded", "bands","none"),
           add=FALSE, lty=1, lwd=par('lwd'), col=1,
           n.risk=FALSE, grid=FALSE,
           srt.n.risk=0, adj.n.risk=1,
           y.n.risk, cex.n.risk=.6)



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

参数:fit
result of fit (cph, psm, survfit, survest.psm).  For survdiffplot, fit must be the result of survfit.  
拟合结果(cph,psm,survfit,survest.psm“)。对于survdiffplot,fit必须的survfit的结果。


参数:...
list of factors with names used in model. For fits from survfit, these arguments do not appear - all strata are plotted. Otherwise the first factor listed is the factor used to determine different survival curves.  Any other factors are used to specify single constants to be adjusted to, when defaults given to fitting routine (through limits) are not used.  The value given to factors is the original coding of data given to fit, except that for categorical or strata factors the text string levels may be specified.  The form of values given to the first factor are none (omit the equal sign to use default range or list of all values if variable is discrete), "text" if factor is categorical, c(value1, value2, ...), or a function which returns a vector, such as seq(low,high,by=increment).  Only the first factor may have the values omitted.  In this case the Low effect, Adjust to, and High effect values will be used from datadist if the variable is continuous.  For variables not defined to datadist, you must specify non-missing constant settings (or a vector of settings for the one displayed variable).  Note that since survfit objects do not use the variable list in ..., you can specify any extra arguments to labcurve by adding them at the end of the list of arguments.  
列表名称中使用的模型的因素。对于适合从survfit,这些参数不会出现 - 绘制各阶层。否则,所列出的第一个系数是用来确定不同的生存曲线的因素。用于指定的任何其他因素进行调整,以单一的常数,当给予嵌合例程(透过limits)不使用默认值。给定的值的因素是原来的编码,以适应给定的数据,除了可以指定分类或分层因素的文本字符串水平。第一个因素给定值的形式是没有(省略等号使用默认的范围或列表中的所有值,如果变量是离散),"text"如果是绝对的因素,c(value1, value2, ...),或功能返回一个向量,如seq(low,high,by=increment)。只有第一个因素可能有省略的值。在这种情况下,Low effect,Adjust to和High effect值将被用于从datadist,如果变量是连续的。对于没有定义的变量datadist,你必须指定非缺失常数设置(或向量的设置所显示的变量)。需要注意的是自survfit对象不使用的变量列表中...,您可以指定在参数列表的末尾添加任何额外的参数labcurve。


参数:xlim
a vector of two numbers specifiying the x-axis range for follow-up time. Default is (0,maxtime) where maxtime was the pretty()d version of the maximum follow-up time in any stratum, stored in fit$maxtime.  If logt=TRUE, default is (1, log(maxtime)).  
两个数的,后续的时间范围内的x轴specifiying的向量。默认是(0,maxtime),其中maxtimepretty()D版的最大随访时间在任何阶层,存储在fit$maxtime。如果logt=TRUE,默认是(1, log(maxtime))。


参数:ylim
y-axis limits.  Default is c(0,1) for survival, and c(-5,1.5) if loglog=TRUE. If fun or loglog=TRUE are given and ylim is not,  the limits will be computed from the data.  For what="hazard", default limits are computed from the first hazard function plotted.  
y轴的限制。默认值是c(0,1)求生存,以c(-5,1.5)如果loglog=TRUE。如果fun或loglog=TRUE,并给出了ylim不,这些限制将被计算出来的数据。对于what="hazard",默认限制是从第一个风险函数计算曲线。


参数:xlab
x-axis label.  Default is units attribute of failure time variable given to Surv.  
X轴标签。默认是units故障时间变量给Surv属性。


参数:ylab
y-axis label.  Default is "Survival Probability" or  "log(-log Survival Probability)". If fun is given, the default is "".  For what="hazard", the default is "Hazard Function".  
y轴的标签。默认值是"Survival Probability"或"log(-log Survival Probability)"。默认情况下是fun如果,""。对于what="hazard",默认的是"Hazard Function"。


参数:time.inc
time increment for labeling the x-axis and printing numbers at risk.  If not specified, the value of time.inc stored with the model fit will be used.  
用于标识处于危险之中的x轴和印刷号码的时间增量。如果未指定,time.inc存储的模型拟合值将被使用。


参数:type
specifies type of estimates, "tsiatis" (the default) or "kaplan-meier". "tsiatis" here corresponds to the Breslow estimator. This is ignored if survival estimates stored with surv=TRUE are being used. For fits from survfit, this argument is also ignored, since it is specified as an argument to survfit.  
指定类型的估计,"tsiatis"(默认值)或"kaplan-meier"。 "tsiatis"对应的布瑞斯罗夫估计。这被忽略,如果生存估计存储surv=TRUE正在使用。对于符合从survfit,这种说法也被忽略了,因为它被指定为一个参数survfit“。


参数:conf.type
specifies the basis for confidence limits. This argument is ignored for fits from survfit.  
指定的置信区间的基础。此参数将被忽略一刀切survfit。


参数:conf.int
Default is FALSE.  Specify e.g. .95 to plot 0.95 confidence bands. For fits from parametric survival models, or Cox models with x=TRUE and y=TRUE specified to the fit, the exact asymptotic formulas will be used to compute standard errors, and confidence limits are based on log(-log S(t)). If x=TRUE and y=TRUE were not specified to cph but surv=TRUE was, the standard errors stored for the underlying survival curve(s) will be used. These agree with the former if predictions are requested at the mean value of X beta or if there are only stratification factors in the model. This argument is ignored for fits from survfit, which must have previously specified confidence interval specifications.  
默认是FALSE。指定例如.95绘制0.95置信区间。有关的参数生存模型,Cox模型x=TRUE和y=TRUE指定到合适的,精确的渐近公式将用于计算标准误差和置信限的基础上log(-log S(t))适合从。如果x=TRUE和y=TRUEcph但surv=TRUE,存储的基本生存曲线(S)的标准误差将被用于未指定。这些同意前,如果预测时,要求的X测试的平均值,或如果有分层因素在模型中,。 survfit,必须在先前指定的置信区间规格为配合此参数将被忽略。


参数:conf
"bars" for confidence bars at each time.inc time point. If the fit was from cph(..., surv=TRUE), the time.inc used will be that stored with the fit. Use conf="bands" (the default) for bands using standard errors at each failure time. For survfit objects only, conf may also be "none", indicating that confidence interval information stored with the survfit result should be ignored.  
"bars"信心条形在每个time.inc的的时间点。如果适合cph(..., surv=TRUE),time.inc使用的存储与契合。使用conf="bands"(默认值)的乐队在每一次的失败时使用标准的错误。 survfit对象,conf"none",表明置信区间survfit的结果与存储的信息被忽略,也可能是。


参数:what
defaults to "survival" to plot survival estimates.  Set to "hazard" or an abbreviation to plot the hazard function (for psm fits only). Confidence intervals are not available for what="hazard".  
默认"survival"绘制生存的估计。设置为"hazard"或绘制风险函数(psm只适合)的缩写。置信区间可用于what="hazard"。


参数:add
set to TRUE to add curves to an existing plot.  
设置为TRUE添加曲线到现有的图。


参数:label.curves
default is TRUE to use labcurve to label curves where they are farthest apart.  Set label.curves to a list to specify options to labcurve, e.g., label.curves=list(method="arrow", cex=.8). These option names may be abbreviated in the usual way arguments are abbreviated.  Use for example label.curves=list(keys=1:5) to draw symbols (as in pch=1:5 - see points) on the curves and automatically position a legend in the most empty part of the plot.  Set label.curves=FALSE to suppress drawing curve labels.  The col, lty, lwd, and type parameters are automatically passed to labcurve, although you can override them here.  To distinguish curves by line types and still have labcurve construct a legend, use for example label.curves=list(keys="lines").  The negative value for the plotting symbol will suppress a plotting symbol from being drawn either on the curves or in the legend.  
默认是TRUE使用labcurve曲线距离最远的标签。设置label.curves一个list指定选项来labcurve,例如,label.curves=list(method="arrow", cex=.8)的。这些选项的名称可能会用通常的方法参数的缩写简称。例如label.curves=list(keys=1:5)画曲线上的符号(如pch=1:5  - 见points)和自动定位传说中的最空的部分图。设置label.curves=FALSE抑制绘制曲线标签。 col,lty,lwd和type参数自动传递给labcurve,虽然在这里你可以覆盖它们。为了区分曲线的线类型和,仍然有labcurve构建一个传说,例如label.curves=list(keys="lines")。绘图符号为负值,将抑制曲线上或在传说中被吸入绘图符号。


参数:abbrev.label
set to TRUE to abbreviate() curve labels that are plotted  
设置为TRUE到abbreviate()绘制的曲线标签


参数:levels.only
set to TRUE to remove variablename= from the start of curve labels.
设置TRUE删除variablename=从一开始曲线的标签。


参数:lty
vector of line types to use for different factor levels.  Default is c(1,3,4,5,6,7,...).  
矢量线的类型使用不同的因子水平。默认是c(1,3,4,5,6,7,...)。


参数:lwd
vector of line widths to use for different factor levels.  Default is current par setting for lwd.  
矢量线的宽度,使用不同的因子水平。默认是当前par设置为lwd。


参数:col
color for curve, default is 1.  Specify a vector to assign different colors to different curves.  
曲线的颜色,默认是1。指定一个的矢量分配不同的颜色不同的曲线。


参数:col.fill
a vector of colors to used in filling confidence bands
一个向量的颜色用于填充置信区间


参数:adj.subtitle
set to FALSE to suppress plotting subtitle with levels of adjustment factors not plotted. Defaults to TRUE. This argument is ignored for survfit.  
设置为FALSE抑制绘制字幕的水平调整的因素未标出。默认为TRUE的。为survfit此参数将被忽略。


参数:loglog
set to TRUE to plot log(-log Survival) instead of Survival  
设置TRUE绘制log(-log Survival),而不是Survival


参数:fun
specifies any function to translate estimates and confidence limits before plotting  
指定任何功能,打印之前,翻译的估计和置信限


参数:logt
set to TRUE to plot log(t) instead of t on the x-axis  
设置为TRUE绘制log(t),而不是tx轴


参数:n.risk
set to TRUE to add number of subjects at risk for each curve, using the surv.summary created by cph or using the failure times used in fitting the model if y=TRUE was specified to the fit or if the fit was from survfit. The numbers are placed at the bottom of the graph unless y.n.risk is given.  If the fit is from survest.psm, n.risk does not apply.  
设置为TRUE添加的主题为每条曲线的风险,使用surv.summary创建cph或使用用于拟合模型,如果y=TRUE指定的失败次数适合适合survfit。被放置在图形底部除非y.n.risk给出的数字。如果适合从survest.psm,n.risk不适用。


参数:srt.n.risk
angle of rotation for leftmost number of subjects at risk (since this number may run into the second or into the y-axis).  Default is 0.  
受试者在风险(因为这个数字可能运行到第二或进入的y轴)的最左边的数的旋转角度。默认是0。


参数:adj.n.risk
justification for leftmost number at risk. Default is 1 for right  justification. Use 0 for left justification, .5 for centered.  
最左边的数字在风险的理由。默认值为1右对齐。使用0为左对齐,.5为中心的。


参数:sep.n.risk
multiple of upper y limit - lower y limit for separating lines of text containing number of subjects at risk.  Default is .056*(ylim[2]-ylim[1]).  
上Ÿ限制 - 限制分隔的文本行包含数字的受试者的风险较低的y的倍数。默认是.056*(ylim[2]-ylim[1])。


参数:y.n.risk
When n.risk=TRUE, the default is to place numbers of patients at risk above the x-axis.  You can specify a y-coordinate for the bottom line of the numbers using y.n.risk.  
当n.risk=TRUE,默认值是放置在上面的x-轴的风险的患者的号码。您可以指定为底线的数字,使用y.n.risky坐标。


参数:cex.n.risk
character size for number of subjects at risk (when n.risk is TRUE)  
字符大小在风险科目数(时n.risk是TRUE)


参数:dots
set to TRUE to plot a grid of dots.  Will be plotted at every time.inc (see cph) and at survival increments of .1 (if d>.4), .05 (if .2 < d <= .4), or .025 (if d <= .2), where d is the range of survival displayed.  
设置为TRUE绘制的网格点。将被绘制在每一个time.inc(见cph)和生存增量的0.1(如果d>.4),0.05(如果.2 < d <= .4),或.025(如果d <= .2),其中d的范围内显示的生存。


参数:dotsize
size of dots in inches  
以英寸为单位的点的大小


参数:grid
defaults to FALSE. Set to a color shading to plot faint lines. Set to 1 to plot solid lines.  Default is .05 if TRUE.  
默认为FALSE的。设置阴影的颜色绘制淡淡的线。设置为1实线绘制。默认是.05如果TRUE。


参数:pr
set to TRUE to print survival curve coordinates used in the plots  
设置为TRUE打印生存曲线坐标系中的图


参数:order
an integer vector of length two specifying the order of groups when computing survival differences.  The default of 1:2 indicates that the second group is subtracted from the first.  Specify order=2:1 to instead subtract the first from the second.  A subtitle indicates what was done.  
长度为2的整数向量组的顺序指定,当计算的生存差异。默认的1:2表示从所述第一,第二组中减去。指定order=2:1,而不是减去第一第二。的字幕做了什么。


Details

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

survplot will not work for Cox models with time-dependent covariables. Use survest or survfit for that purpose.
survplot将无法正常工作与时间相关的协变量的Cox模型。使用survest或survfit用于这一目的。

Use ps.slide, win.slide, gs.slide to set up nice defaults for plotting.  These also set a system option mgp.axis.labels to allow x and y-axes to have differing mgp graphical parameters (see par). This is important when labels for y-axis tick marks are to be written horizontally (par(las=1)), as a larger gap between the labels and the tick marks are needed.  You can set the axis-specific 2nd component of mgp using mgp.axis.labels(c(xvalue,yvalue)).
使用ps.slide,win.slide,gs.slide设置了很好绘图的默认值。这些系统还设置了选项“mgp.axis.labels允许的X和Y轴有不同的mgp图形参数(见par”)。为y轴的刻度标签时要横写(par(las=1)),需要的标签和刻度线之间有较大的差距,这是很重要的。您可以设置特定轴的第二个组成部分mgp使用mgp.axis.labels(c(xvalue,yvalue))。


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

list with components adjust (text string specifying adjustment levels) and curve.labels (vector of text strings corresponding to levels of factor used to distinguish curves). For survfit, the returned value is the vector of strata labels, or NULL if there are no strata.
列表组件调整(调整水平文本字符串,该字符串指定)和curve.labels(矢量相应的文本字符串用来区分曲线的因素)。对于survfit,返回的值是向量的阶层标签,或NULL如果没有阶层。


副作用----------Side Effects----------

plots. If par()$mar[4]<4, issues par(mar=) to increment mar[4] by 2 if n.risk=TRUE and add=FALSE. The user may want to reset par(mar) in this case to not leave such a wide right margin for plots. You usually would issue par(mar=c(5,4,4,2)+.1).
图。如果par()$mar[4]<4,问题par(mar=)递增mar[4]如果n.risk=TRUE和add=FALSE。用户可能需要重置par(mar)在这种情况下,不留下如此广泛的右边距图。你通常会发出par(mar=c(5,4,4,2)+.1)。


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

datadist, rms, cph, psm, survest, predictrms, plot.Predict,  units, errbar,   survfit, survreg.distributions, labcurve, mgp.axis, par, ps.slide
datadist,rms,cph,psm,survest,predictrms,plot.Predict,units,<所述>,errbar,survfit,survreg.distributions,labcurve,mgp.axis,par


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


# Simulate data from a population model in which the log hazard[从人口模型的模拟数据,在该log的危险]
# function is linear in age and there is no age x sex interaction[函数是线性的,在年龄,有没有年龄的X性互动]
n <- 1000
set.seed(731)
age <- 50 + 12*rnorm(n)
label(age) <- "Age"
sex <- factor(sample(c('male','female'), n, TRUE))
cens <- 15*runif(n)
h <- .02*exp(.04*(age-50)+.8*(sex=='female'))
dt <- -log(runif(n))/h
label(dt) <- 'Follow-up Time'
e <- ifelse(dt <= cens,1,0)
dt <- pmin(dt, cens)
units(dt) <- "Year"
dd <- datadist(age, sex)
options(datadist='dd')
S <- Surv(dt,e)

# When age is in the model by itself and we predict at the mean age,[当年龄在模型本身和我们预测的平均年龄,]
# approximate confidence intervals are ok[近似置信区间的确定]

f <- cph(S ~ age, surv=TRUE)
survplot(f, age=mean(age), conf.int=.95)
g <- cph(S ~ age, x=TRUE, y=TRUE)
survplot(g, age=mean(age), conf.int=.95, add=TRUE, col='red', conf='bars')

# Repeat for an age far from the mean; not ok[重复的年龄远的平均值,而不是确定]
survplot(f, age=75, conf.int=.95)
survplot(g, age=75, conf.int=.95, add=TRUE, col='red', conf='bars')


#Plot stratified survival curves by sex, adj for quadratic age effect[图性,可调节的分层生存曲线的二次年龄效应]
# with age x sex interaction (2 d.f. interaction)[与年龄x性互动(2 D.F.互动)]

f <- cph(S ~ pol(age,2)*strat(sex), x=TRUE, y=TRUE)
#or f &lt;- psm(S ~ pol(age,2)*sex)[或f < -  PSM(S~POL(年龄,2)*性)]
Predict(f, sex, age=c(30,50,70))
survplot(f, sex, n.risk=TRUE, levels.only=TRUE)   #Adjust age to median[调整年龄中位数]
survplot(f, sex, logt=TRUE, loglog=TRUE)   #Check for Weibull-ness (linearity)[检查威布尔性(线性)]
survplot(f, sex=c("male","female"), age=50)
                                        #Would have worked without datadist[本来没有datadist工作]
                                        #or with an incomplete datadist[或与一个不完整的datadist]
survplot(f, sex, label.curves=list(keys=c(2,0), point.inc=2))
                                        #Identify curves with symbols[确定曲线符号]


survplot(f, sex, label.curves=list(keys=c('m','f')))
                                        #Identify curves with single letters[用单个字母的识别曲线]


#Plots by quintiles of age, adjusting sex to male[图的五分之一人口的年龄,调整性别为男性,]
options(digits=3)
survplot(f, age=quantile(age,(1:4)/5), sex="male")


#Plot survival Kaplan-Meier survival estimates for males[图生存Kaplan-Meier生存估计为男性]
f <- survfit(S ~ 1, subset=sex=="male")
survplot(f)


#Plot survival for both sexes[图生存男女]
f <- survfit(S ~ sex)
survplot(f)
#Check for log-normal and log-logistic fits[检查正常的log和logMF一刀切]
survplot(f, fun=qnorm, ylab="Inverse Normal Transform")
survplot(f, fun=function(y)log(y/(1-y)), ylab="Logit S(t)")

#Plot the difference between sexes[绘制的性别差异]
survdiffplot(f)

options(datadist=NULL)

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-24 12:21 , Processed in 0.021732 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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