r - variance-covariance HAC matrix - Bootstrap -


i realized bootstrap on data, when want print variance-covariance hac matrix, result bit chaotic:

enter image description here

tbs <- tsbootstrap(u, nb= 199, b=8, type=c("block")) #bootstrap on residuals ytbs = tbs fmtbs <- lm(ytbs ~ x1 + x2 + x3) covhactbs <- neweywest(fmtbs, lag = 10, prewhite= false, sandwich = true) 

the data generated rnorm(n) , assume presence of autocorrelation. have distinct var-covar hac matrices each bootstrap, because need perform wald test on each of them. how can fix this?

your code estimates single multivariate linear model object simultaneously 199 bootstrap responses created. if want perform inferences on each replication can loop on in for(i in 1:199) or lapply(1:199, function(i) ...) approach or so. each model be

fmtbs <- lm(ytbs[,i] ~ x1 + x2 + x3) coeftest(fmtbs, vcov = neweywest(fmtbs,   lag = 10, prewhite= false, sandwich = true)) 

or similar. details depend on want store.

as have fixed lag , use noe prewhitening, standard errors obtained individual lm (as suggested me above) , multivariate mlm (that used) in fact coincide. might save bit of time if everyting in multivariate approach. however, code , result more intelligble if use less efficient loop/apply. that's if time not serious concern.


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -