Displaying 1 result from an estimated 1 matches for "hbr_coefa".
Did you mean:
hbr_coefb
2018 May 08
4
Average of results coming from B=100 repetitions (looping)
...ed
n=dim(BIO)[1]
p=0.667
# Sample size
sam=sample(1 :n,floor(p*n),replace=FALSE)
# Sample training data
Training =BIO [sam,]
# Sample testing data
Testing = BIO [-sam,]
# Build the HBR model
HBR<-hbrfit(D ~ A+B)
# Grab the coefficients
HBR_intercept <- as.numeric(HBR$coefficients[1])
HBR_coefA <- as.numeric(HBR$coefficients[2])
HBR_coefB <- as.numeric(HBR$coefficients[3])
# Predict response on testing data
Testing$pred <- HBR_intercept + HBR_coefA * Testing$A + HBR_coefB *Testing$B
# Get errors
Testing$sq_error <- (Testing$D-Testing$pred)^2
Testing$abs_error <- abs(Tes...