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

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

[复制链接]
发表于 2012-10-1 16:15:23 | 显示全部楼层 |阅读模式
visreg(visreg)
visreg()所属R语言包:visreg

                                        Visualization of regression functions for a single variable
                                         一个单变量回归函数的可视化

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

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

A function used to visualize regression models quickly and easily.  Default plots contain a confidence band, prediction line, and partial residuals.  Factors, transformations, conditioning, interactions, and a variety of other options are supported.
使用的函数回归模型的可视化,快速和容易。默认图包含的信心带,预测线,以及部分残留物。支持因素,转换,空调,互动,和其他多种选择。


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


visreg(fit, xvar, by, breaks=4, type=c("conditional","effect"),
trans=as.numeric, scale=c("linear","response"), xtrans, alpha=.05,
nn=101, cond=list(), whitespace=0.2, partial=TRUE, jitter=FALSE,
strip.names=FALSE, ...)



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

参数:fit
This is the fitted model object you wish to visualize.  lm, glm, gam, rlm, and coxph data classes are all supported.  
这是你想可视化拟合模型的对象。流明,GLM,GAM,RLM和coxph数据类都支持。


参数:xvar
This is the variable to be put on the x-axis of your plot.  Both continuous variables and factors are supported.  
这是被提上你的曲线的x-轴的变量。连续变量和因素都支持。


参数:by
An option to use if you wish to divide your plot by a third variable.  Uses the lattice package.  Both continuous variables and factors are supported.  
选择使用,如果您想将您的第三个变量的图。采用格子包。连续变量和因素都支持。


参数:breaks
If a continuous variable is used for the 'by' option, the 'breaks' argument determines how many quantiles will be divided to be used for panels.  
如果一个连续变量被用于按选项,“截断”参数确定多少分位数将被划分到用于面板。


参数:type
The type of plot to be produced.  The following options are supported:   
图的类型。支持以下选项:

If 'conditional' is selected, the plot returned shows the value of the variable on the x-axis and the change in response on the y-axis, holding all other variables constant (median for numeric variables and most common category for factors, by default).  For more detail, see references.  
如果“条件”被选择时,返回的图显示上的x轴方向和在y-轴的变化响应的变量的值,所有其他变量保持恒定(中位数为数字变量和最常见的类别为因素,通过默认情况下)。欲知更多详情,请参阅参考资料。

If 'effect' is selected, the plot returned shows the effect on the expecte value of the response by moving the x variable away from a reference point on the x-axis (median for numeric variables and most common category for factors, by default).  For more detail, see references.  
如果效果被选择时,返回的图x变量移动远离一个参考点上的x轴(中位数为数字变量和最常见的类别为因素,在默认情况下,显示的效果上人口会响应值的) 。欲知更多详情,请参阅参考资料。


参数:trans
Allows transformations to the response.  A function should be passed (see examples).  
允许转换的响应。应通过一个函数(见示例)。


参数:scale
If response is selected and a glm is passed as the fit parameter, the response will automatically be transformed.  
如果响应被选中,一个的GLM传递合适的参数,响应将被自动转化。


参数:xtrans
Allows transformations to the x-axis.  A function should be passed.  Note that inverse transformations to explanatory variables are performed automatically by visreg.  
于x-轴的允许转换。应通过一个函数。需要注意的是解释变量进行逆变换自动visreg。


参数:alpha
Alpha level for the confidence band displayed in the plot.  
在图中显示的信心带的阿尔法水平。


参数:nn
Controls the smoothness of the line and confidence band.  The higher the number, the smoother they will appear.  
控制线的平滑度和置信带。的数字越高,越平滑,它们将出现。


参数:cond
Used to set variables to specific values.  Can also be used to select the reference point for an effect plot.  Named lists should be passed.  All variables left unspecified will be filled in with the median/most common category (see examples).  
用于变量设置为特定的值。也可用于选择的参考点为效果图。命名名单应该通过。所有的变量,未指定将被填充,的位数/最常见的类别(见例子)。


参数:whitespace
When xvar is a factor, whitespace determines the ammount of space in between factors on the x-axis.  
当xvar是一个因素,空白决定因素,在x-轴之间的ammount的空间。


参数:partial
Determines if partial residuals are shown on the plot.  
确定部分残差的图。


