sbconf(scaleboot)
sbconf()所属R语言包:scaleboot
Bootstrap Confidence Intervals
Bootstrap置信区间
译者:生物统计家园网 机器人LoveR
描述----------Description----------
A confidence interval for a scalar parameter is obtained by inverting the approximately unbiased p-value. This function is very slow, and it is currently experimental.
一个标量参数的置信区间是通过反相约公正的p值。这个功能是非常缓慢的,它是目前处于试验阶段。
用法----------Usage----------
sbconf(x, ...)
## Default S3 method:[默认方法]
sbconf(x,sa, probs=c(0.05,0.95), model="poly.2",
k=2,s=1,sp=-1, cluster=NULL,...)
## S3 method for class 'sbconf':
sbconf(x, probs=x$probs,model=x$model,
k=x$k,s=x$s,sp=x$sp, nofit=FALSE, ...)
## S3 method for class 'sbconf':
plot(x,model=x$model,k=x$k,s=x$s,sp=x$sp,
models = attr(x$fits,"models"), log.xy = "",
xlab="test statistic",ylab=NULL, type.plot = c("p","l","b"),
yval=c("aic","zvalue","pvalue"), sd=2,add=FALSE, col=1:6,
pch=NULL,lty=1:5,lwd=par("lwd"), mk.col=col[1],
mk.lwd=lwd[1], mk.lty=lty[1], ...)
参数----------Arguments----------
参数:x
an object used to select a method. For sbconf.default, x is a list vector of size length{sa} with each element being a vector of bootstrap replicates of a statistic or a list vector of a scalar component.
使用的对象选择方法。对于sbconf.default,x是一个矢量的大小length{sa}的每个元素是一个向量,引导复制的统计或列表的标量向量。
参数:...
further arguments passed to or from other methods.
进一步的参数传递给其他方法。
参数:sa
vector of scales in sigma squared (σ^2).
向量的尺度sigma平方(σ^2“)。
参数:probs
a vector of probabilities at which p-values are inverted.
p-值被反转的概率的向量。
参数:model
a character to specify a model for an AU p-value. This should be included in sboptions("models"), for which model fitting is made internally.
一个字符指定一个模型的AU p值。这应包括在sboptions("models"),内部模型拟合。
参数:k
a numeric to specify an order of AU p-value.
一个数字,以指定的顺序AU p值。
参数:s
σ_0^2
σ_0^2
参数:sp
σ_p^2
σ_p^2
参数:cluster
snow cluster object which may be generated by function makeCluster.
snow的聚类对象可能产生的功能makeCluster。
参数:nofit
logical. No further calls to sbfit are made.
逻辑。没有进一步的调用sbfit。
参数:models
AIC values are plotted for these models.
这些模型的AIC值绘制。
参数:log.xy
character string to be passed to plot.default.
个字符的字符串传递给plot.default。
参数:xlab
a label for the x axis.
为x轴的标签。
参数:ylab
a label for the y axis.
为y轴的标签。
参数:type.plot
a character to be passed to plot.default.
要传递给plot.default字符。
参数:yval
determines y-axis. "aic" for AIC values of models, "zvalue" for AU corrected z-values, and "pvalue" for AU corrected p-values.
确定y轴。 AIC值的模型,“Z值为”AU“AIC”纠正z值,“P值”AU校正P值。
参数:sd
If positive, draws curves +-sd*standard error for z-values and p-values.
如果是正数,绘制曲线+-SD * z值和p值的标准误差。
参数:add
logical. Should not the frame be drawn?
逻辑。如果不是框架划分?
参数:col
vector of colors of plots.
向量的颜色图。
参数:pch
vector of pch's of plots.
向量的PCH的图。
参数:lty
vector of lty's of plots.
LTY向量的图。
参数:lwd
numeric of lwd of plots.
图随钻测井数字。
参数:mk.col
color for crosses drawn at probs.
颜色绘制probs的叉乘。
参数:mk.lwd
lwd for crosses drawn at probs.
LWD叉乘绘制probs。
参数:mk.lty
lty for crosses drawn at probs.
LTY叉乘绘制probs。
Details
详细信息----------Details----------
Let x[[i]] be a vector of bootstrap replicates for a statistic with scale sa[i]. For a threshold value y, the bootstrap probability is bp[i]=sum(x[[i]]<y)/length(x[[i]]). sbconf computes bp for several y values, and finds a value y at which the AU p-value, given by sbfit, equals a probability value specified in probs. In this manner, AU p-values are inverted to obtain bootstrap confidence intervals.
让我们x[[i]]是一个向量,引导规模sa[i]重复统计。阈值y,引导概率是bp[i]=sum(x[[i]]<y)/length(x[[i]])。 sbconf计算bp几个y值,和发现的值y在非盟P-值给出的sbfit,等于指定的概率值在probs。以这种方式,AU p-值被反转,得到自举置信区间。
See the examples below for details.
的详细信息,请参阅下面的例子。
值----------Value----------
sbconf method returns an object of class "sbconf".
sbconf方法返回一个对象类"sbconf"。
The print method for an object of class "sbconf" prints the confidence intervals.
print一个对象的类"sbconf"的方法打印的置信区间。
(作者)----------Author(s)----------
Hidetoshi Shimodaira
参见----------See Also----------
scaleboot.
scaleboot。
实例----------Examples----------
## Not run: [#不运行:]
## An example to calculate confidence intervals[#一个例子来计算置信区间]
## The test statistic is that for "t4" in data(mam15)[#检验统计量是“T4”(mam15)]
## In the following, we used 40 cpu's.[#在下面,我们用40 CPU。]
##[#]
library(snow)
library(scaleboot)
cl <- makeCluster(40)
data(mam15)
## Definition of a test statistic of interest.[#定义的检验统计量的兴趣。]
## "myfun" returns the maximum difference of log-likelihood value[“myfun”返回的最大差值对数似然值]
## for a tree named a.[#为树命名的。]
myfun <- function(x,w,a) maxdif(wsumrow(x,w))[[a]]
maxdif <- function(x) {
i1 <- which.max(x) # the largest element[最大的元素]
x <- -x + x[i1]
x[i1] <- -min(x[-i1]) # the second largest value[第二大值]
x
}
wsumrow <- function(x,w) {
apply(w*x,2,sum)*nrow(x)/sum(w)
}
clusterExport(cl,c("maxdif","wsumrow"))
## multiscale bootstrap parameters[#多尺度引导参数]
nb <- 10000
sa <- 10^seq(-2,2,length=13)
## Compute multiscale bootstrap replicates[#计算多尺度引导复制]
## (It took 80 secs using 40 cpu's)[#(我花了80秒40 CPU的)]
sim <- scaleboot(mam15.mt,nb,sa,myfun,"t4",count=FALSE,
cluster=cl,onlyboot=TRUE,
names.hp=na,nofit=nofit,models=models)
## Modify option "probs0" to a fine grid with 400 points[#修改选项“probs0”的细网格,与400点]
## default: 0.001 0.010 0.100 0.900 0.990 0.999[#默认值:0.001 0.010 0.100 0.900 0.990 0.999]
## NOTE: This modification is useful only when cl != NULL,[注:此修改是很有用的,只有当CL = NULL,]
## in which case calls to sbfit for the grid points[#在这种情况下,调用以sbfit网格点]
## are made in parallel, although iterations seen later[#平行,虽然购买看到的迭代]
## are made sequentially.[#顺序。]
sboptions("probs0",pnorm(seq(qnorm(0.001),qnorm(0.999),length=400)))
## Calculate bootstrap confidence intervals using "k.1" p-value.[#计算引导使用“K.1”p值的置信区间。]
## (It took 70 secs using 40 cpu's)[(花了70秒,使用40个CPU的)]
## First, sbfit is applied to bp's determined by option "probs0"[#首先,sbfit应用于到BP的确定选项“probs0”]
## Then, additional fitting is made only twice for iteration.[#然后,额外的配件只有两次迭代。]
## p[1]=0.05 iter=1 t=4.342723 e=0.0003473446 r=0.0301812[#P [1] = 0.05 ITER = 1 T = 4.342723 = 0.0003473446 R = 0.0301812]
## p[2]=0.95 iter=1 t=42.76558 e=0.002572495 r=0.1896809[#p [2] = 0.95 ITER = 1 T = 42.76558 E = 0.002572495 R = 0.1896809]
conf1 <- sbconf(sim$stat,sim$sa,model="sing.3",k=1,cluster=cl)
## The confidence interval with "k.1" is printed as[#“K.1”打印的置信区间]
## 0.05 0.95 [#0.05 0.95]
## 4.342723 42.765582 [#4.342723 42.765582]
conf1
## Calculate bootstrap confidence intervals[#计算自举置信区间]
## using "k.2" and "k.3" p-values.[#使用“K.2”和“K.3”p-值。]
## (It took only 10 secs)[#(只用了10秒)]
## p[1]=0.05 iter=1 t=-2.974480 e=0.003729190 r=0.04725755[#P [1] = 0.05 ITER = 1 T = -2.974480 E = 0.003729190 R = 0.04725755]
## p[2]=0.95 iter=1 t=39.51767 e=0.001030929 r=0.06141937[#p [2] = 0.95 ITER = 1 T = 39.51767 E = 0.001030929 R = 0.06141937]
## 0.05 0.95 [#0.05 0.95]
## -2.974480 39.517671 [#-2.974480 39.517671]
conf2 <- sbconf(conf1,model="sing.3",k=2)
conf2
## p[1]=0.05 iter=1 t=-3.810157 e=0.01068678 r=0.08793868[#P [1] = 0.05 ITER = 1 T = -3.810157 E = 0.01068678 R = 0.08793868]
## p[2]=0.95 iter=1 t=39.32669 e=0.001711107 r=0.09464663[#p [2] = 0.95 ITER = 1 T = 39.32669 E = 0.001711107 R = 0.09464663]
## 0.05 0.95 [#0.05 0.95]
## -3.810157 39.326686 [#-3.810157 39.326686]
conf3 <- sbconf(conf2,model="sing.3",k=3)
conf3
## plot diagnostics[#图诊断]
plot(conf3) # AIC values for models v.s. test statistic value[模型的AIC值V.S.检验统计量的值]
plot(conf3,yval="zval",type="l") # corrected "k.3" z-value[纠正“K.3”Z-值]
stopCluster(cl)
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|