Exercises WS 2
- The marginal entropy and relative mutual information can be calculated using the landscapemetrics package’s functions:
lsm_l_ent()andlsm_l_relmutinf(). Calculate both of these metrics for theexdata/lc_small.tifraster. - Read the
exdata/lc_europe.tifraster usingrast()from the terra package and theexdata/polygons.gpkgvector data using theread_sf()function from the sf package. Calculate the marginal entropy and relative mutual information for each polygon using thesample_lsm()function. - Join the calculated values with the polygons (see https://r-spatialecology.github.io/landscapemetrics/articles/irregular_areas.html for more details).
- Calculate SHDI and AI for the polygons. Compare the values of SHDI and AI with the marginal entropy and relative mutual information (e.g., using a scatterplot or by calculating the correlation coefficient). Are the results similar?
- (Extra) Create your own polygonal grid using
st_make_grid()function from the sf package for the area from theexdata/polygons.gpkgfile. Calculate the marginal entropy and relative mutual information for each square using thesample_lsm()function. Visualize the results.