Ravi Kulkarni
2012-Apr-02 11:15 UTC
[R] Bootstrapped Tobit regression - get standard error 0...
I am trying to work out a bootstrapped Tobit regression model. I get the coefficients all right, but they all have standard error zero. And I am unable to figure out why. I know the coefficients are correct because that's what I get when do a Tobit (without bootstrapping). Here's my code: # Bootstrap 95% CI for Tobit regression coefficients? library(boot) library(AER) # for the Affairs dataset data(Affairs) # function to obtain regression weights bs <- function(formula, data, indices) { d <- data[indices,] fit <- tobit(formula, data=Affairs) return(coef(fit)) } # bootstrapping with 1000 replications results <- boot(data=Affairs, statistic=bs, R=1000, formula=affairs~age+yearsmarried+religiousness+occupation+rating) # view results results That gives me the right coefficients, but the SEs are all zero, so I cannot get 95% confidence intervals... Any help is welcome... Ravi -- View this message in context: http://r.789695.n4.nabble.com/Bootstrapped-Tobit-regression-get-standard-error-0-tp4525760p4525760.html Sent from the R help mailing list archive at Nabble.com.
Achim Zeileis
2012-Apr-02 12:36 UTC
[R] Bootstrapped Tobit regression - get standard error 0...
On Mon, 2 Apr 2012, Ravi Kulkarni wrote:> I am trying to work out a bootstrapped Tobit regression model. I get the > coefficients all right, but they all have standard error zero. And I am > unable to figure out why. I know the coefficients are correct because that's > what I get when do a Tobit (without bootstrapping). Here's my code: > > # Bootstrap 95% CI for Tobit regression coefficients? > library(boot) > library(AER) # for the Affairs dataset > data(Affairs) > > # function to obtain regression weights > bs <- function(formula, data, indices) { > d <- data[indices,] > fit <- tobit(formula, data=Affairs) > return(coef(fit)) > } > # bootstrapping with 1000 replications > results <- boot(data=Affairs, statistic=bs, > R=1000, formula=affairs~age+yearsmarried+religiousness+occupation+rating) > > # view results > results > > That gives me the right coefficients, but the SEs are all zero, so I > cannot get 95% confidence intervals...In the AER book in Chapter 7.2 we have an example for a linear regression where boot() is used on an lm() model. This can easily be adapted here: ## refit function and bootstrap refit <- function(data, i) coef(tobit( affairs ~ age + yearsmarried + religiousness + occupation + rating, data = data[i,])) m1 <- boot(Affairs, refit, R = 1000) ## original model m2 <- tobit(affairs ~ age + yearsmarried + religiousness + occupation + rating, data = Affairs) ## compare results m1 coeftest(m2) Hope that helps, Z> Any help is welcome... > > Ravi > > > > > > -- > View this message in context: http://r.789695.n4.nabble.com/Bootstrapped-Tobit-regression-get-standard-error-0-tp4525760p4525760.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >