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

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

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

                                        Bootstrap Covariance and Distribution for Regression Coefficients
                                         引导协方差和回归系数的分布

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

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

bootcov computes a bootstrap estimate of the covariance matrix for a set of regression coefficients from ols, lrm, cph, psm, Rq, and any other fit where x=TRUE, y=TRUE was used to store the data used in making the original regression fit and where an appropriate fitter function is provided here.  The estimates obtained are not conditional on the design matrix, but are instead unconditional estimates.  For small sample sizes, this will make a difference as the unconditional variance estimates are larger.  This function will also obtain bootstrap estimates corrected for cluster sampling (intra-cluster correlations) when a "working independence" model was used to fit data which were correlated within clusters.  This is done by substituting cluster sampling with replacement for the usual simple sampling with replacement.  bootcov has an option (coef.reps) that causes all of the regression coefficient estimates from all of the bootstrap re-samples to be saved, facilitating computation of nonparametric bootstrap confidence limits and plotting of the distributions of the coefficient estimates (using histograms and kernel smoothing estimates).
bootcov计算自举一组ols,lrm,cph,psm,Rq的回归系数估计的协方差矩阵,其中x=TRUE, y=TRUE被用来存储在原始回归拟合和所使用的数据和任何其他合适的一个适当的fitter函数这里提供的。所得到的估计数的设计矩阵,但没有条件,而不是无条件的估计。对于小的样本量,这将使一个差异,无条件方差的估计是较大的。此功能也将得到更正整群抽样(聚类内的相关性)时,“台独”的模型来拟合数据聚类内的相关的bootstrap估计。这是代更换整群抽样的一贯的简单抽样更换。 bootcov有一个选项(coef.reps),导致所有的回归系数的估计,从所有样本保存的引导,促进非参数引导的置信区间的计算和绘制的分布系数估计(使用直方图和核平滑估计),。

The loglik option facilitates the calculation of simultaneous confidence regions from quantities of interest that are functions of the regression coefficients, using the method of Tibshirani(1996). With Tibshirani's method, one computes the objective criterion (-2 log likelihood evaluated at the bootstrap estimate of beta but with respect to the original design matrix and response vector) for the original fit as well as for all of the bootstrap fits.  The confidence set of the regression coefficients is the set of all coefficients that are associated with objective function values that are less than or equal to say the 0.95 quantile of the vector of B + 1 objective function values.  For the coefficients satisfying this condition, predicted values are computed at a user-specified design matrix X, and minima and maxima of these predicted values (over the qualifying bootstrap repetitions) are computed to derive the final simultaneous confidence band.
loglik选项简化了同时从大量的利益,功能的回归系数的置信区间的计算,使用Tibshirani(1996)的方法。 Tibshirani的方法,一个计算的客观标准(-2对数似然评价在自举估计beta,但相对于原来的设计矩阵和响应矢量)以及为所有的自举适合原始适合。的信心的回归系数设置的一组相关联的所有系数,与目标函数的值是小于或等于说B + 1的目标函数值的矢量的0.95分位数。对于满足该条件的系数,预测值的计算在用户指定的设计矩阵X,和最小值和最大值,这些预测值(在合格的自举重复)计算以得出最终同步置信带。

The bootplot function takes the output of bootcov and  either plots a histogram and kernel density estimate of specified regression coefficients (or linear combinations of them through the use of a specified design matrix X), or a qqnorm plot of the quantities of interest to check for normality of the maximum likelihood estimates.  bootplot draws vertical lines at specified quantiles of the bootstrap distribution, and returns these quantiles for possible printing by the user.  Bootstrap estimates may optionally be transformed by a user-specified function fun before plotting.
bootplot功能的输出bootcov,要么绘制直方图和指定的回归系数(或它们的线性组合,通过使用指定的设计矩阵X),内核密度估计的或qqnorm图感兴趣的量,以检查正常的最大似然估计。 bootplot画垂直线自举分布在指定的位数,并返回由用户可能发生的打印这些分位数。 bootstrap估计可以选择转换由用户指定的功能fun之前绘制。

