Sampling

First we’ll load up the package and some data:

library(forestmangr)
data(exfm1)
data(exfm2)
data(exfm3)
data(exfm4)
data(exfm5)

data_acs_pilot <- as.data.frame(exfm3)
data_acs_def <- as.data.frame(exfm4)
data_ace_pilot <- as.data.frame(exfm1)
data_ace_def <- as.data.frame(exfm2)
data_as <- as.data.frame(exfm5)

Simple Random Sampling

The objective of this example is to survey an area of 46.8 ha using the simple random sampling method. The aimed error is 20%. 10 plots of 3000 m² each were measured for a pilot inventory. The data collected is shown below:

data_acs_pilot
#>    TOTAL_AREA PLOT_AREA VWB
#> 1        46.8      3000  41
#> 2        46.8      3000  33
#> 3        46.8      3000  24
#> 4        46.8      3000  31
#> 5        46.8      3000  10
#> 6        46.8      3000  32
#> 7        46.8      3000  62
#> 8        46.8      3000  16
#> 9        46.8      3000  66
#> 10       46.8      3000  25

Now we’ll calculate the inventory variables for a 20% error, considering a finite population with the sprs function. Area values must be inserted in square meters, and total area values must be in hectares:

sprs(data_acs_pilot, "VWB", 3000, 46.8,error = 20, pop = "fin")
#>                                        Variables    Values
#> 1              Total number of sampled plots (n)   10.0000
#> 2                    Number of maximum plots (N)  156.0000
#> 3                      Variance Quoeficient (VC)   53.2670
#> 4                                      t-student    2.2622
#> 5                         recalculated t-student    2.0452
#> 6  Number of samples regarding the admited error   25.0000
#> 7                                       Mean (Y)   34.0000
#> 8                Standard error of the mean (Sy)    5.5405
#> 9                                 Absolute Error   12.5335
#> 10                            Relative Error (%)   36.8634
#> 11                  Estimated Total Value (Yhat) 5304.0000
#> 12                                   Total Error 1955.2326
#> 13             Inferior Confidence Interval (m3)   21.4665
#> 14             Superior Confidence Interval (m3)   46.5335
#> 15          Inferior Confidence Interval (m3/ha)   71.5549
#> 16          Superior Confidence Interval (m3/ha)  155.1118
#> 17       inferior Total Confidence Interval (m3) 3348.7674
#> 18       Superior Total Confidence Interval (m3) 7259.2326

With these results, we can see that in order to meet the desired error, we’ll need 15 more samples. After a new survey was done, this are the new data:

data_acs_def
#>    TOTAL_AREA PLOT_AREA VWB
#> 1        46.8      3000  41
#> 2        46.8      3000  33
#> 3        46.8      3000  24
#> 4        46.8      3000  31
#> 5        46.8      3000  10
#> 6        46.8      3000  32
#> 7        46.8      3000  62
#> 8        46.8      3000  16
#> 9        46.8      3000  66
#> 10       46.8      3000  25
#> 11       46.8      3000  44
#> 12       46.8      3000   7
#> 13       46.8      3000  57
#> 14       46.8      3000  22
#> 15       46.8      3000  31
#> 16       46.8      3000  40
#> 17       46.8      3000  43
#> 18       46.8      3000  27
#> 19       46.8      3000  17
#> 20       46.8      3000  50
#> 21       46.8      3000  38
#> 22       46.8      3000  20
#> 23       46.8      3000  35
#> 24       46.8      3000  31
#> 25       46.8      3000  26

Now the definitive inventory can be done:

sprs(data_acs_def, "VWB", 3000, 46.8, error = 20, pop = "fin")
#>                                        Variables    Values
#> 1              Total number of sampled plots (n)   25.0000
#> 2                    Number of maximum plots (N)  156.0000
#> 3                      Variance Quoeficient (VC)   45.4600
#> 4                                      t-student    2.0639
#> 5                         recalculated t-student    2.0930
#> 6  Number of samples regarding the admited error   20.0000
#> 7                                       Mean (Y)   33.1200
#> 8                Standard error of the mean (Sy)    2.7595
#> 9                                 Absolute Error    5.6952
#> 10                            Relative Error (%)   17.1957
#> 11                  Estimated Total Value (Yhat) 5166.7200
#> 12                                   Total Error  888.4555
#> 13             Inferior Confidence Interval (m3)   27.4248
#> 14             Superior Confidence Interval (m3)   38.8152
#> 15          Inferior Confidence Interval (m3/ha)   91.4159
#> 16          Superior Confidence Interval (m3/ha)  129.3841
#> 17       inferior Total Confidence Interval (m3) 4278.2645
#> 18       Superior Total Confidence Interval (m3) 6055.1755

