Bootstrap Bias And Standard Error
Contents |
Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company bootstrap bias correction example Business Learn more about hiring developers or posting ads with us Cross Validated Questions Tags bootstrap bias corrected confidence intervals Users Badges Unanswered Ask Question _ Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, bootstrap standard error stata data mining, and data visualization. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top bootstrap standard error r Use of standard error of bootstrap distribution up vote 18 down vote favorite 7 (ignore the R code if needed, as my main question is language-independent) If I want to look at the variability of a simple statistic (ex: mean), I know I can do it via theory like: x = rnorm(50) # Estimate standard error from theory summary(lm(x~1)) # same as... sd(x) / sqrt(length(x)) or with the bootstrap like: library(boot) # Estimate standard error from
Bootstrap Standard Error Estimates For Linear Regression
bootstrap (x.bs = boot(x, function(x, inds) mean(x[inds]), 1000)) # which is simply the standard *deviation* of the bootstrap distribution... sd(x.bs$t) However, what I'm wondering is, can it be useful/valid(?) to look to the standard error of a bootstrap distribution in certain situations? The situation I'm dealing with is a relatively noisy nonlinear function, such as: # Simulate dataset set.seed(12345) n = 100 x = runif(n, 0, 20) y = SSasymp(x, 5, 1, -1) + rnorm(n, sd=2) dat = data.frame(x, y) Here the model doesn't even converge using the original data set, > (fit = nls(y ~ SSasymp(x, Asym, R0, lrc), dat)) Error in numericDeriv(form[[3L]], names(ind), env) : Missing value or an infinity produced when evaluating the model so the statistics I'm interested in instead are more stabilized estimates of these nls parameters - perhaps their means across a number of bootstrap replications. # Obtain mean bootstrap nls parameter estimates fit.bs = boot(dat, function(dat, inds) tryCatch(coef(nls(y ~ SSasymp(x, Asym, R0, lrc), dat[inds, ])), error=function(e) c(NA, NA, NA)), 100) pars = colMeans(fit.bs$t, na.rm=T) Here these are, indeed, in the ball park of what I used to simulate the original data: > pars [1] 5.606190 1.859591 -1.390816 A plotted version looks like: # Plot with(dat, plot(x, y)) newx = seq(min(x), max(x), len=100) lines(newx, SSasymp(newx, pars[1], pars[2], pars[3])) lines(newx, SSasymp(newx, 5, 1, -1), col='red') legend('bottomright', c('Actual', 'Predicted'), bt
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About
Bootstrap Standard Error Matlab
Us Learn more about Stack Overflow the company Business Learn more about hiring bootstrap standard error formula developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the bootstrap standard error heteroskedasticity Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Why Parametric Bootstrapping Bias and http://stats.stackexchange.com/questions/22472/use-of-standard-error-of-bootstrap-distribution Standard Error are zero here? up vote 1 down vote favorite I'm performing parametric bootstrapping in R for a simple problem and getting Bias and Standard Error zero always. I'd highly appreciate if someone point me out what wrong I'm doing in coding. Thanks set.seed(12345) df <- rnorm(n=10, mean = 0, sd = 1) Boot.fun <- function(data) { m1 <- mean(data) return(m1) } Boot.fun(data = df) http://stackoverflow.com/questions/31642808/why-parametric-bootstrapping-bias-and-standard-error-are-zero-here library(boot) out <- boot(df, Boot.fun, R = 20, sim = "parametric") out PARAMETRIC BOOTSTRAP Call: boot(data = df, statistic = Boot.fun, R = 20, sim = "parametric") Bootstrap Statistics : original bias std. error t1* -0.1329441 0 0 r statistics boot bootstrapping share|improve this question edited Jul 27 '15 at 4:43 asked Jul 26 '15 at 22:58 MYaseen208 5,2271158125 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote accepted You need to add line of code to do the sampling, ie. Boot.fun <- function(data) { data <- sample(data, replace=T) m1 <- ... since you didn't supply a function to the argument rand.gen to generate random values. This is discussed in the documentation for ?boot. If sim = "parametric" and you don't supply a generating function, then the original data is passed to statistic and you need to sample in that function. Since your simulation was run on the same data, there is no standard error or bias. share|improve this answer answered Jul 27 '15 at 0:43 jenesaisquoi 16.3k41645 Thanks a lot. Much appreciated. –MYaseen208 Jul 27 '15 at 5:38 add a comment| Your Answer draft saved draft dis
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta http://stackoverflow.com/questions/27595014/bootstrap-code-not-reporting-bias-or-standard-error Discuss the workings and policies of this site About Us Learn http://www.ats.ucla.edu/stat/mplus/faq/bootstrapse.htm more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like standard error you, helping each other. Join them; it only takes a minute: Sign up Bootstrap code not reporting bias or standard error up vote 3 down vote favorite I wrote this code in R: library(boot) bs <- function(formula, data, indices) { d <- data[indices,] # allows boot to select sample fit <- lm(formula, data=d) return(coef(fit)) } results <- bootstrap standard error boot(data=z, statistic=bs, R=1000, formula=z[,1]~z[,2]) I'm trying to do random x -resampling using for data a dataframe that contains my response and my predictor however my results return without bias and without std. Bootstrap Statistics : original bias std. error t1* 83.5466254 0 0 t2* -0.6360426 0 0 Can anyone spot the problem? r regression statistics-bootstrap share|improve this question edited Jul 1 '15 at 11:05 Siguza 9,21542144 asked Dec 21 '14 at 23:50 Sotiris Zampelis 206 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted Your formula is incorrect. When you use z[,1]~z[,2] you are literally specifying a formula that has the first column of z as the response and the second column of z as the independent variables. Note that z never changes. It's the data= parameter that's changing. Furthernore, the formula syntax does not work with positional indexes like that. You need to use variable names. Here's some sample data z <- data.frame(a=runif(50), b=runif(50)) Note how this doesn't work results <- boot(dat
errors in Mplus? Consider this seemingly unrelated regression using Stata. use http://www.ats.ucla.edu/stat/stata/notes/hsb2 sureg (read write math science) (socst write math science) Seemingly unrelated regression ---------------------------------------------------------------------- Equation Obs Parms RMSE "R-sq" chi2 P ---------------------------------------------------------------------- read 200 3 6.930412 0.5408 235.54 0.0000 socst 200 3 8.180626 0.4164 142.73 0.0000 ---------------------------------------------------------------------- ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- read | write | .2376706 .0689943 3.44 0.001 .1024443 .3728968 math | .3784015 .0738838 5.12 0.000 .2335919 .5232111 science | .2969347 .0669546 4.43 0.000 .1657061 .4281633 _cons | 4.369926 3.176527 1.38 0.169 -1.855954 10.59581 -------------+---------------------------------------------------------------- socst | write | .4656741 .0814405 5.72 0.000 .3060536 .6252946 math | .2763008 .0872121 3.17 0.002 .1053682 .4472334 science | .0851168 .0790329 1.08 0.281 -.0697848 .2400185 _cons | 8.869885 3.749558 2.37 0.018 1.520886 16.21888 ------------------------------------------------------------------------------ You could preface the command with the bootstrap prefix, as illustrated below, to obtain bias corrected bootstrap standard errors based on 20,000 replications. bootstrap, reps(20000) bca: sureg (read write math science) (socst write math science) Seemingly unrelated regression ---------------------------------------------------------------------- Equation Obs Parms RMSE "R-sq" chi2 P ---------------------------------------------------------------------- read 200 3 6.930412 0.5408 235.54 0.0000 socst 200 3 8.180626 0.4164 142.73 0.0000 ---------------------------------------------------------------------- ------------------------------------------------------------------------------ | Bootstrap | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+------------