Logistic regression

We will use logistic regression here as it can be used to model dependent variables with values of 1 (for our case, landslide) and 0 (no landslide):

logistic_fit = glm(as.factor(hazard)~ DEM_PC_UTM + Slope_PC, data=landslide, family=binomial)summary(logistic_fit)

Now, using the estimates of Intercept and coefficients, we calculate the susceptibility. For this case, the value of (Intercept) is 3.111299, the value of DEM_PC_UTM is -0.010680, and the value of Slope_PC is -0.123692. You might find something different for these values.

Now, load the elevation and slope raster:

library(raster)dem = raster("F:/Hands-on Geospatial ...

Get Hands-On Geospatial Analysis with R and QGIS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.