| Title: | Design-Based Estimators for NILS |
|---|---|
| Description: | Estimators and variance estimators tailored to the NILS hierarchical design (Adler et al. 2020, <https://res.slu.se/id/publ/105630>; Grafström et al. 2023, <https://res.slu.se/id/publ/128235>). The National Inventories of Landscapes in Sweden (NILS) is a long-term national monitoring program that collects, analyses and presents data on Swedish nature, covering both common and rare habitats <https://www.slu.se/om-slu/organisation/institutioner/skoglig-resurshushallning/miljoanalys/nils/>. |
| Authors: | Wilmer Prentius [aut, cre] (ORCID: <https://orcid.org/0000-0002-3561-290X>) |
| Maintainer: | Wilmer Prentius <[email protected]> |
| License: | AGPL-3 |
| Version: | 0.1.1 |
| Built: | 2026-06-04 08:49:58 UTC |
| Source: | https://github.com/envisim/nilsier |
Estimators and variance estimators tailored to the NILS hierarchical design (Adler et al. 2020, https://res.slu.se/id/publ/105630; Grafström et al. 2023, https://res.slu.se/id/publ/128235). The National Inventories of Landscapes in Sweden (NILS) is a long-term national monitoring program that collects, analyses and presents data on Swedish nature, covering both common and rare habitats https://www.slu.se/om-slu/organisation/institutioner/skoglig-resurshushallning/miljoanalys/nils/.
Estimates are produced per category and tract, and subsequently combined. Variance estimation takes into account some of the dependencies that exists between categories.
If the PSU collections were drawn using some spatially balanced design, the variance estimator assuming OSU sampling of PSUs will overestimate the variance. An alternative variance, such as the local mean variance estimator, can be used in order to reduce this overestimation somewhat (Grafström & Schelin, 2014).
The primary sampling unit is a tract, and in the first step, a large number of tracts are selected (PSU1). From the collection PSU1, a smaller sample of tracts is drawn to form PSU2, and this process continues to subsequent levels.
Each tract consists of a grid of 14 x 14 circular plots, each with a 10 m radius.
Amongst PSU1, some categories (strata) are identified. The plots in the tracts are assigned to one of these categories or marked as unclassified (considered uninteresting at that stage). Within each tract, a sample of plots is then drawn from each category.
At lower PSU levels, additional categories are introduced, and previously unclassified plots are assigned to one of these new categories.
For further details on the design (in Swedish), see e.g. Adler et al. (2020) and Grafström et al. (2023).
Wilmer Prentius [email protected].
Adler, S., Christensen, P., Gardfjell, H., Grafström, A., Hagner, Å., Hedenås, H., & Ranlund, Å. (2020). Ny design för riktade naturtypsinventeringar inom NILS och THUF. Arbetsrapport 513. Institutionen för skoglig resurshushållning, Sveriges lantbruksuniversitet, SLU.
Grafström, A., Randlund, Å., & Adler, S. (2023). Skattningar baserade på hierarkiska urval. Arbetsrapport 558. Institutionen för skoglig resurshushållning, Sveriges lantbruksuniversitet, SLU.
Grafström, A., & Schelin, L. (2014). How to select representative samples. Scandinavian Journal of Statistics, 41(2), 277-290.
Useful links:
Accesses the estimate and variance estimate of a NilsEstimate object.
## S3 method for class 'NilsEstimate' coef(object, ...)## S3 method for class 'NilsEstimate' coef(object, ...)
object |
A NilsEstimate object. |
... |
Additional arguments (currently unused). |
A named vector with the following elements:
Estimated total of the target variable.
Estimated variance of the total estimator.
obj = NilsEstimate(plots, tracts, psus, category_psu_map); coef(obj);obj = NilsEstimate(plots, tracts, psus, category_psu_map); coef(obj);
Filters a NilsEstimate object by PSU level or category.
efilter(obj, ...) ## S3 method for class 'NilsEstimate' efilter(obj, psus = NULL, categories = NULL, ...)efilter(obj, ...) ## S3 method for class 'NilsEstimate' efilter(obj, psus = NULL, categories = NULL, ...)
obj |
A NilsEstimate object. |
... |
Additional arguments (currently unused) |
psus |
An optional vector of PSU IDs to keep. |
categories |
An optional vector of the category IDs to keep. |
a filtered NilsEstimate object.
obj = NilsEstimate(plots, tracts, psus, category_psu_map); # Keep only category with ID 1 efilter(obj, categories = 1) # Keep PSU 5 efilter(obj, psus = 5)obj = NilsEstimate(plots, tracts, psus, category_psu_map); # Keep only category with ID 1 efilter(obj, categories = 1) # Keep PSU 5 efilter(obj, psus = 5)
Estimates the total of some variable surveyed under the NILS hierarchical sampling framework.
NilsEstimate( plot_data, tract_data, psus, category_psu_map, area = 46519242.1175867, tract_area = 196 * 100 * pi ) NilsEstimateBalanced( plot_data, tract_data, auxiliaries, psus, category_psu_map, area = 46519242.1175867, tract_area = 196 * 100 * pi, size_of_neighbourhood = NULL )NilsEstimate( plot_data, tract_data, psus, category_psu_map, area = 46519242.1175867, tract_area = 196 * 100 * pi ) NilsEstimateBalanced( plot_data, tract_data, auxiliaries, psus, category_psu_map, area = 46519242.1175867, tract_area = 196 * 100 * pi, size_of_neighbourhood = NULL )
plot_data |
A data frame with information about observations at the plot level. Must contain (in order):
|
tract_data |
A matrix with information about all sampled tracts, including those where no relevant categories were found. Must contain (in order):
|
psus |
An ordered vector of PSU levels, from largest to smallest. |
category_psu_map |
A matrix describing the categories used in the design. Must contain (in order):
|
area |
The size of the area frame. Typically larger than the actual area of interest. |
tract_area |
The area of a tract, expressed in the same units as the target variable. |
auxiliaries |
A numeric matrix of auxiliary variables used for balancing. Must have the same
dimensions and order as |
size_of_neighbourhood |
An optional numeric vector specifying the neighbourhood size for each PSU level. |
The function combines plot-level observations (plot_data), tract-level information
(tract_data), PSU hierarchy (psus), and category assignments (category_psu_map) to estimate
totals under the NILS sampling design.
NilsEstimateBalanced
In the balanced variant, variance is estimated using a local neighbourhood deviance measure. The neighbourhood size defaults to 4 for the smallest PSU level and increases linearly with PSU level size.
Covariance between categories belonging to different PSU levels are measured over their intersection, i.e. on the smaller PSU collections. Consequently, the smaller PSU collection also determines the local neighbourhood size.
It is possible to provide a matrix as psus instead of a vector. This matrix should contain:
PSU IDs, ordered from largest to smallest (by PSU size).
The neighbourhood size for each PSU.
If psus is provided as a vector, the neighbourhood size of PSU defaults to
where is the size of PSU collection , and is the size of the
smallest PSU collection.
A NilsEstimate object, essentially a data frame with one row per category and the
following columns:
The category ID number.
The estimated total of the target variable within the category.
The estimated variance of the total estimator within the category.
The number of tracts with at least one positive value of the target variable in the category.
obj = NilsEstimate(plots, tracts, psus, category_psu_map); obj = NilsEstimateBalanced( plots, tracts, tract_auxiliaries, psus, category_psu_map );obj = NilsEstimate(plots, tracts, psus, category_psu_map); obj = NilsEstimateBalanced( plots, tracts, tract_auxiliaries, psus, category_psu_map );
Reorders and extracts columns from a data frame to create a valid plot_data object.
Column names are supplied as formulas for convenience.
PreparePlotData(data, tid, cat, dw, y)PreparePlotData(data, tid, cat, dw, y)
data |
A data.frame containing plot-level information. |
tid |
A formula specifying the column containing tract IDs. |
cat |
A formula specifying the column containing category IDs. |
dw |
A formula specifying the column containing design weights. |
y |
A formula specifying the column containing the variable of interest. |
A data frame with the required column order for use as plot_data:
Tract ID (integer).
Category ID (integer).
Design weight (double).
Value of the variable of interest (double).
wide_df = data.frame( variable_y = runif(16), variable_x = runif(16), variable_z = runif(16), grassland_cover = plots[, 4], design_weight = plots[, 3], category = plots[, 2], tract_id = plots[, 1] ); plot_data = PreparePlotData( wide_df, ~tract_id, ~category, ~design_weight, ~grassland_cover );wide_df = data.frame( variable_y = runif(16), variable_x = runif(16), variable_z = runif(16), grassland_cover = plots[, 4], design_weight = plots[, 3], category = plots[, 2], tract_id = plots[, 1] ); plot_data = PreparePlotData( wide_df, ~tract_id, ~category, ~design_weight, ~grassland_cover );
Prints a summary of a NilsEstimate object.
## S3 method for class 'NilsEstimate' print(x, complete = TRUE, ...)## S3 method for class 'NilsEstimate' print(x, complete = TRUE, ...)
x |
A NilsEstimate object. |
complete |
Logical. If |
... |
Additional arguments (currently unused) |
Invisibly returns the input NilsEstimate object.
Produces summary statistics for a NilsEstimate object.
## S3 method for class 'NilsEstimate' summary(object, ...) ## S3 method for class 'summary.NilsEstimate' print(x, ...)## S3 method for class 'NilsEstimate' summary(object, ...) ## S3 method for class 'summary.NilsEstimate' print(x, ...)
object |
A NilsEstimate object. |
... |
Additional arguments (currently unused). |
x |
The returned list has the following components:
Estimated total of the target variable.
Estimated variance of the total estimator.
Estimated relative standard error of the total estimator.
Number of non-nil tracts. Not shown if filtering has been applied.
obj = NilsEstimate(plots, tracts, psus, category_psu_map); summary(obj);obj = NilsEstimate(plots, tracts, psus, category_psu_map); summary(obj);
The dataset includes information collected in the southern boreal region of Sweden (i.e. the boreal region South of the Dal River).
tracts tract_auxiliaries plots psus category_psu_maptracts tract_auxiliaries plots psus category_psu_map
tractsA matrix with 300 rows (tracts)
the tract id number
the id number of the collection of primary sampling units (PSU) of the tract
tract_auxiliariesA matrix with 300 rows (auxiliary information about the tracts)
longitude of the tract centre
latitude of the tract centre
the tract's maximum elevation
the tract's elevation range
the area of the tract covered by buildings
the area of the tract covered by open land
the area of the tract covered by forest
the area of the tract covered by low-growth mountain forest
the tract's mean wetness
the area of the tract covered by deciduous forest
the area of the tract covered by arable land
the area of the tract covered by pasture
plotsA matrix with 16 rows (plots)
the tract id number of the tract containing this plot
the category (stratum) of the plot
the conditional design weight of the plot (inverse inclusion probability)
the variable of interest – the area of the (r=10) plot covered by grassland
psusA length 2 ordered vector of PSU collection id numbers, ranging from the largest PSU level to the smallest PSU level
category_psu_mapA matrix with 2 rows (categories), containing the mapping of the largest PSU that the category map to.
the category (stratum) id number
the id number of the largest PSU that the category can be observed in
This sample is a reduced version of the original data, containing only the two sparsest subsamples and the two strata (selection classes/categories) sampled within them.
https://www.slu.se/om-slu/organisation/institutioner/skoglig-resurshushallning/miljoanalys/nils/
Accesses the covariance matrix of a NilsEstimate object.
## S3 method for class 'NilsEstimate' vcov(object, complete = TRUE, ...)## S3 method for class 'NilsEstimate' vcov(object, complete = TRUE, ...)
object |
A NilsEstimate object. |
complete |
Logical. If |
... |
Additional arguments (currently unused). |
the covariance matrix of the NilsEstimate object.
obj = NilsEstimate(plots, tracts, psus, category_psu_map); vcov(obj);obj = NilsEstimate(plots, tracts, psus, category_psu_map); vcov(obj);