Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Applying weights to mixed-effects logistic regression model

    Hello Statalist,

    I am trying to add weights to my mixed-effects logistic regression model. I could use regression commands melogit or meqrlogit, but I don't know how to add weights to either.

    So far, I have been working with simple logistic regression, and weighting with svyset and svy: . The difference is very significant depending on whether or not I weight the models. I expect the weighting to be similarly important with a mixed-effects logistic regression.

    However, svyset and svy: do not seem to work in combination with melogit or meqrlogit (although I am not sure, as I find the help entry to be a bit confusing here).

    So my question is whether somebody can tell me how to combine my weighting with either melogit or meqrlogit.

    Here is the data and command information you may require:

    My weighting variable
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input double Compwt
    2.09944
     .41773
     .36181
     .87289
     .41773
     .87289
     .41773
     .87289
     .36181
     .87289
     .36181
     .87289
     .87289
    2.09944
     .36181
     .52707
     .87289
     .52707
     .87289
     .52707
     .87289
    2.09944
     .87289
     .87289
    2.09944
     .87289
    2.09944
     .87289
     .87289
     .52707
     .36181
     .52707
     .52707
    2.09944
    2.09944
    2.09944
     .52707
     .87289
     .87289
     .87289
    2.09944
     .87289
     .87289
     .87289
     .36181
     .36181
     .87289
     .54305
     .52707
     .52707
     .87289
     .87289
    2.09944
     .87289
     .87289
     .87289
     .87289
     .87289
     .87289
     .41773
     .36181
    2.09944
    2.09944
     .52707
     .87289
     .52707
     .41773
     .87289
     .52707
     .36181
    2.09944
    2.09944
     .36181
     .87289
     .52707
     .52707
    2.09944
     .52707
    2.09944
     .52707
     .52707
     .87289
     .87289
     .87289
     .87289
     .87289
     .41773
     .87289
     .54305
     .87289
    2.09944
     .87289
    2.09944
     .36181
     .36181
     .52707
     .87289
     .87289
     .52707
     .36181
    end
    label values Compwt Compwt
    My dependent variable
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float childcare
    0
    0
    1
    1
    1
    0
    1
    1
    1
    1
    1
    0
    0
    0
    1
    0
    0
    0
    1
    1
    1
    0
    0
    1
    0
    1
    0
    1
    1
    0
    0
    1
    0
    1
    1
    1
    0
    0
    0
    1
    0
    0
    0
    1
    1
    1
    1
    1
    0
    1
    0
    1
    .
    1
    0
    1
    0
    0
    0
    .
    1
    0
    0
    1
    0
    1
    1
    1
    1
    1
    1
    0
    1
    0
    1
    0
    0
    1
    1
    1
    0
    1
    0
    0
    0
    1
    1
    1
    1
    0
    1
    0
    1
    1
    1
    1
    1
    1
    0
    1
    end
    label values childcare childcare
    label def childcare 0 "Not provided", modify
    label def childcare 1 "Provided", modify
    My group variable
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float p_regime
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    2
    end
    label values p_regime p_regime
    label def p_regime 1 "Pre-K only", modify
    label def p_regime 2 "Both", modify
    My weighting command
    Code:
     svyset [pweight = Compwt]
    My weighted logit command (which works perfectly)
    Code:
     svy: logit childcare i.p_regime i.skillprofile gdp size fem_execs

    Many thanks for your time and consideration.

  • #2
    if you look at the manual for -melogit- (e.g.), you will see examples of how to use various types of weights, including pweights; you get to that entry by typing "help melogit" and clicking on the blue link near the top of the help file; you can also use the svy prefix (but do not specify weights if you do so)
    Last edited by Rich Goldstein; 31 May 2020, 06:16.

    Comment

    Working...
    X