-1

I am a master's student and I am trying to use radar observables derived from SAR imagery to predict Landsat 8 Enhanced Vegetation Index (EVI) for different seasons. I have extracted EVI and various SAR observables values from field boundaries. I would like to use values from representative data for one Summer image and one Winter image as training to predict EVI across only Summer and Winter seasons using Random Forest in R.

However, I am new to R and I have not performed Random Forest regression in R using spatial data. Therefore, I would just like to know how to go about this?

closed as too broad by Spacedman, BERA, whyzar, Kersten, xunilk Jan 17 '18 at 17:14

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • How long have you got? You should learn some basic R first, then learn spatial data handling, then learn about regression, then regression as applied by random forests, and then how to apply random forests to spatial data. – Spacedman Jan 17 '18 at 12:59
  • What would make you think that there is an empirical relationship between an active sensor such as SAR, specifically backscatter, and a metric derived from a passive sensor? Sorry, but this just does not track from any theoretical perspective. – Jeffrey Evans Jan 24 '18 at 2:45
1

If you can't handle spatial data, transform it into a data.frame.

In a really coarse example (model's performance will be very bad, rasters are totally random):

library(raster)
library(randomForest)

set.seed(123)

r <- raster(nrows = 10, ncols = 20)
r1 <- r
r1[] <- rnorm(200, mean = 0, sd = 0.5)
r2 <- r
r2[] <- rnorm(200, mean = 0, sd = 1)
r3 <- r
r3[] <- rnorm(200, mean = 2, sd = 0.5)
r4 <- r
r4[] <- rnorm(200, mean = 1, sd = 1)

s <- stack(r1,r2,r3,r4)

names(s) <- c('x','y','z','w')

train <- raster::sampleRandom(s,30)

rf <- randomForest(x ~ y + z + w, data = train)

prd <- predict(rf, newdata = as.data.frame(s[[2:4]]))

r[] <- prd

plot(cbind(as.data.frame(r), as.data.frame(r1)), xlab = 'observed', ylab = 'predicted')

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.