The confplot function also uses the output of bootcov but to compute and optionally plot nonparametric bootstrap pointwise confidence limits or (by default) Tibshirani (1996) simultaneous confidence sets. A design matrix must be specified to allow confplot to compute quantities of interest such as predicted values across a range of values or differences in predicted values (plots of effects of changing one or more predictor variable values).
confplot功能也使用的输出作为bootcov,但计算和有选择地引导逐点绘制非参数的置信区间(默认情况下)Tibshirani(1996)同时区间。的设计矩阵必须指定允许confplot计算数量的景点,如在一个范围内的值或预测值的差异(图改变一个或多个预测变量的值的影响)的预测值。

bootplot and confplot are actually generic functions, with the particular functions bootplot.bootcov and confplot.bootcov automatically invoked for bootcov objects.
bootplot和confplot实际上是通用的功能,具有特定的功能bootplot.bootcov和confplot.bootcovbootcov对象自动被调用。

A service function called histdensity is also provided (for use with bootplot).  It runs hist and density on the same plot, using twice the number of classes than the default for hist, and 1.5 times the width than the default used by density.
称为histdensity服务功能还提供了(使用bootplot)。它运行hist和density了相同的图,两次使用的类的数量比默认情况下,hist,和1.5倍width比默认使用density。

A comprehensive example demonstrates the use of all of the functions.
一个完整的例子演示了如何使用所有的功能。


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


bootcov(fit, cluster, B=200, fitter,
        coef.reps=FALSE, loglik=coef.reps,
        pr=FALSE, maxit=15, group, stat=NULL)


bootplot(obj, which, X,
         conf.int=c(.9,.95,.99),
         what=c('density','qqnorm'),
         fun=function(x)x, labels., ...)


confplot(obj, X, against,
         method=c('simultaneous','pointwise'),
         conf.int=0.95, fun=function(x)x,
         add=FALSE, lty.conf=2, ...)


histdensity(y, xlab, nclass, width, mult.width=1, ...)



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

参数:fit
a fit object containing components x and y.  For fits from cph, the "strata" attribute of the x component is used to obtain the vector of stratum codes.  
一个合适的对象,其中包含组件x和y。适合从cph,"strata"属性x组件是用来取得的向量层代码。


参数:obj
an object created by bootcov with coef.reps=TRUE.  
创建对象bootcovcoef.reps=TRUE。


参数:X
a design matrix specified to confplot.  See predict.rms or contrast.rms.  For bootplot, X is optional.  
一个设计矩阵指定的confplot。见predict.rms或contrast.rms。对于bootplot,X是可选的。


参数:y
a vector to pass to histdensity.  NAs are ignored.  
一个向量,通过histdensity。 NA的将被忽略。


参数:cluster
a variable indicating groupings. cluster may be any type of vector (factor, character, integer). Unique values of cluster indicate possibly correlated groupings of observations. Note the data used in the fit and stored in fit$x and fit$y may have had observations containing missing values deleted.  It is assumed that if there were any NAs, an naresid function exists for the class of fit. This function restores NAs so that the rows of the design matrix coincide with cluster.  
一个变量,表示分组。 cluster可以是任何类型的向量(因子,字符,整数)。独特的价值观cluster表示可能相关的观测分组。请注意适合使用的数据,并存储在fit$x和fit$y观察可能有遗漏值的删除。据推测,如果有任何NAS,naresid函数存在之类的fit。此功能恢复NAS,这样的设计矩阵的行与cluster。


参数:B
number of bootstrap repetitions.  Default is 200.  
引导重复数。默认为200。