The desired error was met.

The area values can also be inserted as variables:

sprs(data_acs_def, "VWB", "PLOT_AREA", "TOTAL_AREA", 
     error = 20, pop = "fin")
#>                                        Variables    Values
#> 1              Total number of sampled plots (n)   25.0000
#> 2                    Number of maximum plots (N)  156.0000
#> 3                      Variance Quoeficient (VC)   45.4600
#> 4                                      t-student    2.0639
#> 5                         recalculated t-student    2.0930
#> 6  Number of samples regarding the admited error   20.0000
#> 7                                       Mean (Y)   33.1200
#> 8                Standard error of the mean (Sy)    2.7595
#> 9                                 Absolute Error    5.6952
#> 10                            Relative Error (%)   17.1957
#> 11                  Estimated Total Value (Yhat) 5166.7200
#> 12                                   Total Error  888.4555
#> 13             Inferior Confidence Interval (m3)   27.4248
#> 14             Superior Confidence Interval (m3)   38.8152
#> 15          Inferior Confidence Interval (m3/ha)   91.4159
#> 16          Superior Confidence Interval (m3/ha)  129.3841
#> 17       inferior Total Confidence Interval (m3) 4278.2645
#> 18       Superior Total Confidence Interval (m3) 6055.1755

It’s also possible to run multiple simple random sampling inventories. To demonstrate this, we’ll use the example dataset for stratified sampling, but running simple random statistics. We’ll still use the sprs function, but use the .groups argument to run a simple random sampling inventory for each stratum:

sprs(data_ace_def, "VWB", "PLOT_AREA", "STRATA_AREA",
     .groups = "STRATA" ,error = 20, pop = "fin")
#>                                        Variables  STRATA1   STRATA2
#> 1              Total number of sampled plots (n)  14.0000   20.0000
#> 2                    Number of maximum plots (N) 144.0000  164.0000
#> 3                      Variance Quoeficient (VC)  24.4785   15.8269
#> 4                                      t-student   2.1604    2.0930
#> 5                         recalculated t-student   2.4469    4.3027
#> 6  Number of samples regarding the admited error   9.0000   11.0000
#> 7                                       Mean (Y)   6.0357   12.0150
#> 8                Standard error of the mean (Sy)   0.3752    0.3984
#> 9                                 Absolute Error   0.8105    0.8339
#> 10                            Relative Error (%)  13.4288    6.9409
#> 11                  Estimated Total Value (Yhat) 869.1429 1970.4600
#> 12                                   Total Error 116.7157  136.7670
#> 13             Inferior Confidence Interval (m3)   5.2252   11.1811
#> 14             Superior Confidence Interval (m3)   6.8462   12.8489
#> 15          Inferior Confidence Interval (m3/ha)  52.2519  111.8105
#> 16          Superior Confidence Interval (m3/ha)  68.4624  128.4895
#> 17       inferior Total Confidence Interval (m3) 752.4271 1833.6930
#> 18       Superior Total Confidence Interval (m3) 985.8586 2107.2270
#>      STRATA3
#> 1    23.0000
#> 2   142.0000
#> 3    16.7813
#> 4     2.0739
#> 5     4.3027
#> 6    12.0000
#> 7    13.7435
#> 8     0.4402
#> 9     0.9130
#> 10    6.6431
#> 11 1951.5739
#> 12  129.6455
#> 13   12.8305
#> 14   14.6565
#> 15  128.3048
#> 16  146.5647
#> 17 1821.9284
#> 18 2081.2194

Stratified Random Sampling

The objective of this example is to survey an area using the stratified random sampling method. The area was divided into 3 strata: one with 14.4 ha and 7 plots, another with 16.4 ha and 8 plots, and another with 14.2 ha and 7 plots. The plots have an area of 1000 square meters. In total, 22 plots were sampled for the pilot inventory. The data is shown below:

