Displaying 1 result from an estimated 1 matches for "lm_fit".
Did you mean:
em_fst
2016 Apr 04
0
Does this code execute the bagging correctly ?!
Hello
the code :
set.seed(10)
y<-c(1:1000)
x1<-c(1:1000)*runif(1000,min=0,max=2)
x2<-c(1:1000)*runif(1000,min=0,max=2)
x3<-c(1:1000)*runif(1000,min=0,max=2)
lm_fit<-lm(y~x1+x2+x3)
summary(lm_fit)
set.seed(10)
all_data<-data.frame(y,x1,x2,x3)
positions <- sample(nrow(all_data),size=floor((nrow(all_data)/4)*3))
training<- all_data[positions,]
testing<- all_data[-positions,]
lm_fit<-lm(y~x1+x2+x3,data=training)
predictions<-predict(lm_fit,...