statistics-bootstrap

Resampling not producing expected result of principal component analysis

旧巷老猫 提交于 2019-12-08 02:14:49
问题 I am trying following code to produce confidence intervals of principal component analysis using resampling with replacement (like bootstrap). I am using first 4 columns of iris dataset: The prcomp function produces following output: > mydf = iris[1:4] > print(prcomp(mydf)) Standard deviations: [1] 2.0562689 0.4926162 0.2796596 0.1543862 Rotation: PC1 PC2 PC3 PC4 Sepal.Length 0.36138659 -0.65658877 0.58202985 0.3154872 Sepal.Width -0.08452251 -0.73016143 -0.59791083 -0.3197231 Petal.Length 0

How do I replace the bootstrap step in the package randomForest r

本秂侑毒 提交于 2019-12-07 07:25:41
问题 First some background info, which is probably more interesting on stats.stackexchange: In my data analysis I try to compare the performance of different machine learning methods on time series data (regression, not classification). So for example I have trained a Boosting trained model and compare this with a Random Forest trained model (R package randomForest). I use time series data where the explanatory variables are lagged values of other data and the dependent variable. For some reason

Resampling not producing expected result of principal component analysis

前提是你 提交于 2019-12-06 07:42:06
I am trying following code to produce confidence intervals of principal component analysis using resampling with replacement (like bootstrap). I am using first 4 columns of iris dataset: The prcomp function produces following output: > mydf = iris[1:4] > print(prcomp(mydf)) Standard deviations: [1] 2.0562689 0.4926162 0.2796596 0.1543862 Rotation: PC1 PC2 PC3 PC4 Sepal.Length 0.36138659 -0.65658877 0.58202985 0.3154872 Sepal.Width -0.08452251 -0.73016143 -0.59791083 -0.3197231 Petal.Length 0.85667061 0.17337266 -0.07623608 -0.4798390 Petal.Width 0.35828920 0.07548102 -0.54583143 0.7536574

Bootstrap coverage in R

℡╲_俬逩灬. 提交于 2019-12-06 06:07:09
This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 6 years ago . I would estimate the coverage of the bootstrap interval for the mean knowing that the true average is 895.0385 . I have my vector b<-c(300,300,200,250,600...) and I make bootstrap and output interval: mean.fun <- function(dat, idx) mean(dat[idx], na.rm = TRUE) boot.out <- boot(b, mean.fun, R=999) boot.ci(boot.out) But how I can replicate this in order to obtain the coverage probability (how many times it contained the true average)? I was trying to do something a bit like this a

Speeding up time series simulation (for bootstrap)

前提是你 提交于 2019-12-06 01:13:51
I need to run a bootstrap on a time series with non-standard dependence. So to do this I need to create a function that simulates the time series by making time by time adjustments. testing<-function(){ sampleData<-as.zoo(data.frame(index=1:1000,vol=(rnorm(1000))^2,x=NA)) sampleData[,"x"]<-sampleData[,"vol"]+rnorm(1000) #treat this is completely exognenous and unknown in connection to vol sampleData<-cbind(sampleData,mean=rollmean(sampleData[,"vol"],k=3,align="right")) sampleData<-cbind(sampleData,vol1=lag(sampleData[,"vol"],k=-1),x1=lag(sampleData[,"x"],k=-1),mean1=lag(sampleData[,"mean"],k=

How do I replace the bootstrap step in the package randomForest r

╄→尐↘猪︶ㄣ 提交于 2019-12-05 16:53:13
First some background info, which is probably more interesting on stats.stackexchange: In my data analysis I try to compare the performance of different machine learning methods on time series data (regression, not classification). So for example I have trained a Boosting trained model and compare this with a Random Forest trained model (R package randomForest). I use time series data where the explanatory variables are lagged values of other data and the dependent variable. For some reason the Random Forest severely underperforms. One of the problems I could think of is that the Random Forest

adjusted bootstrap confidence intervals (BCa) with parametric bootstrap in boot package

只谈情不闲聊 提交于 2019-12-05 11:19:21
问题 I am attempting to use boot.ci from R's boot package to calculate bias- and skew-corrected bootstrap confidence intervals from a parametric bootstrap. From my reading of the man pages and experimentation, I've concluded that I have to compute the jackknife estimates myself and feed them into boot.ci , but this isn't stated explicitly anywhere. I haven't been able to find other documentation, although to be fair I haven't looked at the original Davison and Hinkley book on which the code is

Calculating 95% confidence intervals in quantile regression in R using rq function

走远了吗. 提交于 2019-12-04 23:00:53
问题 I would like to get 95% confidence intervals for the regression coefficients of a quantile regression. You can calculate quantile regressions using the rq function of the quantreg package in R (compared to an OLS model): library(quantreg) LM<-lm(mpg~disp, data = mtcars) QR<-rq(mpg~disp, data = mtcars, tau=0.5) I am able to get 95% confidence intervals for the linear model using the confint function: confint(LM) When I use quantile regression I understand that the following code produces

adjusted bootstrap confidence intervals (BCa) with parametric bootstrap in boot package

自作多情 提交于 2019-12-03 23:10:53
I am attempting to use boot.ci from R's boot package to calculate bias- and skew-corrected bootstrap confidence intervals from a parametric bootstrap. From my reading of the man pages and experimentation, I've concluded that I have to compute the jackknife estimates myself and feed them into boot.ci , but this isn't stated explicitly anywhere. I haven't been able to find other documentation, although to be fair I haven't looked at the original Davison and Hinkley book on which the code is based ... If I naively run b1 <- boot(...,sim="parametric") and then boot.ci(b1) , I get the error

Calculating 95% confidence intervals in quantile regression in R using rq function

守給你的承諾、 提交于 2019-12-03 14:05:16
I would like to get 95% confidence intervals for the regression coefficients of a quantile regression. You can calculate quantile regressions using the rq function of the quantreg package in R (compared to an OLS model): library(quantreg) LM<-lm(mpg~disp, data = mtcars) QR<-rq(mpg~disp, data = mtcars, tau=0.5) I am able to get 95% confidence intervals for the linear model using the confint function: confint(LM) When I use quantile regression I understand that the following code produces bootstrapped standard errors: summary.rq(QR,se="boot") But actually I would like something like 95%