data_ace_pilot
#>    STRATA STRATA_AREA PLOT_AREA   VWB
#> 1       1        14.4      1000  7.90
#> 2       1        14.4      1000  3.80
#> 3       1        14.4      1000  4.40
#> 4       1        14.4      1000  6.25
#> 5       1        14.4      1000  5.55
#> 6       1        14.4      1000  8.10
#> 7       1        14.4      1000  6.10
#> 8       2        16.4      1000 10.20
#> 9       2        16.4      1000 15.25
#> 10      2        16.4      1000 13.40
#> 11      2        16.4      1000 13.60
#> 12      2        16.4      1000 14.20
#> 13      2        16.4      1000  9.85
#> 14      2        16.4      1000 10.20
#> 15      2        16.4      1000 11.55
#> 16      3        14.2      1000 10.65
#> 17      3        14.2      1000 12.15
#> 18      3        14.2      1000 14.60
#> 19      3        14.2      1000 10.90
#> 20      3        14.2      1000 16.55
#> 21      3        14.2      1000 17.90
#> 22      3        14.2      1000 13.35

We’ll calculate the statistics with an aimed error of 5%, considering a finite population using the strs function. Area values can be inserted as a numeric vector, or as a variable. The plot area must be inserted in square meters, and strata area must be in hectares:

strs(data_ace_pilot, "VWB", 3000, c(14.4, 16.4, 14.2), 
     strata = "STRATA", error = 5, pop = "fin")
#> $Table1
#>                                             Variables  STRATA 1  STRATA 2
#> 1                                           Plot Area 3000.0000 3000.0000
#> 2            Number of sampled plots per stratum (nj)    7.0000    8.0000
#> 3                   Total number of sampled plots (n)   22.0000   22.0000
#> 4            Number of maximum plots per stratum (Nj)   48.0000   54.6667
#> 5                         Number of maximum plots (N)  150.0000  150.0000
#> 6                                     Nj/N Ratio (Pj)    0.3200    0.3644
#> 7                                   Stratum sum (Eyj)   42.1000   98.2500
#> 8                        Stratum quadratic sum (Eyj2)  268.8950 1237.2275
#> 9                         Mean of Yi per stratum (Yj)    6.0143   12.2812
#> 10                                              PjSj2    0.8370    1.5929
#> 11                                               PjSj    0.5175    0.7619
#> 12                                               PjYj    1.9246    4.4758
#> 13                                             EPjSj2    4.8614    4.8614
#> 14                                              EPjSj    2.1554    2.1554
#> 15                                Stratified mean (Y)   10.7325   10.7325
#> 16                          Variance Quoeficient (VC)   20.0829   20.0829
#> 17                                          t-student    2.0796    2.0796
#> 18                             recalculated t-student    2.0129    2.0129
#> 19      Number of samples regarding the admited error   45.0000   45.0000
#> 20 Optimal number of samples per stratum (nj optimal)   11.0000   16.0000
#> 21              Optimal number of samples (n optimal)   46.0000   46.0000
#> 22               Total value of Y per stratum (Yhatj)  288.6857  671.3750
#>     STRATA 3
#> 1  3000.0000
#> 2     7.0000
#> 3    22.0000
#> 4    47.3333
#> 5   150.0000
#> 6     0.3156
#> 7    96.1000
#> 8  1365.5500
#> 9    13.7286
#> 10    2.4316
#> 11    0.8760
#> 12    4.3321
#> 13    4.8614
#> 14    2.1554
#> 15   10.7325
#> 16   20.0829
#> 17    2.0796
#> 18    2.0129
#> 19   45.0000
#> 20   19.0000
#> 21   46.0000
#> 22  649.8190
#> 
#> $Table2
#>                                  Variables     value
#> 1                                t-student    2.0796
#> 2          Standard error of the mean (Sy)    0.4228
#> 3                      Stratified Mean (Y)   10.7325
#> 4                           Absolute Error    0.8793
#> 5                       Relative Error (%)    8.1925
#> 6             Estimated Total Value (Yhat) 1609.8798
#> 7                              Total Error  131.8894
#> 8        Inferior Confidence Interval (m3)    9.8533
#> 9        Superior Confidence Interval (m3)   11.6118
#> 10    Inferior Confidence Interval (m3/ha)   32.8442
#> 11    Superior Confidence Interval (m3/ha)   38.7060
#> 12 inferior Total Confidence Interval (m3) 1477.9904
#> 13 Superior Total Confidence Interval (m3) 1741.7691

Analyzing the first table, we can see that in order to achieve the desired error, we must sample 24 additional plots. 4 in stratum 1, 8 in stratum 2 and 12 in stratum 3.

After a new survey, the new data is shown below:

