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

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

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

                                        Fit Linear Model Using Generalized Least Squares
                                         使用广义最小二乘法拟合线性模型

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

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

This function fits a linear model using generalized least squares. The errors are allowed to be correlated and/or have unequal variances.  Gls is a slightly enhanced version of the Pinheiro and Bates Gls function in the nlme package to make it easy to use with the rms package and to implement cluster bootstrapping (primarily for nonparametric estimates of the variance-covariance matrix of the parameter estimates and for nonparametric confidence limits of correlation parameters).
此功能适合使用广义最小二乘法线性模型。允许相关的错误和/或有不平等的差异。 Gls是一个稍微改进的版本的皮涅罗和贝茨Gls函数nlme包,以方便使用的均方根包,实现聚类的引导(主要用于非参数估计的参数估计值的方差 - 协方差矩阵和非参数相关参数的置信限)。


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


Gls(model, data, correlation, weights, subset, method, na.action=na.omit,
    control, verbose, B=0, dupCluster=FALSE, pr=FALSE,
    opmeth=c('optimize','optim'), x=FALSE)

## S3 method for class 'Gls'
print(x, digits=4, coefs=TRUE, latex=FALSE, title, ...)



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

参数:model
a two-sided linear formula object describing the model, with the response on the left of a ~ operator and the terms, separated by + operators, on the right.
一个双面的线性公式对象描述模型,在左侧的一个~运营商的条款,分离+运营商,在右边的响应。


参数:data
an optional data frame containing the variables named in model, correlation, weights, and subset. By default the variables are taken from the environment from which gls is called.
一个可选的数据框包含的变量命名model,correlation,weights和subset。默认情况下,变量gls被称为环境。


参数:correlation
an optional corStruct object describing the within-group correlation structure. See the documentation of corClasses for a description of the available corStruct classes. If a grouping variable is to be used, it must be specified in the form argument to the corStruct constructor. Defaults to NULL, corresponding to uncorrelated  errors.   
一个可选的corStruct对象,它描述的组内相关结构。查看的文档corClasses可用的corStruct类的描述。如果要使用的一组变量,它必须指定form参数corStruct构造。默认为NULL,对应不相关的错误。


参数:weights
an optional varFunc object or one-sided formula describing the within-group heteroscedasticity structure. If given as a formula, it is used as the argument to varFixed, corresponding to fixed variance weights. See the documentation on varClasses for a description of the available varFunc classes. Defaults to NULL, corresponding to homoscesdatic errors.  
一个可选的varFunc对象或片面的公式描述的组内异方差结构。如果给定为一个公式,它是用来作为varFixed,对应于固定的方差的权重的参数。请参阅文档varClasses,可用的varFunc类的描述。默认为NULL,相应的homoscesdatic错误。


参数:subset
an optional expression indicating which subset of the rows of data should  be  used in the fit. This can be a logical vector, or a numeric vector indicating which observation numbers are to be included, or a  character  vector of the row names to be included.  All observations are included by default.
一个可选的表达式表示的子集的行的data应在适合使用。这可以是一个逻辑向量,或一个数值向量表示观察号码将被包括,或者被包含的行的名称的字符矢量。默认情况下,所有的观测。


参数:method
a character string.  If "REML" the model is fit by maximizing the restricted log-likelihood.  If "ML" the log-likelihood is maximized.  Defaults to "REML".
一个字符串。如果"REML"适合的模型,通过最大限度地限制对数似然。如果"ML"对数似然被最大化。默认为"REML"的。


参数:na.action
a function that indicates what should happen when the data contain NAs.  The default action (na.omit) results in deletion of observations having any of the variables of interest missing.
一个函数,表示会发生什么,当数据包含NA的。默认动作(na.omit)的结果有任何的兴趣缺失的变量的观测中删除。


参数:control
a list of control values for the estimation algorithm to replace the default values returned by the function glsControl. Defaults to an empty list.
控制值估计算法的列表,以取代默认的返回值的函数glsControl。默认为一个空列表。


参数:verbose
an optional logical value. If TRUE information on the evolution of the iterative algorithm is printed. Default is FALSE.
一个可选的逻辑值。如果TRUE信息迭代算法印刷的演变。默认是FALSE。


参数:B
number of bootstrap resamples to fit and store, default is none
数量的引导重新采样,以适应和存储,默认情况下是没有


参数:dupCluster
set to TRUE to have Gls when bootstrapping to consider multiply-sampled clusters as if they were one large cluster when fitting using the gls algorithm
设置为TRUE有Gls在引导时要考虑多采样聚类,好像他们是一个大的聚类装修时使用的gls算法


参数:pr
set to TRUE to show progress of bootstrap resampling
设置TRUE显示进度的bootstrap重采样


