I have 168 cases and 860 controls and 211 missing data. I have done a 2:1 matching for cases and controls. I have then reshaped the data using the following code:
Code:
ds *_ctrl, not uniqueid c1dage variables etc . local vbles `r(varlist)' . rename (`vbles') =_case . gen long obs_num = _n . clonevar group_id = uniqueid_case . reshape long `vbles', i(obs_num) j(cc) string (note: j = _case _ctrl) (note: cdgender_ctrl not found) (note: c1dage_ctrl not found) (note: c1dage_U_ctrl not found) Data wide -> long ----------------------------------------------------------------------------- Number of obs. 758 -> 1516 Number of variables 49 -> 28 j variable (2 values) -> cc xij variables: uniqueid_case uniqueid_ctrl -> uniqueid c1dage_U_case c1dage_U_ctrl -> c1dage_U other variables etc ----------------------------------------------------------------------------- . drop obs_num . duplicates drop if cc == "_case" Duplicates in terms of all variables (2 observations deleted)
Code:
replace cc = "1" if cc == "_case" replace cc = "0" if cc == "_ctrl" destring cc, replace
Code:
tab cc cc | Freq. Percent Cum. ------------+----------------------------------- 0 | 758 50.07 50.07 1 | 756 49.93 100.00 ------------+----------------------------------- Total | 1,514 100.00
Code:
clogit cc i.smoke area*, group( group_id ) iterate(1) note: multiple positive outcomes within groups encountered. note: 228 groups (407 obs) dropped because of all positive or all negative outcomes. Iteration 0: log likelihood = -226.34064 Iteration 1: log likelihood = -225.14419 convergence not achieved Conditional (fixed-effects) logistic regression Number of obs = 551 LR chi2(2) = 23.23 Prob > chi2 = 0.0000 Log likelihood = -225.14419 Pseudo R2 = 0.0491 ------------------------------------------------------------------------------ cc | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- smoke| Yes | 2.106454 .5176006 4.07 0.000 1.091976 3.120933 area | .0005998 .0005461 1.10 0.272 -.0004706 .0016702 ------------------------------------------------------------------------------ Warning: convergence not achieved
Code:
clogit cc i.smoke area*, group( group_id ) iterate(1) or note: multiple positive outcomes within groups encountered. note: 228 groups (407 obs) dropped because of all positive or all negative outcomes. Iteration 0: log likelihood = -226.34064 Iteration 1: log likelihood = -225.14419 convergence not achieved Conditional (fixed-effects) logistic regression Number of obs = 551 LR chi2(2) = 23.23 Prob > chi2 = 0.0000 Log likelihood = -225.14419 Pseudo R2 = 0.0491 ------------------------------------------------------------------------------ cc | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- smoke | Yes | 8.219045 4.254183 4.07 0.000 2.980156 22.66751 area | 1.0006 .0005465 1.10 0.272 .9995295 1.001672 ------------------------------------------------------------------------------ Warning: convergence not achieved
0 Response to Is this coding right? Getting weird results
Post a Comment