参数:fitter
the name of a function with arguments (x,y) that will fit bootstrap samples.  Default is taken from the class of fit if it is ols, lrm, cph, psm, Rq.  
(x,y),将适合的bootstrap样本的函数,参数的名称。默认之类的fit如果是ols,lrm,cph,psm,Rq。


参数:coef.reps
set to TRUE if you want to store a matrix of all bootstrap regression coefficient estimates in the returned component boot.Coef.  For models set loglik=FALSE to get coef.reps=TRUE to work.  
设置为TRUE如果你想存储一个矩阵的所有引导回归系数估计在返回的组成部分boot.Coef。对于models设置loglik=FALSEcoef.reps=TRUE工作。


参数:loglik
set to TRUE to store -2 log likelihoods for each bootstrap model, evaluated against the original x and y data.  The default is to do this when coef.reps is specified as TRUE.  The use of loglik=TRUE assumes that an oos.loglik method exists for the type of model being analyzed, to calculate out-of-sample -2 log likelihoods (see rmsMisc). After the B -2 log likelihoods (stored in the element named boot.loglik in the returned fit object), the B+1 element is the -2 log likelihood for the original model fit.  
设置为TRUE存储-2对数似然为每个引导模式,对原x和y数据进行评估。默认情况下是这样做时,coef.reps被指定为TRUE。的使用loglik=TRUE的假设一个oos.loglik方法存在的类型的模型分析,计算样本-2对数似然(见rmsMisc)。后B-2对数似然(存储在命名的元素boot.loglik在返回合适的对象),B+1元素是-2对数似然的原始模型的拟合。


参数:pr
set to TRUE to print the current sample number to monitor progress.  
设置为TRUE打印当前的样本数,以监测进展情况。


参数:maxit
maximum number of iterations, to pass to fitter  
最大迭代次数,传递fitter的


参数:group
a grouping variable used to stratify the sample upon bootstrapping. This allows one to handle k-sample problems, i.e., each bootstrap sample will be forced to select the same number of observations from each level of group as the number appearing in the original dataset. You may specify both group and cluster.  
一组变量用于,分层样本后的引导。这允许一个处理K-样本问题,即,每个引导样本将被迫选择相同数目的观测值出现在原始数据集的数量从每个级别组。您可以指定两个group和cluster。


参数:stat
a single character string specifying the name of a stats element produced by the fitting function to save over the bootstrap repetitions.  The vector of saved statistics will be in the boot.stats part of the list returned by bootcov.  
一个字符串,指定名称的stats元素所产生的拟合函数保存在引导重复。保存的统计信息的向量,将在boot.stats的bootcov返回的列表。


参数:which
one or more integers specifying which regression coefficients to plot for bootplot  
指定一个或多个整数的回归系数的图bootplot


参数:conf.int
a vector (for bootplot, default is c(.9,.95,.99)) or scalar  (for confplot, default is .95) confidence level.  
一个矢量(用来bootplot,默认情况下是c(.9,.95,.99))或标量(confplot,默认是.95)置信水平。


参数:what
for bootplot, specifies whether a density or a q-q plot is made  
bootplot,指定是否是由一个密度或QQ图


参数:fun
for bootplot or confplot specifies a function used to translate the quantities of interest before analysis.  A common choice is fun=exp to compute anti-logs, e.g., odds ratios.  
bootplot或confplot指定一个函数,用于翻译的数量之前分析的兴趣。一个常见的选择是fun=exp来计算反log,例如,比值比。


参数:labels.
a vector of labels for labeling the axes in plots produced by bootplot. Default is row names of X if there are any, or sequential integers.  
一个矢量标记轴的图产生的bootplot的标签。默认是行名称X如果有的话,或连续整数。


参数:...
For bootplot these are optional arguments passed to histdensity.  Also may be optional arguments passed to plot by confplot or optional arguments passed to hist from histdensity, such as xlim and breaks.  The argument probability=TRUE is always passed to hist.  
对于bootplot这些都是可选的参数传递给histdensity。也可能是可选参数传递给plotconfplot或可选参数传递给hist histdensity,如xlim和breaks。参数probability=TRUE总是传递给hist。