参数:jitter
Adds a small amount of noise to xvar.  Potentially useful if many observations have exactly the same value.  Default is FALSE.  
添加少量的噪音,xvar。潜在有用的,如果许多观察到的具有相同的值。默认值是false。


参数:strip.names
When by=TRUE, adds the name of the by variable to the strip at the top of each panel.  Default is FALSE.  
当by=TRUE,添加的名称by变量来在每个面板的顶部带。默认值是false。


参数:...
Graphical parameters can be passed to the function to customize the plots.  If by=TRUE, lattice parameters can be passed, such as layout (see examples below).  
图形参数可以传递给函数的自定义图。如果by=TRUE,可以通过晶格参数,如布局(见下面的例子)。


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

In addition to providing plots, the visreg function also invisibly returns the data frames, estimates, confidence intervals, and residuals used in the creation of its plots (see last example).
除了提供图,visreg功能也无形地传回的数据框,估计,置信区间和残差在创建它的图(见最后一个例子)。


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



Patrick Breheny and Woodrow Burchett




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

using visreg. http://web.as.uky.edu/statistics/users/pbreheny/publications/visreg.pdf

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

visreg2d
visreg2d


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


## Linear models[#线性模型]

## Basic[#基本]
fit <- lm(Ozone ~ Solar.R + Wind + Temp,data=airquality)
visreg(fit)
visreg(fit,"Wind",type="effect")
visreg(fit,"Wind",type="conditional")
visreg(fit,c("Solar.R","Wind","Temp"))

## Factors[#因素]
airquality$Heat <- cut(airquality$Temp,3,labels=c("Cool","Mild","Hot"))
fit.heat <- lm(Ozone ~ Solar.R + Wind + Heat,data=airquality)
visreg(fit.heat,"Heat",type="effect")
visreg(fit.heat,"Heat",type="conditional")
## Use of whitespace option[#使用的空白选项]
visreg(fit.heat,"Heat",whitespace=.1)
visreg(fit.heat,"Heat",whitespace=.5)

## Transformations[#转换]
fit1 <- lm(Ozone ~ Solar.R + Wind + Temp + I(Wind^2),data=airquality)
fit2 <- lm(log(Ozone) ~ Solar.R + Wind + Temp,data=airquality)
fit3 <- lm(log(Ozone) ~ Solar.R + Wind + Temp + I(Wind^2),data=airquality)
visreg(fit1,"Wind")
visreg(fit2,"Wind",trans=exp,ylab="Ozone")
visreg(fit3,"Wind",trans=exp,ylab="Ozone")

## Conditioning[#空调]
visreg(fit,"Wind",cond=list(Temp=50))
visreg(fit,"Wind")
visreg(fit,"Wind",cond=list(Temp=100))

## Interactions[#相互作用]
fit.in1 <- lm(Ozone~ Solar.R + Wind*Heat,data=airquality)
visreg(fit.in1,"Wind",by="Heat")
visreg(fit.in1,"Heat",by="Wind")
visreg(fit.in1,"Wind",by="Heat",type="effect")
visreg(fit.in1,"Wind",cond=list(Heat="Cool"),type="effect")
visreg(fit.in1,"Wind",cond=list(Heat="Hot"),type="effect")


## Nonlinear models[#非线性模型]

data("birthwt",package="MASS")
birthwt$race <- factor(birthwt$race,labels=c("White","Black","Other"))
birthwt$smoke <- factor(birthwt$smoke,labels=c("Nonsmoker","Smoker"))

fit <- glm(low~age+race+smoke+lwt,data=birthwt,family="binomial")
visreg(fit,"lwt",xlab="Mother's Weight",ylab="Log odds (low birthweight)")
visreg(fit,"lwt",scale="response",partial=FALSE,xlab="Mother's Weight",ylab="P(low birthweight)")

require(survival)
data(ovarian)
ovarian$rx <- factor(ovarian$rx)

fit <- coxph(Surv(futime,fustat)~age+rx,data=ovarian)

visreg(fit,"age",ylab="log(Hazard ratio)")

require(MASS)
fit <- rlm(Ozone ~ Solar.R + Wind*Heat,data=airquality)
visreg(fit,"Wind",cond=list(Heat="Mild"))

v <- visreg(fit,"Wind",cond=list(Heat="Mild"))


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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-26 05:42 , Processed in 0.019638 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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