jackknife: Implementing the jackknife method of estimating standard...

Description Usage Arguments Details Value Author(s) Examples

View source: R/jackknife.R

Description

Implementing the jackknife method of estimating standard errors of some linear statistics

Usage

1
jackknife(vx, tfunc, dfunc, im, vw, ...)

Arguments

vx

a vector of observations

tfunc

the function which takes the rho argument and returns the statistic

dfunc

the delta function which takes a tuple or window of the observations and returns a vector of deltas

im

the tuple or window size

vw

the weights for deleting or downweighting the blocks

...

other arguments for both tfunc and dfunc if any

Details

The function takes several arguments including functions and returns a list containing the results.

Value

a list containing the results

The object is a list containing the following components:

T

the value of the statistic

jack

a vector or matrix containing the jackknifed statistics

sig2

the jackknifed estimate of the variance of the statistic

Author(s)

Yukai Yang, yukai.yang@statistik.uu.se

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
vw1 = 1
vw2 = c(0.25,0.75,1,0.75,0.25)

# the AR(1) model
iN = 100
vx <- rnorm(iN)

# for first order autocorrelation
# dfunc vec 2, y_t and y_t-1
dfunc <- function(yy, my, vy) return(prod(yy - my)/vy)

tfunc <- function(rho, my, vy) return(rho)

# results
ret = jackknife(as.vector(vx), tfunc, dfunc, im=2, vw=vw1, my=mean(vx), vy=var(vx))
ret

ret = jackknife(as.vector(vx), tfunc, dfunc, im=2, vw=vw2, my=mean(vx), vy=var(vx))
ret

yukai-yang/jackknife documentation built on Nov. 5, 2019, 1:21 p.m.