参数:against
For confplot, specifying against causes a plot to be made (or added to). The against variable is associated with rows of X and is used as the x-coordinates.  
对于confplot,against导致的图进行(或增加)。 against变量相关联与行X和被用作的x坐标。


参数:method
specifies whether "pointwise" or "simultaneous" confidence regions are derived by confplot.  The default is simultaneous.  
指定是否"pointwise"或"simultaneous"信心区域取得的confplot。默认为同声传译,我们可以在听广播或看电视或开会时。


参数:add
set to TRUE to add to an existing plot, for confplot  
设置为TRUE添加到现有的图,confplot


参数:lty.conf
line type for plotting confidence bands in confplot.  Default is 2 for dotted lines.  
在confplot绘制置信区间的线路类型。默认值是2的虚线。


参数:xlab
label for x-axis for histdensity.  Default is label attribute or argument name if there is no label.  
标签为x轴histdensity。默认值是如果有没有label,label属性或参数名称。


参数:nclass
passed to hist if present  
通过hist如果存在


参数:width
passed to density if present  
通过density如果存在


参数:mult.width
multiplier by which to adjust the default width passed to density. Default is 1.  
调整默认的乘数width传递给density。默认值是1。


Details

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

If the fit has a scale parameter (e.g., a fit from psm), the log of the individual bootstrap scale estimates are added to the vector of parameter estimates and and column and row for the log scale are added to the new covariance matrix (the old covariance matrix also has this row and column).
如果合适的尺度参数(例如,从一个合适的psm),个别引导规模估计的log中添加参数估计值的矢量和的log规模的行和列被添加到新的协方差矩阵(旧的协方差矩阵,也有这样的行和列)。

For Rq fits, the tau, method, and hs arguments are taken from the original fit.
Rq千篇一律,tau,method和hs参数从原来的配合。


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

a new fit object with class of the original object and with the element orig.var added. orig.var is the covariance matrix of the original fit.  Also, the original var component is replaced with the new bootstrap estimates.  The component boot.coef is also added.  This contains the mean bootstrap estimates of regression coefficients (with a log scale element added if applicable).  boot.Coef is added if coef.reps=TRUE. boot.loglik is added if loglik=TRUE.  If stat is specified an additional vector boot.stats will be contained in the returned object.  B contains the number of successfully fitted bootstrap resamples.
一个新的合适的对象,原来的对象和类元素orig.var。 orig.var是原来的合适的协方差矩阵。此外,原始var组件被替换为新的bootstrap估计。组件boot.coef也增加了。这包含均值的bootstrap估计回归系数(用对数刻度添加的元素(如适用))。 boot.Coef如果coef.reps=TRUE。 boot.loglik如果loglik=TRUE。如果stat指定一个额外的向量boot.stats将被包含在返回的对象。 B包含了一些成功合身的引导重新采样。

bootplot returns a (possible matrix) of quantities of interest and the requested quantiles of them.  confplot returns three vectors: fitted, lower, and upper.
bootplot返回一个(尽可能矩阵)利益的数量和他们所要求的位数。 confplot返回三个向量:fitted,lower和upper。


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

bootcov prints if pr=TRUE
bootcov如果pr=TRUE打印


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



Frank Harrell<br>
Department of Biostatistics<br>
Vanderbilt University<br>
<a href="mailto:f.harrell@vanderbilt.edu">f.harrell@vanderbilt.edu</a><br>

Bill Pikounis<br>
Biometrics Research Department<br>
Merck Research Laboratories<br>
<a href="mailto:v\_bill\_pikounis@merck.com">v\_bill\_pikounis@merck.com</a>




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

