Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(ISLR)
- library(boot)
- alpha.fn=function(data,index){
- X=data$X[index]
- Y=data$Y[index]
- return((var(Y)-cov(X,Y))/(var(X)+var(Y)-2*cov(X,Y)))}
- #"renaming my variables to fit the alpha function"
- Xy$X=Xy$X1;
- Xy$Y=Xy$y;
- set.seed(1)
- alpha.fn(Xy,sample(100,100,replace=T))
- boot(Xy,alpha.fn,R=1000)
Advertisement
Add Comment
Please, Sign In to add comment