當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


R saddle Bootstrap 統計的鞍點近似

R語言 saddle 位於 boot 包(package)。

說明

此函數計算 W 線性組合在特定點 u 的分布的鞍點近似值,其中 W 是隨機變量向量。 W 的分布可以是多項式(默認)、泊鬆分布或二元分布。如果給出調整的累積量生成函數及其二階導數,其他分布也是可能的。對於具有二元或泊鬆分布的 W,可以計算給定 W 的其他線性組合的值的一個線性組合的分布的條件鞍點近似。

用法

saddle(A = NULL, u = NULL, wdist = "m", type = "simp", d = NULL,
       d1 = 1, init = rep(0.1, d), mu = rep(0.5, n), LR = FALSE,
       strata = NULL, K.adj = NULL, K2 = NULL)

參數

A

W 的線性組合的已知係數的向量或矩陣。它是必需的參數,除非提供 K.adjK2,在這種情況下它將被忽略。

u

需要計算 W 線性組合分布的鞍點近似值。除非提供了 K.adjK2,否則它是必需的參數,在這種情況下它被忽略。

wdist

W 的分布。這可以是 "m"(多項式)、"p"(泊鬆)、"b"(二進製)或 "o"(其他)之一。如果給定 K.adjK2,則 wdist 設置為 "o"

type

鞍點近似的類型。可能的類型為 "simp"(表示簡單鞍點)和 "cond"(表示條件鞍點)。當 wdist"o""m" 時,type 自動設置為 "simp" ,這是當前為這些發行版實現的唯一鞍點類型。

d

這指定了整個統計的維度。僅當 wdist = "o" 時才需要此參數,如果在這種情況下未提供,則默認為 1。對於其他發行版,它設置為 ncol(A)

d1

type"cond" 時,這是感興趣的統計量的維度,必須小於 length(u) 。然後,在給定其餘組合值的情況下,找到第一個 d1 線性組合的條件分布的鞍點近似。僅當 d1 的值為 1 時才能找到條件分布函數近似值。

init

如果 wdist"m""o" ,則使用它,這將為用於求解鞍點方程的 nlmin 提供初始值。

mu

wdist"m""p""b"時W分布的參數值。 mu 的長度必須與 W 相同(即 nrow(A) )。默認情況下,mu 的所有值都相等,因此 W 的元素是同分布的。

LR

如果是 TRUE,則使用 cdf 的 Lugananni-Rice 近似值,否則使用的近似值基於 Barndorff-Nielsen 的 r*。

strata

分層數據的層。

K.adj

wdist"o" 時使用的調整後的累積量生成函數。這是單個參數 zeta 的函數,用於計算 K(zeta)-u%*%zeta ,其中 K(zeta) 是 W 的累積生成函數。

K2

這是單個參數 zeta 的函數,它返回 K(zeta) 的二階導數矩陣,以便在 wdist"o" 時使用。如果給出了K.adj,那麽也必須給出K.adj。它僅被調用一次,並將鞍點方程的計算解作為參數傳遞。如果未提供K.adj,則忽略此參數。

細節

如果 wdist"o""m" ,則使用 nlmin 求解鞍點方程,以根據其參數 zeta 最小化 K.adj 。對於泊鬆和二元情況,擬合廣義線性模型,使得參數估計求解鞍點方程。 glm 的響應變量'y' 必須滿足方程t(A)%*%y = u(t() 是轉置函數)。這樣的向量可以作為線性規劃問題的可行解找到。這是通過調用 simplex 來完成的。 glm 的協變量矩陣由 A 給出。

由以下組件組成的列表

spa

鞍點近似。第一個值是密度近似值,第二個值是分布函數近似值。

zeta.hat

鞍點方程的解。對於條件鞍點,這是分子鞍點方程的解。

zeta2.hat

如果type"cond",則這是分母鞍點方程的解。對於 type 的任何其他值,不會返回該組件。

例子

# To evaluate the bootstrap distribution of the mean failure time of 
# air-conditioning equipment at 80 hours
saddle(A = aircondit$hours/12, u = 80)

# Alternatively this can be done using a conditional poisson
saddle(A = cbind(aircondit$hours/12,1), u = c(80, 12),
       wdist = "p", type = "cond")

# To use the Lugananni-Rice approximation to this
saddle(A = cbind(aircondit$hours/12,1), u = c(80, 12),
       wdist = "p", type = "cond", 
       LR = TRUE)

# Example 9.16 of Davison and Hinkley (1997) calculates saddlepoint 
# approximations to the distribution of the ratio statistic for the
# city data. Since the statistic is not in itself a linear combination
# of random Variables, its distribution cannot be found directly.  
# Instead the statistic is expressed as the solution to a linear 
# estimating equation and hence its distribution can be found.  We
# get the saddlepoint approximation to the pdf and cdf evaluated at
# t = 1.25 as follows.
jacobian <- function(dat,t,zeta)
{
     p <- exp(zeta*(dat$x-t*dat$u))
     abs(sum(dat$u*p)/sum(p))
}
city.sp1 <- saddle(A = city$x-1.25*city$u, u = 0)
city.sp1$spa[1] <- jacobian(city, 1.25, city.sp1$zeta.hat) * city.sp1$spa[1]
city.sp1

參考

Booth, J.G. and Butler, R.W. (1990) Randomization distributions and saddlepoint approximations in generalized linear models. Biometrika, 77, 787-796.

Canty, A.J. and Davison, A.C. (1997) Implementation of saddlepoint approximations to resampling distributions. Computing Science and Statistics; Proceedings of the 28th Symposium on the Interface, 248-253.

Davison, A.C. and Hinkley, D.V. (1997) Bootstrap Methods and their Application. Cambridge University Press.

Jensen, J.L. (1995) Saddlepoint Approximations. Oxford University Press.

也可以看看

saddle.distn , simplex

相關用法


注:本文由純淨天空篩選整理自R-devel大神的英文原創作品 Saddlepoint Approximations for Bootstrap Statistics。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。