Hello,
I would like to ask you, if you have any ideas to use random forest output to create a spatial prediction map?. I developed my model by using random forest regression, but I met a little difficulty in last step to use the best predictors for building the predictive map. I want to create a map prediction map.
You can see my short code in R.
library(raster) library(randomForest) set.seed(12) setwd("C:/Users/iouedraogo/Desktop/Essai/TIFF/") s <- stack("Density.tif", "Aqui.tif", "Rech.tif", "Rainfall.tif","Land Use.tif", "Cond.tif", "Nitrogen.tif", "Regions.tif","Soil.tif","Topo.tif", "Climatclass.tif", "Depth.tif")
points <- read.table("C:/Users/iouedraogo/Desktop/Essai/MoyData_correction final_Coordonnées3.txt",header=TRUE, sep="\t", dec=",",strip.white=TRUE) head(points) d <- extract(s, points) rf <-randomForest(nitrate~ . , data=d, importance=TRUE, ntree=500, na.action = na.roughfix) p <- predict(s, rf)
plot(p)
Please if you have an idea or suggestion . I could try, I'd be very happy.
See for example:
head(points) LAT LONG 1 -13.057007 27.549580 2 -4.255000 15.233745 3 5.300000 -1.983610 4 7.245675 -4.233336 5 12.096330 15.036016 6 -4.255000 15.233745
The error when I run my short code is: Error in eval(expr, envir, enclos) : object 'nitrate' not found.
Best regards.
Aucun commentaire:
Enregistrer un commentaire