I have written an R script for obtaining bootstrapped standard errors in the linear regression setting.
In practice, first in a model building step I select the final model to be applied at each bootstrapped sample (for simplicity suppose that it is a simple univariate linear model).
Then I simulate
B = 1000 bootstrap samples (with replacement from the initial true dataset). For each simulated sample I fit the initially defined univariate regression model to the simulated data and store the estimated coefficient of the covariate of interest in
Suppose now for simplicity that
B = 10. At the end of the
B simulations, I obtain the output matrix
boot_out in this form:
boot_out <- read.table(text = " iter b_x 1 1.19 2 0.81 3 1.21 4 1.05 5 0.99 6 1.11 7 1.09 8 0.88 9 0.91 10 1.12", header=TRUE)
Now I need to compute the bootstrapped standard error of the effect of the regressor of interest, call it
To this aim, I used:
se_boot <- sd(boot_out[,"b_x"]) se_boot
but I get a unexpected result: the bootstrapped standard error of
b_x is higher than the standard error estimated through the initial model fitted to the true data..
By looking at my
b_x values I found that the estimates of the partial effect of interest vary within a wide range, but I guessed that 1000 bootstrap replications were sufficient for refining the estimated standard error of
Before trying to do even more replications, could you please tell me whether the above passages are right?
Thanks a lot for any help.