data_ace_def
#>    STRATA STRATA_AREA PLOT_AREA   VWB
#> 1       1        14.4      1000  7.90
#> 2       1        14.4      1000  3.80
#> 3       1        14.4      1000  4.40
#> 4       1        14.4      1000  6.25
#> 5       1        14.4      1000  5.55
#> 6       1        14.4      1000  8.10
#> 7       1        14.4      1000  6.10
#> 8       1        14.4      1000  6.60
#> 9       1        14.4      1000  7.40
#> 10      1        14.4      1000  5.35
#> 11      1        14.4      1000  5.90
#> 12      1        14.4      1000  4.65
#> 13      1        14.4      1000  4.25
#> 14      1        14.4      1000  8.25
#> 15      2        16.4      1000 10.20
#> 16      2        16.4      1000 15.25
#> 17      2        16.4      1000 13.40
#> 18      2        16.4      1000 13.60
#> 19      2        16.4      1000 14.20
#> 20      2        16.4      1000  9.85
#> 21      2        16.4      1000 10.20
#> 22      2        16.4      1000 11.55
#> 23      2        16.4      1000  9.25
#> 24      2        16.4      1000 11.30
#> 25      2        16.4      1000 13.95
#> 26      2        16.4      1000 12.70
#> 27      2        16.4      1000 10.15
#> 28      2        16.4      1000 14.90
#> 29      2        16.4      1000 10.80
#> 30      2        16.4      1000 11.55
#> 31      2        16.4      1000 13.90
#> 32      2        16.4      1000  9.20
#> 33      2        16.4      1000 12.45
#> 34      2        16.4      1000 11.90
#> 35      3        14.2      1000 10.65
#> 36      3        14.2      1000 12.15
#> 37      3        14.2      1000 14.60
#> 38      3        14.2      1000 10.90
#> 39      3        14.2      1000 16.55
#> 40      3        14.2      1000 17.90
#> 41      3        14.2      1000 13.35
#> 42      3        14.2      1000 14.90
#> 43      3        14.2      1000  9.70
#> 44      3        14.2      1000 15.20
#> 45      3        14.2      1000 13.45
#> 46      3        14.2      1000 12.40
#> 47      3        14.2      1000 14.45
#> 48      3        14.2      1000 13.55
#> 49      3        14.2      1000 12.30
#> 50      3        14.2      1000 15.65
#> 51      3        14.2      1000 14.20
#> 52      3        14.2      1000 17.80
#> 53      3        14.2      1000 14.80
#> 54      3        14.2      1000  9.35
#> 55      3        14.2      1000 12.60
#> 56      3        14.2      1000 13.80
#> 57      3        14.2      1000 15.85

Now we’ll run the inventory again, this time with the definitive data:

strs(data_ace_def, "VWB", "PLOT_AREA", "STRATA_AREA", 
     strata = "STRATA", error = 5, pop = "fin")
#> $Table1
#>                                             Variables  STRATA 1  STRATA 2
#> 1                                           Plot Area 1000.0000 1000.0000
#> 2            Number of sampled plots per stratum (nj)   14.0000   20.0000
#> 3                   Total number of sampled plots (n)   57.0000   57.0000
#> 4            Number of maximum plots per stratum (Nj)  144.0000  164.0000
#> 5                         Number of maximum plots (N)  450.0000  450.0000
#> 6                                     Nj/N Ratio (Pj)    0.3200    0.3644
#> 7                                   Stratum sum (Eyj)   84.5000  240.3000
#> 8                        Stratum quadratic sum (Eyj2)  538.3950 2955.9100
#> 9                         Mean of Yi per stratum (Yj)    6.0357   12.0150
#> 10                                              PjSj2    0.6985    1.3179
#> 11                                               PjSj    0.4728    0.6930
#> 12                                               PjYj    1.9314    4.3788
#> 13                                             EPjSj2    3.6949    3.6949
#> 14                                              EPjSj    1.8936    1.8936
#> 15                                Stratified mean (Y)   10.6471   10.6471
#> 16                          Variance Quoeficient (VC)   17.7851   17.7851
#> 17                                          t-student    2.0032    2.0032
#> 18                             recalculated t-student    2.0141    2.0141
#> 19      Number of samples regarding the admited error   46.0000   46.0000
#> 20 Optimal number of samples per stratum (nj optimal)   12.0000   17.0000
#> 21              Optimal number of samples (n optimal)   47.0000   47.0000
#> 22               Total value of Y per stratum (Yhatj)  869.1429 1970.4600
#>     STRATA 3
#> 1  1000.0000
#> 2    23.0000
#> 3    57.0000
#> 4   142.0000
#> 5   450.0000
#> 6     0.3156
#> 7   316.1000
#> 8  4461.3350
#> 9    13.7435
#> 10    1.6785
#> 11    0.7278
#> 12    4.3368
#> 13    3.6949
#> 14    1.8936
#> 15   10.6471
#> 16   17.7851
#> 17    2.0032
#> 18    2.0141
#> 19   46.0000
#> 20   18.0000
#> 21   47.0000
#> 22 1951.5739
#> 
#> $Table2
#>                                  Variables     value
#> 1                                t-student    2.0032
#> 2          Standard error of the mean (Sy)    0.2339
#> 3                      Stratified Mean (Y)   10.6471
#> 4                           Absolute Error    0.4685
#> 5                       Relative Error (%)    4.4003
#> 6             Estimated Total Value (Yhat) 4791.1768
#> 7                              Total Error  210.8250
#> 8        Inferior Confidence Interval (m3)   10.1786
#> 9        Superior Confidence Interval (m3)   11.1156
#> 10    Inferior Confidence Interval (m3/ha)  101.7856
#> 11    Superior Confidence Interval (m3/ha)  111.1556
#> 12 inferior Total Confidence Interval (m3) 4580.3518
#> 13 Superior Total Confidence Interval (m3) 5002.0018