参数:opmeth
specifies whether the optimize or the optim function is to be used for optimization
指定是否optimize或optim函数是用于优化


参数:x
for Gls set to TRUE to store the design matrix in the fit object; otherwise the result of Gls
Gls设置为TRUE设计矩阵存储在合适的对象,否则的结果Gls


参数:digits
number of significant digits to print
数量巨大的数字打印


参数: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
一逻辑值,表示信息是否应该被格式化为纯文本或乳胶标记


参数:title
a character string title to be passed to prModFit
一个字符串标题要传递给prModFit


参数:...
ignored
忽视


Details

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

The na.delete function will not work with Gls due to some nuance in the model.frame.default function.  This probably relates to na.delete storing extra information in the "na.action" attribute of the returned data frame.
na.delete由于一些细微差别Gls功能model.frame.default功能将无法正常工作。这可能涉及到na.delete"na.action"属性返回的数据框存储额外的信息。


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

an object of classes Gls, rms, and gls representing the linear model fit. Generic functions such as print, plot, and  summary have methods to show the results of the fit. See glsObject for the components of the fit. The functions resid, coef, and fitted can be used to extract some of its components.  Gls returns the following components not returned by gls: Design, assign, formula, opmeth (see arguments), B (see arguments), bootCoef (matrix of B bootstrapped coefficients), boot.Corr (vector of bootstrapped correlation parameters), Nboot (vector of total sample size used in each bootstrap (may vary if have unbalanced clusters), and var (sample variance-covariance matrix of bootstrapped coefficients).  The g-index is also stored in the returned object under the name "g".
类对象Gls,rms和gls的线性模型拟合。通用功能,如print,plot和summary方法来显示结果的契合。见glsObject拟合组件。的功能resid,coef和fitted可用于提取它的一些组件。 Gls返回以下组件返回gls:Design,assign,formula,opmeth(参数),B (参数),bootCoef(B的自举系数矩阵),boot.Corr(矢量相关参数的自举),Nboot(矢量的总样本量在每个自举(可能会有所不同,如果有不均衡的聚类),var(样本方差 - 协方差矩阵的自举系数)。g索引也存储在返回的对象下的名称"g" 。


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


Jose Pinheiro,
Douglas Bates <a href="mailto:bates@stat.wisc.edu">bates@stat.wisc.edu</a>,
Frank Harrell <a href="mailto:f.harrell@vanderbilt.edu">f.harrell@vanderbilt.edu</a>,
Patrick Aboyoun




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

York: Springer-Verlag.

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

gls glsControl, glsObject, varFunc, corClasses, varClasses, GiniMd, prModFit
glsglsControl,glsObject,varFunc,corClasses,varClasses,GiniMd,prModFit


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


## Not run: [#不运行:]
ns  &lt;- 20  # no. subjects[没有。主题]
nt  &lt;- 10  # no. time points/subject[没有。时间点/主题]
B   &lt;- 10  # no. bootstrap resamples[没有。引导重采样]
           # usually do 100 for variances, 1000 for nonparametric CLs[通常做100的差异,非参数CLS 1000]
rho &lt;- .5  # AR(1) correlation parameter[AR(1)的相关参数]
V <- matrix(0, nrow=nt, ncol=nt)
V &lt;- rho^abs(row(V)-col(V))   # per-subject correlation/covariance matrix[每个主题相关/协方差矩阵]

d <- expand.grid(tim=1:nt, id=1:ns)
d$trt <- factor(ifelse(d$id <= ns/2, 'a', 'b'))
true.beta <- c(Intercept=0,tim=.1,'tim^2'=0,'trt=b'=1)
d$ey  <- true.beta['Intercept'] + true.beta['tim']*d$tim +
  true.beta['tim^2']*(d$tim^2) +  true.beta['trt=b']*(d$trt=='b')
set.seed(13)
library(MASS)   # needed for mvrnorm[需要mvrnorm]
d$y <- d$ey + as.vector(t(mvrnorm(n=ns, mu=rep(0,nt), Sigma=V)))

dd <- datadist(d); options(datadist='dd')
f <- Gls(y ~ pol(tim,2) + trt, correlation=corCAR1(form= ~tim | id),
         data=d, B=B)
f
f$var      # bootstrap variances[引导差异]
f$varBeta  # original variances[原差异]
summary(f)
anova(f)
plot(Predict(f, tim, trt))
# v &lt;- Variogram(f, form=~tim|id, data=d)[V < - 变异函数(F,=~添ID,数据= D)]
nlme:::summary.gls(f)$tTable   # print matrix of estimates etc.[打印矩阵的估计等]

options(datadist=NULL)

## End(Not run)[#(不执行)]

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


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

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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