Announcement

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

  • obtaining standardized regression coefficients using svy for weighted data

    Hi There,

    I am using data which employs a multi-stage probability sample and provides both sample and replicate weights. I would like to obtain standardized regression coefficients from the regression model as I will be comparing coefficients across outcomes/instruments. I have read several threads indicating that the "beta" option will not work with "svy" and the "listcoef" post estimation command is unreliable. I found the following workaround (https://www.statalist.org/forums/for...-weighted-data). However, my independent variable (X2POVTY200) is a dichotomous variable so I only wish to obtain standardized coefficients in terms of Y (X1MATH). Any help on how to edit the syntax below so that the scale of X (X2POVTY200) is preserved would be greatly appreciated.

    Thanks!
    -Jenn

    ----------------------------------

    */set sampling parameters*/
    svyset [pweight= W7C17P_20], jkrweight(W7C17P_21-W7C17P_240) vce(jack) mse

    /*get coefficients*/
    svy jackknife: regress X1MATH X2POVTY200
    matrix b = e(b)

    /* get SDs of y and predictors */
    svy: mean X1MATH
    estat sd
    matrix sy = r(sd)

    svy: mean X2POVTY200
    estat sd
    matrix sx = r(sd)

    /*compute standardized coefficients */
    mata:
    sy = st_matrix("sy")
    sx = st_matrix("sx")'
    b = st_matrix("b")
    bx = b[1 ,1..(cols(b)-1)]'
    st_matrix("betas",(sx:/sy):*bx)
    end

    matrix rownames betas = X2POVTY200
    matrix list betas


  • #2
    Welcome to Statalist, Jenn!

    For a dichotomous X, change the line:

    Code:
    matrix sx = r(sd)
    to
    Code:
    matrix sx = 1
    That will make the coefficient equal the expected difference in Y (SD units) associated with a change in X from 0 to 1
    Please read the FAQ, especially FAQ 12 on how to write good questions. In particular, Use dataex to display sample data sets and always display commands and results between CODE delimiters.
    Steve Samuels
    Statistical Consulting
    [email protected]

    Stata 14.2

    Comment

    Working...
    X