The desired error was met.

Systematic Sampling

Now we’ll survey an area of 18 hectares in which 18 plots of 200 m² each were systematically sampled:

data_as
#>    TOTAL_AREA PLOT_AREA VWB
#> 1          18       200   6
#> 2          18       200   8
#> 3          18       200   9
#> 4          18       200  10
#> 5          18       200  13
#> 6          18       200  12
#> 7          18       200  18
#> 8          18       200  19
#> 9          18       200  20
#> 10         18       200  20
#> 11         18       200  24
#> 12         18       200  23
#> 13         18       200  26
#> 14         18       200  30
#> 15         18       200  31
#> 16         18       200  31
#> 17         18       200  33
#> 18         18       200  32

First, let’s see what error we would get, if we used the simple random sampling method:

sprs(data_as, "VWB", 200, 18)
#>                                        Variables     Values
#> 1              Total number of sampled plots (n)    18.0000
#> 2                    Number of maximum plots (N)   900.0000
#> 3                      Variance Quoeficient (VC)    44.6505
#> 4                                      t-student     2.1098
#> 5                         recalculated t-student     1.9873
#> 6  Number of samples regarding the admited error    79.0000
#> 7                                       Mean (Y)    20.2778
#> 8                Standard error of the mean (Sy)     2.1341
#> 9                                 Absolute Error     4.5025
#> 10                            Relative Error (%)    22.2042
#> 11                  Estimated Total Value (Yhat) 18250.0000
#> 12                                   Total Error  4052.2580
#> 13             Inferior Confidence Interval (m3)    15.7753
#> 14             Superior Confidence Interval (m3)    24.7803
#> 15          Inferior Confidence Interval (m3/ha)   788.7634
#> 16          Superior Confidence Interval (m3/ha)  1239.0143
#> 17       inferior Total Confidence Interval (m3) 14197.7420
#> 18       Superior Total Confidence Interval (m3) 22302.2580

We got a 22.2% error. Now, let’s calculate the sampling error using the method of successive differences, with the ss_diffs function. To use this function, the data must be set in the measured order, the plot area must be in square meters, and the total area value must be in hectares.

ss_diffs(data_as, "VWB", 200, 18)
#>                                        Variables     Values
#> 1              Total number of sampled plots (n)    18.0000
#> 2                    Number of maximum plots (N)   900.0000
#> 3                      Variance Quoeficient (VC)    44.6505
#> 4                                      t-student     2.1098
#> 5                         recalculated t-student     1.9873
#> 6  Number of samples regarding the admited error    79.0000
#> 7                                       Mean (Y)    20.2778
#> 8                Standard error of the mean (Sy)     0.4041
#> 9                                 Absolute Error     0.8527
#> 10                            Relative Error (%)     4.2050
#> 11                  Estimated Total Value (Yhat) 18250.0000
#> 12                                   Total Error   767.4046
#> 13             Inferior Confidence Interval (m3)    19.4251
#> 14             Superior Confidence Interval (m3)    21.1304
#> 15          Inferior Confidence Interval (m3/ha)   971.2553
#> 16          Superior Confidence Interval (m3/ha)  1056.5225
#> 17       inferior Total Confidence Interval (m3) 17482.5954
#> 18       Superior Total Confidence Interval (m3) 19017.4046

We got a 4.2% error, which is significantly lower than before.