Parametric bootstrapping

TODO

  • link to resamplingBootALM

Install required packages

boot, mvtnorm

Two-sample difference in means

Function that simulates random outcome values according to parametric model based on original data set and maximum likelihood estimate of parameter values (mean, uncorrected standard deviation). Will be used as an argument to boot().

Function that returns uncorrected variance of a vector.

Replace original data by group means and standard deviations as maximum likelihood parameter estimates. Will be used as an argument to boot().

Function that returns the difference in means (test statistic) for one bootstrap replication. Will be used as an argument to boot().

Run parametric bootstrapping.

     conf                          
[1,] 0.95 975 25 -1.918286 8.118938

Compare to parametric confidence interval from t-test.

[1] -2.207945  8.530001
attr(,"conf.level")
[1] 0.95

Poisson regression

Fit Poisson regression model - will be used as maximum likelihood estimate in boot().

Function that simulates random outcome values according to parametric model based on original data set and maximum likelihood estimate of parameter values. Will be used as an argument to boot().

Function that returns maximum likelihood estimates of parameter values.

Run parametric bootstrapping.

     conf                           
[1,] 0.95 975 25 0.0307735 0.4497439
     conf                             
[1,] 0.95 975 25 -0.2755834 -0.1848145
     conf                               
[1,] 0.95 975 25 -0.001394293 0.04340081

Compare to parametric confidence intervals.

                   2.5 %      97.5 %
(Intercept)  0.025825382  0.43274603
X1          -0.275600776 -0.18815876
X2          -0.001225986  0.04453917

Detach (automatically) loaded packages (if possible)

Get the article source from GitHub

R markdown - markdown - R code - all posts