Hi !!
I am a cardiologist studying the influence of some environment variables on the number of deaths.
I am trying to perform time-stratified case-crossover design using a conditional logistic regression. I have found the commands to do it from this data matrix (A):
gen month=month(date)
gen year=year(date)
gen dow=dow(date)
egen stratum_YMD=group(year month dow)
sort stratum date
gen one=1 // convenience variable
by stratum: gen origdos=sum(one) // numbers days in strata 1-4 or 1-5
by stratum: egen n_in_stratum = max(origdos)
expand n_in_stratum
sort stratum origdos
by stratum origdos: gen dos=sum(one) // distribute duplicated days across case-ref sets
gen caseday=(dos==origdos) // set indicator for case day
egen ccset=group(year month dow dos) , label
* WEIGHT OBSERVATIONS BY N OF DEATHS ON INDEX DAY
gen tempweight=_Number_of_Deaths*caseday
egen weight=max(tempweight), by(ccset)
drop if weight==0
* CLOGIT ANALYSIS
clogit caseday PM10 [fweight=weight], group(ccset)
I found this code from: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4280686:
But, I would like to know the influence of these environment variables stratifying by some individual variables like sex. So, my data matrix is (B) where death is only 0 or 1 and when Id, sex etc are missing is because this day no patient died (death=0).
So, how can I perform a case-crossover design using a conditional logistic regression without transforming it into the previous data matrix (A) so I can calculate the conditional OR stratified by individual variables like sex????
Please help, !!
Thank you very much
Related Posts with time-stratified case-crossover design with conditional logistic regression
"substr" does not work for the string with "_"Hi, I am trying to generate two scalars to store numbers from the string "crmlaw_2014_2018" and "te…
Standardize interaction term where one term is dummyLet's start with the given that, in addition to presenting unstandardized coefficients, I am also pr…
LMDI error messageHas anyone used the LMDI code in STATA? I have been trying to use the LMDI syntax to decompose water…
Weights not allowed with the svy prefixHi Everyone. Can someone please help me, I am new at stata (less than a month). I am in the process…
Max of Previous 2 ObservationsAnother one I can'f figure out myself... Code: * Example generated by -dataex-. To install: ssc in…
Subscribe to:
Post Comments (Atom)
0 Response to time-stratified case-crossover design with conditional logistic regression
Post a Comment