clustered data analysis with Gaussian error.  Stat in Med 15:1793&ndash;1806.
"bumping". Department of Statistics, University of Toronto.  Technical report available from <br> http://www-stat.stanford.edu/~tibs/. Presented at the Joint Statistical Meetings, Chicago, August 1996.

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

robcov, sample, rms, lm.fit, lrm.fit, survival-internal,  predab.resample, rmsMisc, Predict, gendata,  contrast.rms, Predict
robcov,sample,rms,lm.fit,lrm.fit,survival-internal,predab.resample,rmsMisc,Predict,gendata,contrast.rms,Predict


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


set.seed(191)
x <- exp(rnorm(200))
logit <- 1 + x/2
y <- ifelse(runif(200) <= plogis(logit), 1, 0)
f <- lrm(y ~ pol(x,2), x=TRUE, y=TRUE)
g <- bootcov(f, B=50, pr=TRUE, coef.reps=TRUE)
anova(g)    # using bootstrap covariance estimates[使用自举协方差估计]
fastbw(g)   # using bootstrap covariance estimates[使用自举协方差估计]
beta <- g$boot.Coef[,1]
hist(beta, nclass=15)     #look at normality of parameter estimates[在正常的参数估计]
qqnorm(beta)
# bootplot would be better than these last two commands[bootplot会比最后两个命令]


# A dataset contains a variable number of observations per subject,[数据集包含可变数目每科的观察,]
# and all observations are laid out in separate rows. The responses[所有观测值都制定了不同的行。的反应]
# represent whether or not a given segment of the coronary arteries[表示是否一个给定的段的冠状动脉]
# is occluded. Segments of arteries may not operate independently[是闭塞。动脉段可能无法独立运作]
# in the same patient.  We assume a "working independence model" to[在同一个病人。我们假设的“独立模式”]
# get estimates of the coefficients, i.e., that estimates assuming[估计的系数,即估计假设]
# independence are reasonably efficient.  The job is then to get[独立是合理有效的。然后,工作是得到]
# unbiased estimates of variances and covariances of these estimates.[这些估算的方差和协方差的无偏估计。]


set.seed(2)
n.subjects <- 30
ages <- rnorm(n.subjects, 50, 15)
sexes  <- factor(sample(c('female','male'), n.subjects, TRUE))
logit <- (ages-50)/5
prob &lt;- plogis(logit)  # true prob not related to sex[真正的概率不相关性]
id &lt;- sample(1:n.subjects, 300, TRUE) # subjects sampled multiple times[科目多次采样]
table(table(id))  # frequencies of number of obs/subject[频率的OB /主题]
age <- ages[id]
sex <- sexes[id]
# In truth, observations within subject are independent:[事实上,观测的主体是独立的:]
y   <- ifelse(runif(300) <= prob[id], 1, 0)
f <- lrm(y ~ lsp(age,50)*sex, x=TRUE, y=TRUE)
g &lt;- bootcov(f, id, B=50)  # usually do B=200 or more[通常做B = 200或以上]
diag(g$var)/diag(f$var)
# add ,group=w to re-sample from within each level of w[添加,基团= w来重新采样从瓦特每一级内]
anova(g)            # cluster-adjusted Wald statistics[聚类调整的Wald统计量]
# fastbw(g)         # cluster-adjusted backward elimination[fastbw(G)聚类调整淘汰落后]
plot(Predict(g, age=30:70, sex='female'))  # cluster-adjusted confidence bands[聚类调整后的置信区间]


# Get design effects based on inflation of the variances when compared[基于对通胀的差异相比,获取的设计效果]
# with bootstrap estimates which ignore clustering[而忽视聚类的bootstrap估计]
g2 <- bootcov(f, B=50)
diag(g$var)/diag(g2$var)


# Get design effects based on pooled tests of factors in model[汇集因素模型试验的基础上设计效果]
anova(g2)[,1] / anova(g)[,1]


