[R] Bootstraps standard error

danielepippo danzur at hotmail.it
Mon Feb 21 06:50:25 CET 2011


Thanks for the answer.
The R code is here:
library("bivpois")
data("ex3.health")
# Bivariate Poisson models
ex3.model.a <- lm.bp(doctorco~sex+age+income, prescrib~sex+age+income,
data=ex3.health)

Bootstrap standard errors can be obtained easily using the following script
for model (a):
n <- length(ex3.health$doctorco)
bootdata<-ex3.health
bootrep <- 200
results <- matrix(NA,bootrep,10)
for (i in 1:bootrep) {
bootx1 <- rpois(n,ex3.model.a$lambda1)
bootx2 <- rpois(n,ex3.model.a$lambda2)
bootx3 <- rpois(n,ex3.model.a$lambda3)
bootdata$doctorco <- bootx1+bootx3
bootdata$prescrib <- bootx2+bootx3
# Model (a)
testtemp <- lm.bp(doctorco~sex+age+income, prescrib~sex+age+income,
data=bootdata)
betafound <- c(testtemp$beta,testtemp$beta3)
results[i,] <- betafound
}

This is for my thesis. I'm trying to find the standard errors with the
bootstrap method but I've never done in my life and so I've asked in this
forum.
If you install the package "bivpois" that is in the archive of CRAN-R and if
you try this code, the result matrix is like that I had posted above. And I
don't understand the phrase:
At the end matrix results contains the bootstrap values of the parameters
and thus bootstrap standard errors can be obtained merely by calculating the
standard errors of the columns.
that is in pdf file because the columns of that "end matrix results"
contains every equal columns.
I hope you can help me... 
Thanks a lot









-- 
View this message in context: http://r.789695.n4.nabble.com/Bootstraps-standard-error-tp3313322p3316849.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list