tilt.boot
位於 boot
包(package)。 說明
此函數將運行具有相等重采樣概率(如果需要)的初始引導程序,並將使用初始運行的輸出來查找將統計值置於所需值的重采樣概率。然後,它使用計算出的概率作為重采樣分布來運行重要性重采樣引導程序。
用法
tilt.boot(data, statistic, R, sim = "ordinary", stype = "i",
strata = rep(1, n), L = NULL, theta = NULL,
alpha = c(0.025, 0.975), tilt = TRUE, width = 0.5,
index = 1, ...)
參數
data |
數據為向量、矩陣或 DataFrame 。如果它是矩陣或 DataFrame ,則每一行都被視為一個(多變量)觀察。 |
statistic |
應用於數據時返回包含感興趣統計數據的向量的函數。它必須至少有兩個參數。第一個參數始終是 |
R |
所需的引導程序重複次數。這通常是一個向量,第一個值表示在初始階段要執行多少次統一引導模擬。 |
sim |
這是一個字符串,指示所需的引導模擬類型。隻能采用兩個可能的值: |
stype |
指示 |
strata |
表示多樣本問題的層的整數向量或因子。 |
L |
感興趣統計的經驗影響值。當 |
theta |
傾斜分布所需的參數值。每個非均勻分布都應該有一個 |
alpha |
需要傾斜的 alpha 級別。如果 |
tilt |
一個邏輯變量,如果 |
width |
僅當 |
index |
|
... |
|
值
類 "boot"
的對象,具有以下組件
t0 |
原始數據統計量的觀測值。 |
t |
引導程序的值複製了統計數據。其中會有 |
R |
自舉重複次數的輸入向量。 |
data |
提供的原始數據。 |
statistic |
提供的 |
sim |
引導程序中使用的模擬類型,可以是 |
stype |
提供的統計數據類型,與輸入值 |
call |
對 |
strata |
所提供的地層。 |
weights |
使用的權重矩陣。如果 |
theta |
|
例子
# Note that these examples can take a while to run.
# Example 9.9 of Davison and Hinkley (1997).
grav1 <- gravity[as.numeric(gravity[,2]) >= 7, ]
grav.fun <- function(dat, w, orig) {
strata <- tapply(dat[, 2], as.numeric(dat[, 2]))
d <- dat[, 1]
ns <- tabulate(strata)
w <- w/tapply(w, strata, sum)[strata]
mns <- as.vector(tapply(d * w, strata, sum)) # drop names
mn2 <- tapply(d * d * w, strata, sum)
s2hat <- sum((mn2 - mns^2)/ns)
c(mns[2]-mns[1],s2hat,(mns[2]-mns[1]-orig)/sqrt(s2hat))
}
grav.z0 <- grav.fun(grav1, rep(1, 26), 0)
tilt.boot(grav1, grav.fun, R = c(249, 375, 375), stype = "w",
strata = grav1[,2], tilt = TRUE, index = 3, orig = grav.z0[1])
# Example 9.10 of Davison and Hinkley (1997) requires a balanced
# importance resampling bootstrap to be run. In this example we
# show how this might be run.
acme.fun <- function(data, i, bhat) {
d <- data[i,]
n <- nrow(d)
d.lm <- glm(d$acme~d$market)
beta.b <- coef(d.lm)[2]
d.diag <- boot::glm.diag(d.lm)
SSx <- (n-1)*var(d$market)
tmp <- (d$market-mean(d$market))*d.diag$res*d.diag$sd
sr <- sqrt(sum(tmp^2))/SSx
c(beta.b, sr, (beta.b-bhat)/sr)
}
acme.b <- acme.fun(acme, 1:nrow(acme), 0)
acme.boot1 <- tilt.boot(acme, acme.fun, R = c(499, 250, 250),
stype = "i", sim = "balanced", alpha = c(0.05, 0.95),
tilt = TRUE, index = 3, bhat = acme.b[1])
參考
Booth, J.G., Hall, P. and Wood, A.T.A. (1993) Balanced importance resampling for the bootstrap. Annals of Statistics, 21, 286-298.
Davison, A.C. and Hinkley, D.V. (1997) Bootstrap Methods and Their Application. Cambridge University Press.
Hinkley, D.V. and Shi, S. (1989) Importance sampling and the nested bootstrap. Biometrika, 76, 435-446.
也可以看看
boot
, exp.tilt
, Imp.Estimates
, imp.weights
, smooth.f
相關用法
- R tsboot 時間序列的引導
- R tau Tau 粒子衰變模式
- R tuna 金槍魚目擊數據
- R poisons 動物生存時間
- R ducks 雜交鴨的行為和羽毛特征
- R nodal 前列腺癌的淋巴結受累
- R cloth 布料瑕疵數量
- R polar 新喀裏多尼亞紅土的極點位置
- R capability 模擬製造過程數據
- R beaver 海狸體溫數據
- R saddle.distn Bootstrap 統計的鞍點分布近似
- R logit 比例的邏輯
- R EEF.profile 經驗可能性
- R gravity 重力加速度
- R boot 引導重采樣
- R plot.boot Bootstrap 模擬的輸出圖
- R boot.ci 非參數引導置信區間
- R envelope 曲線的置信區間
- R bigcity 美國城市人口
- R co.transfer 一氧化碳轉移
- R imp.weights 重要性采樣權重
- R acme 每月超額返回
- R glm.diag.plots 廣義線性模型的診斷圖
- R survival 輻射劑量後大鼠的存活率
- R norm.ci 正態近似置信區間
注:本文由純淨天空篩選整理自R-devel大神的英文原創作品 Non-parametric Tilted Bootstrap。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。