if (FALSE) {
RDF <- random.test.data(10,10,3)
Coords<-RDF[ ,4:5]
grf <- grf(dep ~ X1 + X2, dframe=RDF, bw=10,
kernel="adaptive", coords=Coords)
RDF.Test <- random.test.data(2,2,3)
predict.grf(grf, RDF.Test, x.var.name="X", y.var.name="Y", local.w=1, global.w=0)
}
# \donttest{
#Load the sample data
data(Income)
#Create the vector of XY coordinates
Coords<-Income[,1:2]
#Fit local model
grf <- grf(Income01 ~ UnemrT01 + PrSect01, dframe=Income, bw=60,
kernel="adaptive", coords=Coords)
#Create New Random Data - XY coordinates inside the sample data map extend
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)
#Make predictions using the local model
predict.grf(grf, df2, x.var.name="X", y.var.name="Y", local.w=1, global.w=0)
# }
Run the code above in your browser using DataLab