# Simulate binary data where there is a strong [那里是一个强大的模拟二进制数据]
# age x sex interaction with linear age effects [年龄的X性作用与线性年龄的影响]
# for both sexes, but where not knowing that[不论男女,但不知道]
# we fit a quadratic model.  Use the bootstrap[符合二次模型。使用自举]
# to get bootstrap distributions of various[引导分布的各种]
# effects, and to get pointwise and simultaneous[影响,并逐点和同时]
# confidence limits[置信限]


set.seed(71)
n   <- 500
age <- rnorm(n, 50, 10)
sex <- factor(sample(c('female','male'), n, rep=TRUE))
L   <- ifelse(sex=='male', 0, .1*(age-50))
y   <- ifelse(runif(n)<=plogis(L), 1, 0)


f <- lrm(y ~ sex*pol(age,2), x=TRUE, y=TRUE)
b &lt;- bootcov(f, B=50, coef.reps=TRUE, pr=TRUE)   # better: B=500[好:B = 500]


par(mfrow=c(2,3))
# Assess normality of regression estimates[评估常态的回归估计]
bootplot(b, which=1:6, what='qq')
# They appear somewhat non-normal[他们似乎有点不正常]


# Plot histograms and estimated densities [绘制直方图和估计密度]
# for 6 coefficients[6系数]
w <- bootplot(b, which=1:6)
# Print bootstrap quantiles[打印引导位数]
w$quantiles


# Estimate regression function for females[估计回归函数为女性]
# for a sequence of ages[为一个序列的年龄]
ages <- seq(25, 75, length=100)
label(ages) <- 'Age'


# Plot fitted function and pointwise normal-[图拟合函数和逐点正常]
# theory confidence bands[理论置信区间]
par(mfrow=c(1,1))
p <- Predict(f, age=ages, sex='female')
plot(p)
# Save curve coordinates for later automatic[后自动保存曲线坐标系]
# labeling using labcurve in the Hmisc library[标签使用labcurve在Hmisc库]
curves <- vector('list',8)
curves[[1]] <- with(p, list(x=age, y=lower))
curves[[2]] <- with(p, list(x=age, y=upper))


# Add pointwise normal-distribution confidence [逐点正常分布信心的]
# bands using unconditional variance-covariance[乐队使用无条件方差 - 协方差]
# matrix from the 500 bootstrap reps[矩阵从500引导代表]
p <- Predict(b, age=ages, sex='female')
curves[[3]] <- with(p, list(x=age, y=lower))
curves[[4]] <- with(p, list(x=age, y=upper))


dframe <- expand.grid(sex='female', age=ages)
X &lt;- predict(f, dframe, type='x')  # Full design matrix[全面的设计矩阵]


# Add pointwise bootstrap nonparametric [逐点引导非参数]
# confidence limits[置信限]
p <- confplot(b, X=X, against=ages, method='pointwise',
              add=TRUE, lty.conf=4)
curves[[5]] <- list(x=ages, y=p$lower)
curves[[6]] <- list(x=ages, y=p$upper)


# Add simultaneous bootstrap confidence band[同时引导置信带]
p <- confplot(b, X=X, against=ages, add=TRUE, lty.conf=5)
curves[[7]] <- list(x=ages, y=p$lower)
curves[[8]] <- list(x=ages, y=p$upper)
lab <- c('a','a','b','b','c','c','d','d')
labcurve(curves, lab, pl=TRUE)


# Now get bootstrap simultaneous confidence set for[现在得到引导的同时置信集]
# female:male odds ratios for a variety of ages[各种年龄的女性与男性的比值比]


dframe <- expand.grid(age=ages, sex=c('female','male'))
X &lt;- predict(f, dframe, type='x')  # design matrix[设计矩阵]
f.minus.m <- X[1:100,] - X[101:200,]
# First 100 rows are for females.  By subtracting[前100行是为女性。减去]
# design matrices are able to get Xf*Beta - Xm*Beta[设计矩阵可以得到XF *β -  XM * Beta版]
# = (Xf - Xm)*Beta[=(XF  -  XM)* Beta版]


