Last updated on 2024-06-14 05:00:20 CEST.
Flavor | Version | Tinstall | Tcheck | Ttotal | Status | Flags |
---|---|---|---|---|---|---|
r-devel-linux-x86_64-debian-clang | 1.0.0 | 9.90 | 93.53 | 103.43 | OK | |
r-devel-linux-x86_64-debian-gcc | 1.0.0 | 7.09 | 59.26 | 66.35 | ERROR | |
r-devel-linux-x86_64-fedora-clang | 1.0.0 | 127.09 | OK | |||
r-devel-linux-x86_64-fedora-gcc | 1.0.0 | 122.12 | OK | |||
r-devel-windows-x86_64 | 1.0.0 | 8.00 | 88.00 | 96.00 | OK | |
r-patched-linux-x86_64 | 1.0.0 | 9.71 | 90.19 | 99.90 | OK | |
r-release-linux-x86_64 | 1.0.0 | 9.16 | 89.97 | 99.13 | OK | |
r-release-macos-arm64 | 1.0.0 | 38.00 | OK | |||
r-release-macos-x86_64 | 1.0.0 | 55.00 | OK | |||
r-release-windows-x86_64 | 1.0.0 | 9.00 | 90.00 | 99.00 | OK | |
r-oldrel-macos-arm64 | 1.0.0 | 43.00 | OK | |||
r-oldrel-macos-x86_64 | 1.0.0 | 142.00 | OK | |||
r-oldrel-windows-x86_64 | 1.0.0 | 9.00 | 103.00 | 112.00 | OK |
Version: 1.0.0
Check: package dependencies
Result: NOTE
Packages suggested but not available for checking:
'testthat', 'tibble', 'dplyr'
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 1.0.0
Check: examples
Result: ERROR
Running examples in ‘gustave-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: qvar
> ### Title: Quickly perform a variance estimation in common cases
> ### Aliases: qvar
>
> ### ** Examples
>
> ### Example from the Information and communication technologies (ICT) survey
>
> # The (simulated) Information and communication technologies (ICT) survey
> # has the following characteristics:
> # - stratified one-stage sampling design
> # - non-response correction through reweighting in homogeneous response groups
> # - calibration on margins.
>
> # The ict_survey data.frame is a (simulated) subset of the ICT
> # survey file containing the variables of interest for the 612
> # responding firms.
>
> # The ict_sample data.frame is the (simulated) sample of 650
> # firms corresponding to the ict_survey file. It contains all
> # technical information necessary to estimate a variance with
> # the qvar() function.
>
> ## Methodological description of the survey
>
> # Direct call of qvar()
> qvar(
+
+ # Sample file
+ data = ict_sample,
+
+ # Dissemination and identification information
+ dissemination_dummy = "dissemination",
+ dissemination_weight = "w_calib",
+ id = "firm_id",
+
+ # Scope
+ scope_dummy = "scope",
+
+ # Sampling design
+ sampling_weight = "w_sample",
+ strata = "strata",
+
+ # Non-response correction
+ nrc_weight = "w_nrc",
+ response_dummy = "resp",
+ hrg = "hrg",
+
+ # Calibration
+ calibration_weight = "w_calib",
+ calibration_var = c(paste0("N_", 58:63), paste0("turnover_", 58:63)),
+
+ # Statistic(s) and variable(s) of interest
+ mean(employees)
+
+ )
Survey variance estimation with the gustave package
The following features are taken into account:
- stratified simple random sampling
- out-of-scope units
- non-response correction through reweighting
- calibration on margins
Note: The strata variable (strata) is of type character. It is automatically coerced to factor.
call n est variance std cv lower upper
1 mean(y = employees) 506 89.09692 47.06522 6.860409 7.69994 75.65077 102.5431
>
> # Definition of a variance estimation wrapper
> precision_ict <- qvar(
+
+ # As before
+ data = ict_sample,
+ dissemination_dummy = "dissemination",
+ dissemination_weight = "w_calib",
+ id = "firm_id",
+ scope_dummy = "scope",
+ sampling_weight = "w_sample",
+ strata = "strata",
+ nrc_weight = "w_nrc",
+ response_dummy = "resp",
+ hrg = "hrg",
+ calibration_weight = "w_calib",
+ calibration_var = c(paste0("N_", 58:63), paste0("turnover_", 58:63)),
+
+ # Replacing the variables of interest by define = TRUE
+ define = TRUE
+
+ )
Survey variance estimation with the gustave package
The following features are taken into account:
- stratified simple random sampling
- out-of-scope units
- non-response correction through reweighting
- calibration on margins
Note: The strata variable (strata) is of type character. It is automatically coerced to factor.
Note: As define = TRUE, a ready-to-use variance wrapper is (invisibly) returned.
>
> # Use of the variance estimation wrapper
> precision_ict(ict_sample, mean(employees))
Warning: 144 observations do not match any responding units of the survey. They are discarded.
call n est variance std cv lower upper
1 mean(y = employees) 506 89.09692 47.06522 6.860409 7.69994 75.65077 102.5431
>
> # The variance estimation wrapper can also be used on the survey file
> precision_ict(ict_survey, mean(speed_quanti))
call n est variance std cv lower
1 mean(y = speed_quanti) 506 36.81271 2.517231 1.586579 4.309866 33.70307
upper
1 39.92234
>
> ## Features of the variance estimation wrapper
>
> # Several statistics in one call (with optional labels)
> precision_ict(ict_survey,
+ "Mean internet speed in Mbps" = mean(speed_quanti),
+ "Turnover per employee" = ratio(turnover, employees)
+ )
label call n
1 Mean internet speed in Mbps mean(y = speed_quanti) 506
2 Turnover per employee ratio(num = turnover, denom = employees) 506
est variance std cv lower upper
1 36.81271 2.517231 1.586579 4.309866 33.70307 39.92234
2 260.39641 402.017218 20.050367 7.699940 221.09842 299.69441
>
> # Domain estimation with where and by arguments
> precision_ict(ict_survey,
+ mean(speed_quanti),
+ where = employees >= 50
+ )
call n est variance
1 mean(y = speed_quanti, where = employees >= 50) 193 41.78957 11.98235
std cv lower upper
1 3.461553 8.283293 35.00505 48.57409
> precision_ict(ict_survey,
+ mean(speed_quanti),
+ by = division
+ )
call by n est variance std
1 mean(y = speed_quanti, by = division) 58 152 36.22628 6.672118 2.583044
2 mean(y = speed_quanti, by = division) 59 69 24.11386 7.106194 2.665745
3 mean(y = speed_quanti, by = division) 60 35 53.24218 32.706150 5.718929
4 mean(y = speed_quanti, by = division) 61 41 85.04560 95.745360 9.784956
5 mean(y = speed_quanti, by = division) 62 170 34.55942 6.219674 2.493927
6 mean(y = speed_quanti, by = division) 63 39 35.07277 28.897546 5.375644
cv lower upper
1 7.130305 31.16361 41.28895
2 11.054824 18.88909 29.33862
3 10.741351 42.03328 64.45107
4 11.505540 65.86744 104.22376
5 7.216345 29.67142 39.44743
6 15.327115 24.53670 45.60884
>
> # Domain may differ from one estimator to another
> precision_ict(ict_survey,
+ "Mean turnover, firms with 50 employees or more" = mean(turnover, where = employees >= 50),
+ "Mean turnover, firms with 100 employees or more" = mean(turnover, where = employees >= 100)
+ )
label
1 Mean turnover, firms with 50 employees or more
2 Mean turnover, firms with 100 employees or more
call n est variance std
1 mean(y = turnover, where = employees >= 50) 193 29888.95 15978626 3997.327
2 mean(y = turnover, where = employees >= 100) 137 35825.06 33641742 5800.150
cv lower upper
1 13.37393 22054.33 37723.56
2 16.19020 24456.97 47193.14
>
> # On-the-fly evaluation (e.g. discretization)
> precision_ict(ict_survey, mean(speed_quanti > 100))
call n est variance std cv
1 mean(y = speed_quanti > 100) 506 0.1606019 0.0002552473 0.01597646 9.947865
lower upper
1 0.1292886 0.1919152
>
> # Automatic discretization for qualitative (character or factor) variables
> precision_ict(ict_survey, mean(speed_quali))
call mod n est variance
1 mean(y = speed_quali) Less than 2 Mbps 506 0.03311273 7.381933e-05
2 mean(y = speed_quali) Between 2 and 10 Mbps 506 0.34282291 5.140507e-04
3 mean(y = speed_quali) Between 10 and 30 Mbps 506 0.32560461 5.040504e-04
4 mean(y = speed_quali) Between 30 and 100 Mbps 506 0.13785785 2.681454e-04
5 mean(y = speed_quali) Above 100 Mbps 506 0.16060190 2.552473e-04
std cv lower upper
1 0.008591818 25.947175 0.01627308 0.04995238
2 0.022672687 6.613528 0.29838526 0.38726056
3 0.022451068 6.895193 0.28160133 0.36960790
4 0.016375144 11.878282 0.10576316 0.16995255
5 0.015976460 9.947865 0.12928861 0.19191519
>
> # Standard evaluation capabilities
> variables_of_interest <- c("speed_quanti", "speed_quali")
> precision_ict(ict_survey, mean(variables_of_interest))
call mod n est variance
1 mean(y = speed_quanti) <NA> 506 36.81270668 2.517231e+00
2 mean(y = speed_quali) Less than 2 Mbps 506 0.03311273 7.381933e-05
3 mean(y = speed_quali) Between 2 and 10 Mbps 506 0.34282291 5.140507e-04
4 mean(y = speed_quali) Between 10 and 30 Mbps 506 0.32560461 5.040504e-04
5 mean(y = speed_quali) Between 30 and 100 Mbps 506 0.13785785 2.681454e-04
6 mean(y = speed_quali) Above 100 Mbps 506 0.16060190 2.552473e-04
std cv lower upper
1 1.586578504 4.309866 33.70306995 39.92234341
2 0.008591818 25.947175 0.01627308 0.04995238
3 0.022672687 6.613528 0.29838526 0.38726056
4 0.022451068 6.895193 0.28160133 0.36960790
5 0.016375144 11.878282 0.10576316 0.16995255
6 0.015976460 9.947865 0.12928861 0.19191519
>
> # Integration with %>% and dplyr
> library(magrittr)
> library(dplyr)
Error in library(dplyr) : there is no package called ‘dplyr’
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc
Version: 1.0.0
Check: tests
Result: ERROR
Running ‘testthat.R’ [0s/1s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
Error in library(testthat) : there is no package called 'testthat'
Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc