Skip to content

Commit

Permalink
bump part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
brownag committed Jan 2, 2025
1 parent 7bdb18f commit 7ff499d
Show file tree
Hide file tree
Showing 66 changed files with 8,762 additions and 14,592 deletions.
1 change: 0 additions & 1 deletion Part2/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
docs/
*.Rproj
_bookdown_files
8 changes: 6 additions & 2 deletions Part2/002-uncertainty.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ caret::confusionMatrix(cm)

#### Stratified-random/areal-adjustment

In the case of stratified-random samples or non-probability samples, it is necessary to adjust the class totals by their known area prior to calculating their accuracy or standard errors [@brus_sampling_2011; @stehman_estimating_2014; @campbell_introduction_2023; @congalton_basic_2019]. This is often the case when a minority class (e.g. minor component or small map unit) is sampled in excess of it's true proportion relative to the total sample set. This even equal sampling is a good idea in order to adequately sample small but important soil classes (e.g. hydric soils), which will result in greater precision of resulting classes. Surprisingly few R functions to include adjustmentss for these unequal weights, with the exception of the [`yardstick`](https://yardstick.tidymodels.org/), [`mapac`](https://pages.cms.hu-berlin.de/pflugmad/mapac/), and [`MetricsWeighted`](https://github.com/mayer79/MetricsWeighted) R packages. The [`survey`](http://r-survey.r-forge.r-project.org/survey/) R package also has numerous function to analyze design-based survey samples with varying sampling weights. Only the `mapac` R package provides estimates of the post stratified standard errors for the various confusion matrix derivatives.
In the case of stratified-random samples or non-probability samples, it is necessary to adjust the class totals by their known area prior to calculating their accuracy or standard errors [@brus_sampling_2011; @stehman_estimating_2014; @campbell_introduction_2023; @congalton_basic_2019]. This is often the case when a minority class (e.g. minor component or small map unit) is sampled in excess of it's true proportion relative to the total sample set. This even equal sampling is a good idea in order to adequately sample small but important soil classes (e.g. hydric soils), which will result in greater precision of resulting classes. Surprisingly few R functions to include adjustments for these unequal weights, with the exception of the [`yardstick`](https://yardstick.tidymodels.org/), [`mapac`](https://pages.cms.hu-berlin.de/pflugmad/mapac/), and [`MetricsWeighted`](https://github.com/mayer79/MetricsWeighted) R packages. The [`survey`](http://r-survey.r-forge.r-project.org/survey/) R package also has numerous function to analyze design-based survey samples with varying sampling weights. Only the `mapac` R package provides estimates of the post stratified standard errors for the various confusion matrix derivatives.

In the simplest case where the an existing soil class map is validated by an independent test dataset, it is only necessary to weight the confusion matrix using the prior probabilities of the original map.

Expand All @@ -813,7 +813,11 @@ caret::confusionMatrix(cm_wt2, positive = "TRUE")$byClass
```


However as is often the case, when the samples are stratified using environmental covariates the strata don't concidence with the resulting digital soil map, and therefore the accuracy and errors within each strata need to be estimate separately and then average using the strata sizes as weights [@brus_sampling_2011; @stehman_estimating_2014]. The sample weights will equal the total number of pixels each sample represents.
However as is often the case, when the samples are stratified using environmental covariates the strata don't coincide with the resulting digital soil map, and therefore the accuracy and errors within each strata need to be estimated separately and then averaged using the strata sizes as weights [@brus_sampling_2011; @stehman_estimating_2014]. The sample weights will equal the total number of pixels each sample represents.

```{r eval=!("mapac" %in% installed.packages())}
remotes::install_git("https://scm.cms.hu-berlin.de/pflugmad/mapac.git")
```

```{r}
Expand Down
2 changes: 1 addition & 1 deletion Part2/004-linear-models.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ options(timeout = 600)
library(soilDB)
prj <- get_project_from_NASISWebReport(mlrassoarea = "8-VIC", fiscalyear = 2015)
prj <- get_project_from_NASISWebReport(mlrassoarea = "SW-VIC", fiscalyear = 2015)
subset(prj, projectname == "MLRA 30 - Soil Climate Study - Soil Temperature")
Expand Down
12 changes: 5 additions & 7 deletions Part2/packages.bib
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,31 @@ @Manual{R-base
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = {2023},
year = {2024},
url = {https://www.R-project.org/},
}

@Manual{R-bookdown,
title = {bookdown: Authoring Books and Technical Documents with R Markdown},
author = {Yihui Xie},
year = {2024},
note = {R package version 0.38,
https://pkgs.rstudio.com/bookdown/},
note = {R package version 0.41},
url = {https://github.com/rstudio/bookdown},
}

@Manual{R-knitr,
title = {knitr: A General-Purpose Package for Dynamic Report Generation in R},
author = {Yihui Xie},
year = {2023},
note = {R package version 1.45},
year = {2024},
note = {R package version 1.49},
url = {https://yihui.org/knitr/},
}

@Manual{R-rmarkdown,
title = {rmarkdown: Dynamic Documents for R},
author = {JJ Allaire and Yihui Xie and Christophe Dervieux and Jonathan McPherson and Javier Luraschi and Kevin Ushey and Aron Atkins and Hadley Wickham and Joe Cheng and Winston Chang and Richard Iannone},
year = {2024},
note = {R package version 2.26,
https://pkgs.rstudio.com/rmarkdown/},
note = {R package version 2.29},
url = {https://github.com/rstudio/rmarkdown},
}

Expand Down
Binary file removed Part2/render430c7b3b73b6.rds
Binary file not shown.
Binary file modified Part2/rosm.cache/osm/9_142_195.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Part2/rosm.cache/osm/9_142_196.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Part2/s4ssbook.rds
Binary file not shown.
3 changes: 0 additions & 3 deletions Part2/tic.R

This file was deleted.

Loading

0 comments on commit 7ff499d

Please sign in to comment.