Hello,
I'm using a program code in Stata 13.0 that examines, if two ICCs (one per group) significantly differ between groups. It runs for unweighted groups, but when adding a weight variable (I previously computed) the same results as for unweighted groups are produced. No error message occurs.
Code:
One example: I used for the unweighted analysis "icc_comp N group , id(id)" and for the weighted analysis "icc_comp N group [iw=weight], id(id)". As said before, exactely the same values occured without an error message (for every analysis of my 7 outcome variables).
Does someone know how I have to alter the program code so that the weight variable is not ignored?
Thanks in advance and best regards,
Sabine
I'm using a program code in Stata 13.0 that examines, if two ICCs (one per group) significantly differ between groups. It runs for unweighted groups, but when adding a weight variable (I previously computed) the same results as for unweighted groups are produced. No error message occurs.
Code:
Code:
capture program drop icc_comp
program define icc_comp
syntax anything [if/] [iw/] , id(varname)
* 1. argument = outcome
* 2. argument = group variable
quietly tabulate `2' , generate(`2'___)
mixed `1' `id' `2' || `id' : `2'___* , noconstant residual(independent, by(`2')) nolrtest nolog
estimates store Full
display in smcl as text "rho 0 = " exp(_b[lns1_1_1:_cons])^2 / ///
(exp(_b[lns1_1_1:_cons])^2 + exp(_b[lnsig_e:_cons])^2)
display in smcl as text "rho 1 = " exp(_b[lns1_1_2:_cons])^2 / ///
(exp(_b[lns1_1_2:_cons])^2 + exp(_b[r_lns2ose:_cons] + _b[lnsig_e:_cons])^2)
quietly mixed `1' || `id': , nolrtest nolog
local linesize `c(linesize)'
set linesize 80
lrtest Full
set linesize `linesize'
drop `2'___* _est_Full
end
Does someone know how I have to alter the program code so that the weight variable is not ignored?
Thanks in advance and best regards,
Sabine

Comment