Last updated: 2020-09-30

Checks: 7 0

Knit directory: baumarten/analysis/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20200723) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version d0bed37. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    analysis/.Rhistory
    Ignored:    data/sen2/

Untracked files:
    Untracked:  baumarten_viz.qgz
    Untracked:  data/mask/
    Untracked:  data/reference/bi/bi2017_nlf_classificationresult_by_bestandestyp_ba-greater-075.csv
    Untracked:  data/reference/bi/bi2017_nlf_speciescomposition_by_roi_ba-greater-075.csv
    Untracked:  data/reference/bi/bi2017_nlf_tblDatPh2.csv
    Untracked:  data/reference/bi/bi2017_nlf_tblDatPh2_Vorr.csv
    Untracked:  data/reference/bi/bi2018_nlf_classificationresult_by_bestandestyp.csv
    Untracked:  data/reference/bi/bi2018_nlf_speciescomposition_by_roi.csv
    Untracked:  output/baumartenanteile_bi_vs_fe.png
    Untracked:  roi_extents.cpg
    Untracked:  roi_extents.dbf
    Untracked:  roi_extents.prj
    Untracked:  roi_extents.qpj
    Untracked:  roi_extents.shp
    Untracked:  roi_extents.shx

Unstaged changes:
    Modified:   code/workflow_project_setup.R

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/reference_data.Rmd) and HTML (docs/reference_data.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd d0bed37 wiesehahn 2020-09-30 update reference analysis for myproject
html d1fc2e3 wiesehahn 2020-09-29 Build site.
Rmd 9e97323 wiesehahn 2020-09-29 Publish additional files for myproject
html 07198c2 wiesehahn 2020-09-25 Build site.
Rmd ac7e4fd wiesehahn 2020-09-25 wflow_publish(c(“analysis/reference_data.Rmd”, “code/bi_species_shares.R”,
html 0dc5644 wiesehahn 2020-09-08 Build site.
Rmd 30d98a7 wiesehahn 2020-09-08 Change filenames, add analysis

Reference Data

The reference data was sampled in three project areas (Harz, Heide, Solling).

Reference data sampling locations

Number of reference data polygons by tree species

Number of reference data polygons by site

Number of reference data polygons by tree species and site


Reference Probability

Classification probabilities were extracted for each pixel inside reference polygons. The extracted values grant insight in classification certainty by tree species and reference site.

Classification probability by site and tree species for reference data locations


Mapping Accuracy

Reference data for validation

Class predictions for all reference pixels were extracted from the model prediction raster. These predictions were thought to be compared with the reference data label to produce an error matrix. The accuracy was expected to be biased since we used part of the reference data for training the model. But instead, all reference data was classified correctly. This might suggest that the model is overfitted to the reference data, performing very well on the reference data but weaker outside.

Error Matrix
BU DGL FI KI LAE EI
BU 8025 0 0 0 0 0
DGL 0 1760 0 0 0 0
FI 0 0 9495 0 0 0
KI 0 0 0 1896 0 0
LAE 0 0 0 0 3232 0
EI 0 0 0 0 0 6082

National forest inventory data for validation

BWI-plots in Lower Saxony were filtered by certain criteria to serve as validation data. Only plots with a relative tree species proportion of more than 75% in the main canopy layer for one of the classified tree species groups were considered. Class predictions for all pixels covered by these plots were extracted from the model prediction raster and compared against the inventory data.

Error Matrix
BU DGL FI KI LAE EI
BU 147 0 7 3 1 9
DGL 1 5 18 63 0 0
FI 1 1 155 25 0 0
KI 1 1 23 180 1 0
LAE 17 1 34 95 15 12
EI 27 0 4 7 0 27
Respective Accuracy
Accuracy Kappa
0.600454 0.4968075

Federal forest inventory data for validation

BI-plots within the study areas were used as validation data. Plot data was aggregated by species group and basal area was used to determine the dominant tree species per plot. Only plots with a relative basal area proportion of at least 75% for one of the classified tree species groups were considered. Plots with a more heterogeneous species cover and plots dominated by other species groups were not considered. Class predictions for these plots were extracted from the model prediction raster and compared against the inventory data.

Map overview

Reference data sampling locations

Error Matrix
BU DGL FI KI LAE EI
BU 1380 4 246 1 58 28
DGL 8 59 213 8 5 0
FI 9 13 3845 25 5 1
KI 12 7 342 127 10 3
LAE 197 16 625 36 118 27
EI 202 9 82 3 38 226
Respective Accuracy
Accuracy Kappa
0.7204557 0.5462186

R version 4.0.2 (2020-06-22)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252   
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C                   
[5] LC_TIME=German_Germany.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] rasterVis_0.48      latticeExtra_0.6-29 here_0.1           
 [4] spdplyr_0.4.0       kableExtra_1.1.0    RColorBrewer_1.1-2 
 [7] caret_6.0-86        lattice_0.20-41     plotly_4.9.2.1     
[10] forcats_0.5.0       stringr_1.4.0       dplyr_1.0.0        
[13] purrr_0.3.4         readr_1.3.1         tidyr_1.1.0        
[16] tibble_3.0.3        ggplot2_3.3.2       tidyverse_1.3.0    
[19] formattable_0.2.0.1 raster_3.3-13       leaflet_2.0.3      
[22] rgdal_1.5-12        sp_1.4-2            workflowr_1.6.2    

loaded via a namespace (and not attached):
 [1] colorspace_1.4-1        ellipsis_0.3.1          class_7.3-17           
 [4] rprojroot_1.3-2         fs_1.4.2                rstudioapi_0.11        
 [7] hexbin_1.28.1           farver_2.0.3            prodlim_2019.11.13     
[10] fansi_0.4.1             lubridate_1.7.9         xml2_1.3.2             
[13] codetools_0.2-16        splines_4.0.2           knitr_1.29             
[16] jsonlite_1.7.0          pROC_1.16.2             broom_0.7.0            
[19] dbplyr_1.4.4            rgeos_0.5-5             png_0.1-7              
[22] compiler_4.0.2          httr_1.4.2              backports_1.1.7        
[25] assertthat_0.2.1        Matrix_1.2-18           lazyeval_0.2.2         
[28] cli_2.0.2               later_1.1.0.1           leaflet.providers_1.9.0
[31] htmltools_0.5.0         tools_4.0.2             gtable_0.3.0           
[34] glue_1.4.1              reshape2_1.4.4          Rcpp_1.0.5             
[37] cellranger_1.1.0        vctrs_0.3.2             nlme_3.1-148           
[40] iterators_1.0.12        crosstalk_1.1.0.1       timeDate_3043.102      
[43] gower_0.2.2             xfun_0.15               rvest_0.3.6            
[46] lifecycle_0.2.0         zoo_1.8-8               MASS_7.3-51.6          
[49] scales_1.1.1            ipred_0.9-9             hms_0.5.3              
[52] promises_1.1.1          parallel_4.0.2          yaml_2.2.1             
[55] rpart_4.1-15            stringi_1.4.6           highr_0.8              
[58] foreach_1.5.0           e1071_1.7-3             lava_1.6.7             
[61] rlang_0.4.7             pkgconfig_2.0.3         spbabel_0.5.1          
[64] evaluate_0.14           recipes_0.1.13          htmlwidgets_1.5.1      
[67] tidyselect_1.1.0        plyr_1.8.6              magrittr_1.5           
[70] R6_2.4.1                generics_0.0.2          DBI_1.1.0              
[73] pillar_1.4.6            haven_2.3.1             whisker_0.4            
[76] withr_2.2.0             survival_3.2-3          nnet_7.3-14            
[79] modelr_0.1.8            crayon_1.3.4            rmarkdown_2.3          
[82] jpeg_0.1-8.1            grid_4.0.2              readxl_1.3.1           
[85] data.table_1.12.8       blob_1.2.1              git2r_0.27.1           
[88] ModelMetrics_1.2.2.2    reprex_0.3.0            digest_0.6.25          
[91] webshot_0.5.2           httpuv_1.5.4            stats4_4.0.2           
[94] munsell_0.5.0           viridisLite_0.3.0