From d2cd58d1ac6f7865a003a09d9e3fa0690ae39261 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 12 May 2024 23:52:56 +0200 Subject: [PATCH] docs --- man/weighted_se.Rd | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/man/weighted_se.Rd b/man/weighted_se.Rd index ca87d91b..600172a9 100644 --- a/man/weighted_se.Rd +++ b/man/weighted_se.Rd @@ -90,29 +90,22 @@ a variable in a survey-design (see [\verb{survey::svydesign()]}). alternative hypothesis. } \examples{ +\dontshow{if (requireNamespace("survey")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data(efc) -weighted_se(efc[, 1:3], runif(n = nrow(efc))) +weighted_se(efc$c12hour, abs(runif(n = nrow(efc)))) # survey_median ---- # median for variables from weighted survey designs -if (require("survey")) { - data(nhanes_sample) - - des <- svydesign( - id = ~SDMVPSU, - strat = ~SDMVSTRA, - weights = ~WTINT2YR, - nest = TRUE, - data = nhanes_sample - ) - - survey_median(total, des) - survey_median("total", des) -} - -# weighted t-test ---- -efc$weight <- abs(rnorm(nrow(efc), 1, .3)) -weighted_ttest(efc, e17age, weights = weight) -weighted_ttest(efc, e17age, c160age, weights = weight) -weighted_ttest(e17age ~ e16sex + weight, efc) +data(nhanes_sample) + +des <- survey::svydesign( + id = ~SDMVPSU, + strat = ~SDMVSTRA, + weights = ~WTINT2YR, + nest = TRUE, + data = nhanes_sample +) +survey_median(total, des) +survey_median("total", des) +\dontshow{\}) # examplesIf} }