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

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

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

                                         3-D Plots Showing Effects of Two Continuous Predictors in a Regression
                                         3-D绘图显示两个连续预测变量的影响在回归

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

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

Uses lattice graphics and the output from Predict to plot image, contour, or perspective plots showing the simultaneous effects of two continuous predictor variables.  Unless formula is provided, the x-axis is constructed from the first variable listed in the call to Predict and the y-axis variable comes from the second.
使用点阵图形和绘制图像,轮廓,或透视图,同时影响两个连续预测变量的输出Predict。除非formula,x轴从列出的第一个变量在调用构造Predict和y的-轴变量来自第二。

The perimeter function is used to generate the boundary of data to plot when a 3-d plot is made.  It finds the area where there are sufficient data to generate believable interaction fits.
perimeter函数是用来产生的边界的数据绘制时的3维图由。它发现的地方有足够的数据来生成可信的互动配合。


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


bplot(x, formula, lfun=levelplot, xlab, ylab, zlab,
      adj.subtitle=!info$ref.zero, cex.adj=.75, cex.lab=1,
      perim, showperim=FALSE,
      zlim=range(yhat, na.rm=TRUE), scales=list(arrows=FALSE),
      xlabrot, ylabrot, zlabrot=90, ...)

perimeter(x, y, xinc=diff(range(x))/10, n=10, lowess.=TRUE)



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

参数:x
for bplot, an object created by Predict for which two or more numeric predictors varied. For perim is the first variable of a pair of predictors forming a 3-d plot.  
bplot,Predict两个或两个以上不同的数字的预测中创建的对象。 perim是一对的预测,形成一个3-D绘图的第一个变量。


参数:formula
a formula of the form f(yhat) ~ x*y optionally followed by |a*b*c which are 1-3 paneling variables that were specified to Predict. f can represent any R function of a vector that produces a vector.  If the left hand side of the formula is omitted, yhat will be inserted.  If formula is omitted, it will be inferred from the first two variables that varied in the call to Predict.  
一个公式的形式f(yhat) ~ x*y可以选择后跟| A * B * C这是1-3镶板变量被指定为Predict的。 f可以代表任何R函数产生一个矢量的矢量。如果式的左手侧的省略,yhat将被插入。如果formula省略,它会被推断出来的前两个变量,调用Predict变化。


参数:lfun
a high-level lattice plotting function that takes formulas of the form z ~ x*y.  The default is an image plot (levelplot).  Other common choices are wireframe for perspective plot or contourplot for a contour plot.  
一个高层次的的点阵绘图功能,公式的形式z ~ x*y。默认值是图像图(levelplot“)。其他常见的选择是wireframe透视图或contourplot的等高线图。


参数:xlab
Label for x-axis. Default is given by Predict.  
x轴的标签。默认的Predict。


参数:ylab
Label for y-axis  
y轴的标签


参数:zlab
z-axis label for perspective (wireframe) plots. Default comes from Predict.  zlab will often be specified if fun was specified to Predict.  
z轴的角度来看(线框)图的标签。默认来自Predict。 zlab往往会被指定,如果fun被指定为Predict。


参数:adj.subtitle
Set to FALSE to suppress subtitling the graph with the list of settings of non-graphed adjustment values. Default is TRUE if there are non-plotted adjustment variables and ref.zero was not used.  
设置FALSE抑制字幕列表中设置非绘制的调整值图,。默认是TRUE如果有非绘制调整变量和ref.zero不使用的。


参数:cex.adj
cex parameter for size of adjustment settings in subtitles.  Default is 0.75  
cex参数调整设置字幕的大小。默认值是0.75


参数:cex.lab
cex parameter for axis labels.  Default is 1.  
cex参数轴标签。默认值是1。


