Skip to main content
added 647 characters in body
Source Link

ChangeIt seems something wrong with your resampling, the bootdata you get in each iteration is exactly the same.

Because this line has fixed the value of logapple08 and logrm08 which doesn't change when you do the resampling.

sd.boot[i]=#log coef(summary(lm(logapple08~logrm08,returns dataof =AAPL bootdataand market
logapple08<- na.omit(ROC(apple08)*100)
logrm08<-na.omit(ROC(rm08)[2,2]*100)

toAdd one more line between these two lines

sd.boot[i]= coefdf08<-cbind(summarylogapple08,logrm08)
set.seed(lm666)

as

df08<-cbind(logapple08~logrm08logapple08,logrm08)
colnames(df08) data<- =c("logapple08", bootdata)"logrm08")
set.seed(666)[2,1]

BecauseIt will give different values.

Another thing is because in bootstrap, we calculate estimation $\beta_1$$\hat{\beta}_1$ in each boot and collect them together as a sample of estimator $\hat{\beta}_1$, then calculate the bootstrap standard deviation of estimator $\hat{\beta}_1$. If you're interested in the bootstrap sd of estimator $\hat{\beta}_1$, you might like to

Change this line

sd.boot[i]= coef(summary(lm(logapple08~logrm08, data = bootdata)))[2,2]

to

sd.boot[i]= coef(summary(lm(logapple08~logrm08, data = bootdata)))[2,1]

Change this line

sd.boot[i]= coef(summary(lm(logapple08~logrm08, data = bootdata)))[2,2]

to

sd.boot[i]= coef(summary(lm(logapple08~logrm08, data = bootdata)))[2,1]

Because in bootstrap, we calculate estimation $\beta_1$ in each boot and collect them together as a sample of estimator $\hat{\beta}_1$, then calculate the standard deviation of estimator $\hat{\beta}_1$.

It seems something wrong with your resampling, the bootdata you get in each iteration is exactly the same.

Because this line has fixed the value of logapple08 and logrm08 which doesn't change when you do the resampling.

#log returns of AAPL and market
logapple08<- na.omit(ROC(apple08)*100)
logrm08<-na.omit(ROC(rm08)*100)

Add one more line between these two lines

df08<-cbind(logapple08,logrm08)
set.seed(666)

as

df08<-cbind(logapple08,logrm08)
colnames(df08) <- c("logapple08", "logrm08")
set.seed(666)

It will give different values.

Another thing is because in bootstrap, we calculate $\hat{\beta}_1$ in each boot and collect them together as a sample of estimator $\hat{\beta}_1$, then calculate the bootstrap standard deviation of estimator $\hat{\beta}_1$. If you're interested in the bootstrap sd of estimator $\hat{\beta}_1$, you might like to

Change this line

sd.boot[i]= coef(summary(lm(logapple08~logrm08, data = bootdata)))[2,2]

to

sd.boot[i]= coef(summary(lm(logapple08~logrm08, data = bootdata)))[2,1]
Source Link

Change this line

sd.boot[i]= coef(summary(lm(logapple08~logrm08, data = bootdata)))[2,2]

to

sd.boot[i]= coef(summary(lm(logapple08~logrm08, data = bootdata)))[2,1]

Because in bootstrap, we calculate estimation $\beta_1$ in each boot and collect them together as a sample of estimator $\hat{\beta}_1$, then calculate the standard deviation of estimator $\hat{\beta}_1$.