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
Graphing averages using collapse mean and loops with same suffixHello, I am trying to graph cross-country distributions along with international averages using loo…
Counting unique idsWhen I use the following code: Code: bys month: count(refer_id) Is there anything I can add to it …
ivreg2 with interaction termsHello, I am trying to understand how to make a 2SLS with ivreg2 when there are interaction terms. I…
variable distribution respect othersDear all, it is the first time to me in statalist. I would ask you if aanyone of you can help me wit…
Invalid name error in foreach loopHi, Same title as a similar post from 2020 which did not answer my problem... I am trying to run a…
Subscribe to:
Post Comments (Atom)
0 Response to time-stratified case-crossover design with conditional logistic regression
Post a Comment