Giter Club home page Giter Club logo

Comments (5)

ddsjoberg avatar ddsjoberg commented on June 2, 2024

Thank you @LucyMcGowan for the report and the simple reprex (much appreciated!).

The warning appears from using the deff=TRUE argument.

library(survey, warn.conflicts = FALSE)
#> Loading required package: grid
#> Loading required package: Matrix
#> Loading required package: survival

d <- mtcars[, 1, drop = FALSE]
d$weight <- runif(nrow(mtcars), 0, 0.5)
des <- svydesign(~1, weights = ~weight, data = d)
svymean(~mpg, des, na.rm = TRUE, deff = TRUE)
#> Warning in svymean.survey.design2(~mpg, des, na.rm = TRUE, deff = TRUE): Sample
#> size greater than population size: are weights correctly scaled?
#>        mean      SE DEff
#> mpg 20.3106  1.1444   NA

Created on 2023-11-28 with reprex v2.0.2

@larmarange the line in question is coming from here:

svy_p <- survey::svymean(c_form(right = variable), data, na.rm = TRUE, deff = TRUE) %>%

I don't know why/if this is needed. Can you chime in, please?

from gtsummary.

LucyMcGowan avatar LucyMcGowan commented on June 2, 2024

Ah! I was trying to fiddle with it and somehow missed that option β€” estimating the Design Effect definitely doesn’t make sense from a propensity score weighting perspective but not sure how that is used internally

from gtsummary.

ddsjoberg avatar ddsjoberg commented on June 2, 2024

@LucyMcGowan The design effect is only used to estimate the proportion of missing data and not in the primary mean calculation. @larmarange can comment on these differences with more authority than I can!

As an aside: we're planning a rather large refactor, and if there are pain points or suggestions, please feel free to voice them here!

from gtsummary.

larmarange avatar larmarange commented on June 2, 2024

Hi, following #1486, we have added design effects to the list of statistics available in tbl_svysummary().

Due to the design of the functions, inherited from tbl_summary(), summarize_continuous_survey() computes deff only on demand, while summarize_categorical_survey() always computes all the possible statistics.

To be noted, even for a continuous variable, summarize_categorical_survey() is called to calculate the number of observations.

t2 <- summarize_categorical_survey(

We probably need to update summarize_categorical_survey() to compute deff only when required.

from gtsummary.

ddsjoberg avatar ddsjoberg commented on June 2, 2024

Thanks @larmarange !

FYI @LucyMcGowan in the next version of the package, the messaging will be more clear where any warnings come from, for example it will say that this warning comes from estimating the statistic to measure the proportion of missing data.

from gtsummary.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.