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
How to Clean String variable with errors in data entryHi Stata Forum, I am a relatively new user to STATA. I am working on a project that uses data scrap…
How to flag observations that are repeated after a pre-specified length of time?Hi, Please consider this example data: Code: * Example generated by -dataex-. To install: ssc inst…
Using loop to replace values in a variableDear All, I am new to loop. Is there a way I can replace the missing values with the number 1 each …
Is adoupdate, update stallig for anyone else? Advice/For the first time, I'm having trouble with adoupdate, update today. It goes through identifying wha…
Using Reshape to sort wide into longHello Everyone, I want to convert my wide data into a long panel data for currency data. Currently…
Subscribe to:
Post Comments (Atom)
0 Response to time-stratified case-crossover design with conditional logistic regression
Post a Comment