I am setting up a survival model, where I look at the farmers' time to adoption of a certain technology. I am having difficulties matching up my data structure with conventional examples such as STB-49 (p. 38) by Mario Cleves, and I have the feeling I am loosing important information (see example below where I drop strata == .). Given that my research subjects experience the adoption decision every single year, I wonder if I should use an observation for each year, rather than periods of adoption/non-adoption.
Initially, I've arranged my data so that continuous years of non-adoption (i.e. status = 0) are clustered as periods of time, and the same procedure for years of adoption (i.e. status = 1). As I have information for up to 17 years for some individuals, I've determined to use a conditional risk set model (gap model) to account for dis-adoption (i.e. status = 0) and re-adoption (i.e. status = 1) events. I've labeled as "strata" changes in adoption behaviour (i.e. change of mind) regarding technology adoption.
I am using Stata version 15.1.
The data looks as follows:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int idd float tt byte(time0 gaptimeg status strata) 2 17 0 9 0 1 2 17 0 . 0 . 2 17 0 . 0 . 2 17 0 . 0 . 2 17 0 . 0 . 2 17 0 . 0 . 2 17 0 . 0 . 2 17 0 . 0 . 2 17 0 . 0 . 2 17 0 8 1 2 2 17 0 . 1 . 2 17 0 . 1 . 2 17 0 . 1 . 2 17 0 . 1 . 2 17 0 . 1 . 2 17 0 . 1 . 2 17 0 . 1 . 3 11 0 11 1 1 3 11 0 . 1 . 3 11 0 . 1 . 3 11 0 . 1 . 3 11 0 . 1 . 3 11 0 . 1 . 3 11 0 . 1 . 3 11 0 . 1 . 3 11 0 . 1 . 3 11 0 . 1 . 3 11 0 . 1 . 4 6 0 1 0 1 4 6 0 5 1 2 4 6 0 . 1 . 4 6 0 . 1 . 4 6 0 . 1 . 4 6 0 . 1 . 5 6 0 6 0 1 5 6 0 . 0 . 5 6 0 . 0 . 5 6 0 . 0 . 5 6 0 . 0 . 5 6 0 . 0 . end
Code:
drop if strata == . (4,226 observations deleted) stset gaptimeg, fail(status) exit(tt) enter(time0) failure event: status != 0 & status < . obs. time interval: (0, gaptimeg] enter on or after: time time0 exit on or before: time tt ------------------------------------------------------------------------------ 797 total observations 0 exclusions ------------------------------------------------------------------------------ 797 observations remaining, representing 317 failures in single-record/single-failure data 5,013 total analysis time at risk and under observation at risk from t = 0 earliest observed entry t = 0 last observed exit t = 17
Jesus P.
0 Response to Survival Analysis: Problem with setting up time to event data (years vs periods of time)
Post a Comment