scaleboot(scaleboot)
scaleboot()所属R语言包:scaleboot
Multiscale Bootstrap Resampling
多尺度引导重采样
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Performs multiscale bootstrap resampling for a specified statistic.
指定的统计数据进行多尺度引导重采样。
用法----------Usage----------
scaleboot(dat,nb,sa,fun,parm=NULL,count=TRUE,weight=TRUE,
cluster=NULL,onlyboot=FALSE,seed=NULL,...)
countw.assmax(x,w,ass)
countw.shtest(x,w,obs)
countw.shtestass(x,w,assobs)
参数----------Arguments----------
参数:dat
data matrix or data-frame. Row vectors are to be resampled.
矩阵数据或数据框。行矢量以进行重新采样。
参数:nb
vector of the numbers of bootstrap replicates.
矢量的自举的数字复制。
参数:sa
vector of scales in sigma squared (σ^2).
向量的尺度sigma平方(σ^2“)。
参数:fun
function for a statistic.
函数的统计。
参数:parm
parameter to be passed to fun above.
参数被传递到fun以上。
参数:count
logical. Should only the accumulative counts be returned? Otherwise, raw statistic vectors are returned.
逻辑。累计计数回来了吗?否则,返回原始统计向量。
参数:weight
logical. In fun above, resampling is specified by a weight vector. Otherwise, resampling is specified by a vector of indices.
逻辑。在fun以上,重采样是所指定的权重向量。否则,重采样指定由一个矢量的索引。
参数:cluster
snow cluster object which may be generated by function makeCluster.
snow的聚类对象可能产生的功能makeCluster。
参数:onlyboot
logical. Should only bootstrap resampling be performed? Otherwise, sbfit or sbconf is called internally.
逻辑。如果只举重采样进行?否则,sbfit或sbconf被称为内部。
参数:seed
If non NULL, random seed is set. Specifying a seed is particularly important when cluster is non NULL, in which case seed + seq(along=cluster) are set to cluster nodes.
如果非NULL,随机种子。指定的种子是特别重要的,当cluster非NULL,在这种情况下,seed + seq(along=cluster)被设置为聚类节点。
参数:...
further arguments passed to and from other methods.
进一步的参数传递给其他方法。
参数:x
data matrix or data-frame passed from scaleboot.
数据矩阵或数据框通过scaleboot。
参数:w
weight vector for resampling.
重采样的权重向量。
参数:ass
a list of association vectors. An example of parm above.
协会向量的列表。 parm上述的一个例子。
参数:obs
a vector of observed test statistics. An example of parm above.
观测到的检验统计量的向量。 parm上述的一个例子。
参数:assobs
a list of ass and obs above. An example of parm above.
一个列表的屁股和obs以上。 parm上述的一个例子。
Details
详细信息----------Details----------
These functions are used internally by relltest.
这些函数内部使用的relltest。
scaleboot performs multiscale bootstrap resampling for a statistic defined by fun, which should be one of the two possible forms fun(x,w,parm) and fun(x,i,parm). The former is used when weight=TRUE, and the weight vector w is generated by a multinomial distribution. The latter is used when weight=FALSE, and the index vector i is generated by resampling n' elements from \{1,...,n\}. When count=TRUE, fun should return a logical, or a vector of logicals.
scaleboot进行多尺度的引导,重采样的统计定义的fun,这应该是两种可能的形式fun(x,w,parm)和fun(x,i,parm)。前者是用来当weight=TRUE,和权重向量w产生由多项式分布。后者是当weight=FALSE,和索引向量i所产生的重采样n'元素\{1,...,n\}。当count=TRUE,fun应该返回一个逻辑,或一个向量,逻辑值。
Examples of fun(x,w,parm) are countw.assmax for AU p-values, countw.shtest for SH-test of trees, and countw.shtestass for SH-test of both trees and edges. The definitions are given below.
的例子fun(x,w,parm)是countw.assmaxAU p值,countw.shtestSH-测试的树木,和countw.shtestassSH-测试的树木和边缘。的定义在下面给出。
<pre> countw.assmax <- function(x,w,ass) { y <- maxdif(wsumrow(x,w)) <= 0 # countw.max if(is.null(ass)) y else { z <- vector("logical",length(ass)) for(i in seq(along=ass)) z[i] <- any(y[ass[[i]]]) z } } countw.shtest <- function(x,w,obs) maxdif(wsumrow(x,w)) >= obs countw.shtestass <- function(x,w,assobs) unlist(assmaxdif(wsumrow(x,w),assobs$ass)) >= assobs$obs ### weighted sum of row vectors ## ## x = matrix (array of row vectors) ## w = weight vector (for rows) ## wsumrow <- function(x,w) { apply(w*x,2,sum)*nrow(x)/sum(w) } ### calc max diff ## ## y[i] := max_{j neq i} x[j] - x[i] ## maxdif <- function(x) { i1 <- which.max(x) # the largest element x <- -x + x[i1] x[i1] <- -min(x[-i1]) # the second largest value x } ### calc assmaxdif ## ## y[[i]][j] := max_{k neq ass[[i]]} x[k] - x[ass[[i]][j]] ## assmaxdif <- function(x,a) { y <- vector("list",length(a)) names(y) <- names(a) for(i in seq(along=a)) y[[i]] <- max(x[-a[[i]]]) - x[a[[i]]] y } </pre>
- 功能<PRE> countw.assmax(X,W,ASS){Y < - maxdif(wsumrow(X,W))<= 0#countw.max(is.null(ASS))Y其他{Z < - 向量(“逻辑”,长度(ASS))(我在SEQ(沿屁股))Z [I] < - 任何(Y [屁股[[]]])Z}} countw shtest < - 函数(X,W,观测值)maxdif(wsumrow(的x,w)的)> =观测countw.shtestass < - 函数(x,瓦特,assobs)不公开(assmaxdif(wsumrow(X,W) assobs $屁股))> = assobs $观测值###行向量的加权总和,####x的=矩阵(阵列的行向量)##瓦特=权重向量(行)##wsumrow < - 功能(X,W){申请(W * X,2,总和)* NROW(X)/的总和(W)}#######同期,计算最大差异[I]:= MAX_ {ĴNEQ我}× [J] - X [我]##maxdif的函数(x)< - {I1 < - which.max(X)的最大元素X < - X + X [I1]×[I1] - 分(X [I1])的第二大值x}###钙assmaxdif####[[i]] [J]:= MAX_ {K NEQ屁股[[i]]}×[ K] - X [屁股[[]] [J] < - ##assmaxdif功能(X,A){Y < - 向量(“名单”,长度(a))的名称(Y)< - 名称(A)(i在SEQ(沿=))Y [[]] < - 马克斯(X-A [[i]]) - ×[一个[[i]] Y} < / pre>
When count=TRUE, the summation of outputs from fun is calculated. This gives the frequencies for how many times the hypotheses are supported by the bootstrap replicates.
当count=TRUE“的总和输出fun计算。这给出了多少次,假设支持由引导复制的频率。
值----------Value----------
If onlyboot=TRUE, then a list of raw results from the multiscale bootstrap resampling is returned. The components are "stat" for list vectors of outputs from fun (only when count=FALSE), "bps" for a matrix of multiscale bootstrap probabilities (only when count=FALSE), "nb" for the number of bootstrap replicates used, and "sa" for the scales used. Note that scales are redefined by sa <- nsize/round(nsize/sa), where nsize is the sample size.
如果onlyboot=TRUE,然后返回的多尺度引导重采样的原始结果的列表。的组成部分是“STAT”,输出列表向量的fun(只有当count=FALSE),“基点”的多尺度引导概率矩阵(只有当count=FALSE),“NB”的自举的数量,并重复使用的“sa”所使用的尺度。需要注意的是尺度重新定义sa <- nsize/round(nsize/sa),nsize是样本大小。
If onlyboot=FALSE, then the result of a call to sbfit is returned when count=TRUE, otherwise the result of sbconf is returned when count=FALSE.
如果onlyboot=FALSE,然后调用sbfit的结果,则返回count=TRUE,否则的结果sbconf时,返回count=FALSE。
(作者)----------Author(s)----------
Hidetoshi Shimodaira
参见----------See Also----------
sbfit, relltest.
sbfit,relltest。
实例----------Examples----------
## Not run: [#不运行:]
## a line from the definition of relltest[#线的定义relltest]
scaleboot(dat,nb,sa,countw.assmax,ass,cluster=cluster,
names.hp=na,nofit=nofit,models=models,seed=seed)
## two lines from rell.shtest (internal function)[#两行rell.shtest(内部功能)]
scaleboot(z,nb,1,countw.shtest,tobs,cluster=cluster,
onlyboot=TRUE,seed=seed)
scaleboot(z,nb,1,countw.shtestass,pa,cluster=cluster,
onlyboot=TRUE,seed=seed)
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|