data(SMSA)
anyNA(SMSA)
#[1] FALSE
dim(SMSA)
#[1] 59 15
n=nrow(SMSA)
X <- SMSA[names(SMSA)!="NOx"]
Y <- SMSA[names(SMSA)=="NOx"]
set.seed(25)
train.obs <- sample(1:n, 0.7*n, replace = FALSE)
test.obs <- (1:n)[-train.obs]
xtrain <- X[train.obs,]; ytrain <- Y[train.obs,];
xtest <- X[test.obs,]; ytest <- Y[test.obs,]
OkNNE.MODEL = OKNNE(xtrain = xtrain, ytrain = ytrain, xtest = xtest, ytest
= ytest, k = 10, B = 5, q = trunc(sqrt(ncol(xtrain))), direction = "both",
algorithm=c("kd_tree", "cover_tree", "CR", "brute"))
OkNNE.MODEL
Run the code above in your browser using DataLab