参数:perim
names a matrix created by perimeter when used for 3-d plots of two continuous predictors.  When the combination of variables is outside the range in perim, that section of the plot is suppressed.  If perim  is omitted, 3-d plotting will use the marginal distributions of the two predictors to determine the plotting region, when the grid is not specified explicitly in variables.  When instead a series of curves is being plotted, perim specifies a function having two arguments.  The first is the vector of values of the first variable that is about to be plotted on the x-axis.  The second argument is the single  value of the variable representing different curves, for the current curve being plotted.  The function's returned value must be a logical vector whose length is the same as that of the first argument, with values TRUE if the corresponding point should be plotted for the current curve, FALSE otherwise.  See one of the latter examples.  
名称创建的perimeter矩阵使用时,两个连续的预测为3-D图形。当组合的变量是范围以外的perim,这部分的图被抑制。如果perim省略,3-D绘图的边缘分布的两个预测值,以确定绘图区域,当电网中没有明确说明variables。当,而不是一系列的曲线绘制,perim指定一个函数有两个参数。第一个是第一可变的值,大约是被绘制在x轴的向量。第二个参数是单个值的变量,代表不同的曲线,所绘制的曲线。该函数的返回值必须是一个逻辑向量,其长度是一样的第一个参数的值TRUE,如果相应的点绘制的曲线,FALSE否则。参见后者的例子之一。


参数:showperim
set to TRUE if perim is specified and you want to show the actual perimeter used.  
设置为TRUE如果perim指定你要使用的实际周长。


参数:zlim
Controls the range for plotting in the z-axis if there is one. Computed by default.  
控制的范围内用于绘制在z轴,如果有一个的。默认情况下计算的。


参数:scales
see wireframe  
看到wireframe


参数:xlabrot
rotation angle for the x-axis.  Default is 30 for wireframe and 0 otherwise.  
对于x轴的旋转角。默认值是30 wireframe,否则为0。


参数:ylabrot
rotation angle for the y-axis.  Default is -40 for wireframe, 90 for contourplot or levelplot, and 0 otherwise.  
为y轴的旋转角。默认值是-40wireframe,90 contourplot或levelplot,否则为0。


参数:zlabrot
rotation angle for z-axis rotation for wireframe plots  
z轴旋转的旋转角度为wireframe图


参数:...
other arguments to pass to the lattice function  
其他参数传递给晶格功能


参数:y
second variable of the pair for perim.  If omitted, x is assumed to be a list with both x and y components.  
第二个变量对perim。如果省略,x被假定为是一个与两个x和y组件列表。


参数:xinc
increment in x over which to examine the density of y in perimeter   
增量x超过检查的密度yperimeter的


参数:n
within intervals of x for perimeter, takes the informative range of y to be the nth smallest to the nth largest values of y.  If there aren't  at least 2n y values in the x interval, no y ranges are used for that interval.  
间隔内xperimeter,以翔实的范围内y是n日最小的n个最大的值y的。如果没有至少2ny在x间隔值,没有y范围用于该时间间隔。


参数:lowess.
set to FALSE to not have lowess smooth the data perimeters  
设置为FALSE不lowess平滑数据的周长


Details

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

perimeter is a kind of generalization of datadist for 2 continuous variables.  First, the n smallest and largest x values are determined.  These form the lowest and highest possible xs to display.  Then x is grouped into intervals bounded by these two numbers, with the interval widths defined by xinc. Within each interval, y is sorted and the nth smallest and largest y are taken as the interval containing sufficient data density to plot interaction surfaces.  The interval is ignored when there are insufficient y values.  When the data are being readied for persp, bplot uses the approx function to do linear interpolation of the y-boundaries as a function of the x values actually used in forming the grid (the values of the first variable specified to Predict).  To make the perimeter smooth, specify lowess.=TRUE to perimeter.
perimeter是一种datadist2连续变量的概括。首先,n最小和最大的x值的确定。这些形式的最低和最高的x的显示。 x分组范围内的这两个数字为间隔,间隔的宽度定义为xinc。每个时间间隔内,y排序n个最小和最大y含有足够的数据密度绘制的相互作用表面的间隔。被忽略,当有足够的y值的时间间隔。当数据正在准备persp,bplot使用approx函数做线性内插的y边界的x值的函数实际使用中形成的网格(的第一个变量的值指定为Predict)。为了使周边光滑,请指定lowess.=TRUE到perimeter。


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

