Jackknife Covariance and Missing Values

library(hadron)

Missing column

We create some data and replace one column with NA.

data <- matrix(rnorm(120), ncol = 10)
data[, 3] <- NA
print(data)

The covariance, with the implicit use = 'everything' will give us a “cross” of NA in the covariance matrix.

cov(data)

The jackknife covariance does the same thing.

jackknife_cov(data)

Missing row

When we have some NA values in a row, we have a conceptual problem with the jackknife as the width of the jackknife distribution is linked to the number of measurements.

data <- matrix(rnorm(120), ncol = 10)
data[2, ] <- NA
print(data)

Also here we get the same behavior by default:

cov(data)
jackknife_cov(data)

When we use complete, we get the same thing as just dropping the NA rows.

cov(data, use = 'complete')
all(cov(data, use = 'complete') == cov(data[complete.cases(data), ]))

With our jackknife function we get a failure, which should not happen!

jackknife_cov(data, na.rm = TRUE)


Try the hadron package in your browser

Any scripts or data that you put into this service are public.

hadron documentation built on Jan. 13, 2021, 8 a.m.