statistics-bootstrap

Problems with accessing double elements in a list in R

依然范特西╮ 提交于 2020-11-29 19:18:30
问题 I have performed a bootstrapping with 2.000 resamples of the Lee Carter model for mortality projection. The question is not specific for mortality studies, but on more general dimensions in R. After performing the bootstrapping I get a list with 2000 elements, each for every of 2.000 re-estimations of the model. For each model, there are estimates of my 3 variables: a_x, b_x and k_t. Both a_x and b_x are age-specific, so the "x" denotes an age in the interval [0:95]. I would now like to plot

How can I bootstrap the innermost array of a numpy array?

安稳与你 提交于 2020-03-04 11:08:18
问题 I have a numpy array of these dimensions data.shape (categories, models, types, events): (10, 11, 50, 100) Now I want to do sample with replacement in the innermost array (100) only. For a single array such as this: data[0][0][0] array([ 40.448624 , 39.459843 , 33.76762 , 38.944622 , 21.407362 , 35.55499 , 68.5111 , 16.512974 , 21.118315 , 18.447166 , 16.026619 , 21.596252 , 41.798622 , 63.01645 , 46.886642 , 68.874756 , 17.472408 , 53.015724 , 85.41213 , 59.388977 , 17.352108 , 61.161705 ,

Bootstrap Confidence Intervals for more than one statistics through boot.ci function

感情迁移 提交于 2020-02-01 04:55:27
问题 I want to get bootstrap confidence intervals for more than one statistics through boot.ci function. Here is my MWE. I've two statistics in out and want to find the bootstrap confidence intervals for these two statistics. However, boot.ci function is providing the bootstrap confidence intervals for only first statistic (t1*) but not for the second statistic (t2*). set.seed(12345) df <- rnorm(n=10, mean = 0, sd = 1) Boot.fun <- function(data, idx) { data1 <- sample(data[idx], replace=TRUE) m1 <

Bootstrap data in MATLAB

别等时光非礼了梦想. 提交于 2020-01-14 06:26:08
问题 I have data similar to this: x = 0:0.1:10; y = exppdf(x,2); plot(x,y, 'o') and then I want to have some resampled data close to them, but when I use the command below , the resampled data are really far from the original one! [resampling, bootsam]=bootstrp(100, 'corr', x,y); plot(x,y(bootsam(:,100)), 'r*') Could you please help me? I guess I need to change option 'corr' in the bootstrp command. 回答1: I think this is what you are trying to do: plot(x, sort(y(bootsam(:,100)), 'descend'), 'r*')

Bootstrap coverage in R

流过昼夜 提交于 2020-01-02 13:35:32
问题 I would estimate the coverage of the bootstrap interval for the mean knowing that the true average is 895.0385 . I have my vector b<-c(300,300,200,250,600...) and I make bootstrap and output interval: mean.fun <- function(dat, idx) mean(dat[idx], na.rm = TRUE) boot.out <- boot(b, mean.fun, R=999) boot.ci(boot.out) But how I can replicate this in order to obtain the coverage probability (how many times it contained the true average)? 回答1: I was trying to do something a bit like this a bit ago.