Natural Resource Management (NRM) research requires robust sampling frameworks to ensure reliable estimation of environmental variables such as biomass, soil loss, and carbon stocks. Challenges include spatial heterogeneity, accessibility constraints, and integration with geospatial data.
The NRMSampling package provides a unified and extensible framework for:
sf and terrasample_nrm <- data.frame(
plot_id = 1:100,
biomass = round(runif(100, 15, 65), 1),
soil_loss = round(runif(100, 0, 12), 2),
rainfall = round(runif(100, 800, 1500)),
slope = round(runif(100, 1, 35), 1),
strata = sample(c("forest", "grassland", "agriculture"), 100, replace = TRUE),
cluster = sample(1:10, 100, replace = TRUE),
size = round(runif(100, 0.5, 5.0), 2)
)
head(sample_nrm)
#> plot_id biomass soil_loss rainfall slope strata cluster size
#> 1 1 29.4 7.20 967 27.7 agriculture 2 2.93
#> 2 2 54.4 3.99 1474 1.3 agriculture 6 1.13
#> 3 3 35.4 5.86 1221 27.5 agriculture 10 1.78
#> 4 4 59.2 11.45 1161 25.8 forest 10 3.12
#> 5 5 62.0 5.79 1082 22.4 forest 9 1.24
#> 6 6 17.3 10.68 1416 17.4 agriculture 7 0.93srs <- srs_sample(sample_nrm, n = 25)
head(srs)
#> plot_id biomass soil_loss rainfall slope strata cluster size .sample_id
#> 1 45 22.6 10.11 1018 17.5 grassland 10 4.12 45
#> 2 76 26.0 7.42 1315 33.8 agriculture 2 2.36 76
#> 3 25 47.8 4.43 837 4.5 forest 4 0.53 25
#> 4 91 21.5 3.29 1008 34.2 grassland 6 0.57 91
#> 5 13 48.9 0.73 951 25.3 grassland 3 2.01 13
#> 6 84 54.4 3.18 957 27.2 agriculture 4 1.63 84st <- stratified_sample(sample_nrm, strata_var = "strata", n_per_stratum = 8)
table(st$strata)
#>
#> agriculture forest grassland
#> 8 8 8cl <- cluster_sample(sample_nrm, cluster_var = "cluster", n_clusters = 4)
length(unique(cl$cluster))
#> [1] 4pps <- pps_sample(sample_nrm, size_var = "size", n = 20)
summary(pps$.inclusion_prob)
#> Min. 1st Qu. Median Mean 3rd Qu. Max.
#> 0.1065 0.2064 0.2512 0.2557 0.3375 0.3735conv <- convenience_sample(sample_nrm, n = 10)
purp <- purposive_sample(sample_nrm, "biomass > 45 & strata == 'forest'")
quot <- quota_sample(sample_nrm, strata_var = "strata", quota = 6)
table(quot$strata)
#>
#> agriculture forest grassland
#> 6 6 6N <- nrow(sample_nrm)
srs_est <- srs_sample(sample_nrm, n = 30)
estimate_mean(srs_est$biomass)
#> [1] 42.51333
estimate_total(srs_est$biomass, N = N)
#> [1] 4251.333
estimate_se(srs_est$biomass, N = N)
#> [1] 2.473553X_total <- sum(sample_nrm$size)
X_mean <- mean(sample_nrm$size)
ratio_estimator(srs_est$biomass, srs_est$size, X_total)
#> [1] 4838.863
regression_estimator(srs_est$biomass, srs_est$size, X_mean)
#> x
#> 41.75855ht_estimator(pps$biomass, pps$.inclusion_prob)
#> [1] 3146.885
ht_variance(pps$biomass, pps$.inclusion_prob)
#> [1] 219171.7N_h <- table(sample_nrm$strata)
stratified_estimator(st$biomass, st$strata, N_h)
#> [1] 43.952bio <- biomass_estimate(srs_est, biomass_var = "biomass", area = 1500)
bio$total_biomass
#> [1] 63770
carbon_stock_estimate(srs_est, biomass_var = "biomass", area = 1500)
#> $total_biomass
#> [1] 63770
#>
#> $total_carbon
#> [1] 29971.9
#>
#> $carbon_fraction
#> [1] 0.47
#>
#> $n
#> [1] 30sl <- soil_loss_estimate(srs_est, loss_var = "soil_loss", area = 1500)
sl$total_loss
#> [1] 10328.5srs1 <- srs_sample(sample_nrm, n = 20)
srs2 <- srs_sample(sample_nrm, n = 40)
sampling_efficiency(srs1$biomass, srs2$biomass, N = 100)
#> var_design1 var_design2 relative_efficiency
#> 6.804753 3.005700 2.263900library(sf)
sample_spatial <- data.frame(
lon = runif(50, 77.8, 78.2),
lat = runif(50, 30.1, 30.4)
)
pts_sf <- to_sf_points(sample_spatial, lon = "lon", lat = "lat")
head(pts_sf)The NRMSampling package provides a comprehensive and scalable framework for sampling and estimation in NRM research. It enables researchers to adopt statistically sound methodologies while ensuring reproducibility and integration with spatial data systems.
Cochran, W.G. (1977). Sampling Techniques. Lohr, S.L. (2022). Sampling: Design and Analysis. Horvitz, D.G. and Thompson, D.J. (1952). IPCC (2006). Guidelines for Greenhouse Gas Inventories.