# \donttest{
set.seed(1)
RDF <- random.test.data(8, 8, 3)
Coords <- RDF[, 4:5]
m <- grf(dep ~ X1 + X2, dframe = RDF, bw = 12,
kernel = "adaptive", coords = Coords,
ntree = 100, mtry = 1, nthreads = 1,
print.results = FALSE, progress = FALSE)
set.seed(2)
RDF.Test <- random.test.data(2, 2, 3)
predict(m, RDF.Test, x.var.name = "X", y.var.name = "Y",
local.w = 1, global.w = 0)
# }
if (FALSE) {
## Real-world demonstration on the Greek Income dataset.
## Not run by R CMD check because fitting a full GRF on 325
## municipalities exceeds the few-second example budget.
data(Income)
Coords <- Income[, 1:2]
m <- grf(Income01 ~ UnemrT01 + PrSect01, dframe = Income, bw = 60,
kernel = "adaptive", coords = Coords)
set.seed(123)
x <- runif(20, min = 142498, max = 1001578)
y <- runif(20, min = 3855768, max = 4606754)
u <- runif(20, min = 5, max = 50)
p <- runif(20, min = 0, max = 100)
f <- runif(20, min = 2, max = 30)
df2 <- data.frame(X = x, Y = y, UnemrT01 = u, PrSect01 = p, Foreig01 = f)
predict(m, df2, x.var.name = "X", y.var.name = "Y",
local.w = 1, global.w = 0)
}
Run the code above in your browser using DataLab