confplot(b, X=f.minus.m, against=ages,
         method='pointwise', ylab='F:M Log Odds Ratio')
confplot(b, X=f.minus.m, against=ages,
         lty.conf=3, add=TRUE)


# contrast.rms makes it easier to compute the design matrix for use[contrast.rms使得它更容易使用的矩阵计算的设计]
# in bootstrapping contrasts:[在自举反差:]


f.minus.m <- contrast(f, list(sex='female',age=ages),
                         list(sex='male',  age=ages))$X
confplot(b, X=f.minus.m)


# For a quadratic binary logistic regression model use bootstrap[对于二次二分类Logistic回归模型使用引导]
# bumping to estimate coefficients under a monotonicity constraint[碰撞的单调性约束下估计系数]
set.seed(177)
n <- 400
x <- runif(n)
logit <- 3*(x^2-1)
y <- rbinom(n, size=1, prob=plogis(logit))
f <- lrm(y ~ pol(x,2), x=TRUE, y=TRUE)
k <- coef(f)
k
vertex <- -k[2]/(2*k[3])
vertex


# Outside [0,1] so fit satisfies monotonicity constraint within[外[0,1],所以适合满足单调性约束内]
# x in [0,1], i.e., original fit is the constrained MLE[x在[0,1],即原始适合的约束MLE]


g <- bootcov(f, B=50, coef.reps=TRUE)
bootcoef &lt;- g$boot.Coef    # 100x3 matrix[100x3矩阵]
vertex <- -bootcoef[,2]/(2*bootcoef[,3])
table(cut2(vertex, c(0,1)))
mono <- !(vertex >= 0 &amp; vertex <= 1)
mean(mono)    # estimate of Prob{monotonicity in [0,1]}[PROB {单调的估计值在[0,1]}]


var(bootcoef)   # var-cov matrix for unconstrained estimates[无约束估计的VAR-CoV的矩阵]
var(bootcoef[mono,])   # for constrained estimates[约束估计]


# Find second-best vector of coefficient estimates, i.e., best[第二个最好的系数估计值,即最佳向量]
# from among bootstrap estimates[从bootstrap估计]
g$boot.Coef[order(g$boot.loglik[-length(g$boot.loglik)])[1],]
# Note closeness to MLE[注意贴近MLE]

## Not run: [#不运行:]
# Get the bootstrap distribution of the difference in two ROC areas for[获取自举两个ROC面积的差异分布]
# two binary logistic models fitted on the same dataset.  This analysis[二分类Logistic模型安装在相同的数据集。这种分析]
# does not adjust for the bias ROC area (C-index) due to overfitting.[不调整的偏置号区(C指数)由于过度拟合。]
# The same random number seed is used in two runs to enforce pairing.[使用相同的随机数种子在两奔跑执行配对。]

set.seed(17)
x1 <- rnorm(100)
x2 <- rnorm(100)
y <- sample(0:1, 100, TRUE)
f <- lrm(y ~ x1, x=TRUE, y=TRUE)
g <- lrm(y ~ x1 + x2, x=TRUE, y=TRUE)
set.seed(3)
f <- bootcov(f, stat='C')
set.seed(3)
g <- bootcov(g, stat='C')
dif <- g$boot.stats - f$boot.stats
hist(dif)
quantile(dif, c(.025,.25,.5,.75,.975))
# Compute a z-test statistic.  Note that comparing ROC areas is far less[计算一个z-检验统计量。请注意,比较ROC面积少得多]
# powerful than likelihood or Brier score-based methods[强大的比可能性或蒺藜得分为基础的方法]
z <- (g$stats['C'] - f$stats['C'])/sd(dif)
names(z) <- NULL
c(z=z, P=2*pnorm(-abs(z)))

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

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-24 12:00 , Processed in 0.021447 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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