perimeter returns a matrix of class perimeter.  This outline can be conveniently plotted by lines.perimeter.
perimeter返回一个矩阵类perimeter。该轮廓可以很方便地绘制lines.perimeter。


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



Frank Harrell<br>
Department of Biostatistics, Vanderbilt University<br>
f.harrell@vanderbilt.edu




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

datadist, Predict, rms, rmsMisc, levelplot, contourplot, wireframe
datadist,Predict,rms,rmsMisc,levelplot,contourplot,wireframe


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


n &lt;- 1000    # define sample size[确定样本量]
set.seed(17) # so can reproduce the results[所以可以重现的结果]
age            <- rnorm(n, 50, 10)
blood.pressure <- rnorm(n, 120, 15)
cholesterol    <- rnorm(n, 200, 25)
sex            <- factor(sample(c('female','male'), n,TRUE))
label(age)            &lt;- 'Age'      # label is in Hmisc[标签是在Hmisc]
label(cholesterol)    <- 'Total Cholesterol'
label(blood.pressure) <- 'Systolic Blood Pressure'
label(sex)            <- 'Sex'
units(cholesterol)    &lt;- 'mg/dl'   # uses units.default in Hmisc[使用units.default在Hmisc]
units(blood.pressure) <- 'mmHg'

# Specify population model for log odds that Y=1[指定的log几率的人口模型Y = 1]
L <- .4*(sex=='male') + .045*(age-50) +
  (log(cholesterol - 10)-5.2)*(-2*(sex=='female') + 2*(sex=='male'))
# Simulate binary y to have Prob(y=1) = 1/[1+exp(-L)][模拟二进制y以有PROB(y = 1时)= 1 / [1 +(-L)]]
y <- ifelse(runif(n) < plogis(L), 1, 0)

ddist <- datadist(age, blood.pressure, cholesterol, sex)
options(datadist='ddist')

fit <- lrm(y ~ blood.pressure + sex * (age + rcs(cholesterol,4)),
               x=TRUE, y=TRUE)
p &lt;- Predict(fit, age, cholesterol, sex, np=50) # vary sex last[不同性别最后]
bplot(p)                 # image plot for age, cholesterol with color[图像绘图年龄,胆固醇与颜色]
                         # coming from yhat; use default ranges for[来自yhat使用默认范围]
                         # both continuous predictors; two panels (for sex)[两个连续的预测,两个面板(的性别)]
bplot(p, lfun=wireframe) # same as bplot(p,,wireframe)[一样bplot(P,线框)]
# View from different angle, change y label orientation accordingly[从不同的角度看,改变Y轴的标签方向]
# Default is z=40, x=-60[默认为z = 40,x = -60]
bplot(p,, wireframe, screen=list(z=40, x=-75), ylabrot=-25)
bplot(p,, contourplot)   # contour plot[等高线图]
bounds  <- perimeter(age, cholesterol, lowess=TRUE)
plot(age, cholesterol)     # show bivariate data density and perimeter[二元数据显示密度和周长]
lines(bounds[,c('x','ymin')]); lines(bounds[,c('x','ymax')])
p &lt;- Predict(fit, age, cholesterol)  # use only one sex[只用一个性别]
bplot(p, perim=bounds)   # draws image() plot[绘制图像()图]
                         # don't show estimates where data are sparse[数据稀少的情况下,不显示估计]
                         # doesn't make sense here since vars don't interact[这里没有任何意义,因为瓦尔不会互相影响]
bplot(p, plogis(yhat) ~ age*cholesterol) # Probability scale[概率规模]
options(datadist=NULL)

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-24 13:23 , Processed in 0.031020 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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