. clear all

. cap noi which tabout
c:\ado\plus\t\tabout.ado
*! 2.0.8 Ian Watson 15mar2019
*! tabout version 3 (beta) available at: http://tabout.net.au

. if _rc==111 {
.         cap noi ssc install tabout
.         }

. cap noi which pathutil
c:\ado\plus\p\pathutil.ado
*! version 2.2.0 19nov2020 daniel klein

. if _rc==111 {
.         cap noi net install pathutil, from("http://fmwww.bc.edu/repec/bocode/p/") 
.         }

. cap noi which pathutil
c:\ado\plus\p\pathutil.ado
*! version 2.2.0 19nov2020 daniel klein

. if _rc==111 {
.         ssc install dirtools    
.         }

. cap noi which project
c:\ado\plus\p\project.ado
*! version 1.3.1  22dec2013  picard@netbox.com

. if _rc==111 {   
.         ssc install project
.         }

. cap noi which stipw
c:\ado\plus\s\stipw.ado
*! Version 1.0.0 17Jan2022

. if _rc==111 {   
.         ssc install stipw
.         }

. cap noi which stpm2
c:\ado\plus\s\stpm2.ado
*! version 1.7.5 May2021

. if _rc==111 {   
.         ssc install stpm2
.         }       

. cap noi which rcsgen
c:\ado\plus\r\rcsgen.ado
*! version 1.5.9 13FEB2022

. if _rc==111 {   
.         ssc install rcsgen
.         }       

. cap noi which matselrc
c:\ado\plus\m\matselrc.ado
*! NJC 1.1.0 20 Apr 2000  (STB-56: dm79)

. if _rc==111 {           
. cap noi net install dm79, from(http://www.stata.com/stb/stb56)
.         }

Exercise

Date created: 14:53:35 16 Feb 2023.

Get the folder


E:\Mi unidad\Alvacast\SISTRAT 2022 (github)


Fecha: 16 Feb 2023, considerando un SO Windows para el usuario: andre

Path data= ;

Time: 16 Feb 2023, considering an OS Windows

The file is located and named as: E:\Mi unidad\Alvacast\SISTRAT 2022 (github)fiscalia_mariel_oct_2022_match_SENDA_pris.dta

=============================================================================

Structure database and survival

=============================================================================

We open the files

. use "fiscalia_mariel_oct_2022_match_SENDA_pris.dta", clear

. encode escolaridad_rec, gen(esc_rec)

. encode sex, generate(sex_enc)

. encode sus_principal_mod, generate(sus_prin_mod)

. encode freq_cons_sus_prin, generate(fr_sus_prin)

. encode compromiso_biopsicosocial, generate(comp_biosoc)

. encode tenencia_de_la_vivienda_mod, generate(ten_viv)

. *encode dg_cie_10_rec, generate(dg_cie_10_mental_h) *already numeric
. encode dg_trs_cons_sus_or, generate(sud_severity_icd10)

. encode macrozona, generate(macrozone)

. gen     motivodeegreso_mod_imp_rec3 = 1

. replace motivodeegreso_mod_imp_rec3 = 2 if strpos(motivodeegreso_mod_imp_rec,"Early")>0
(15,797 real changes made)

. replace motivodeegreso_mod_imp_rec3 = 3 if strpos(motivodeegreso_mod_imp_rec,"Late")>0
(35,781 real changes made)

. 
. *encode policonsumo, generate(policon) *already numeric
. 
. *motivodeegreso_mod_imp_rec3 edad_al_ing_1 edad_ini_cons dias_treat_imp_sin_na_1 i.escolaridad_rec i.sus_principal_mod i.freq
> _cons_sus_prin i.compromiso_biopsicosocial i.tenencia_de_la_vivienda_mod i.dg_cie_10_rec i.dg_trs_cons_sus_or i.macrozona i.n
> _off_vio i.n_off_acq i.n_off_sud i.n_off_oth

Then we set the data base in surirval format and bring the urban-rural classification of municipallities from this link.

. cap qui noi frame create temp

. frame temp: import excel "Clasificacion-comunas-PNDR.xlsx", firstrow clear
(11 vars, 345 obs)

. *frame temp: browse
. frame change default

. 
. *select code of municipality
. gen str20 comuna = ustrregexs(1) if ustrregexm(comuna_residencia_cod,"([\d,]+)")
(2 missing values generated)

. 
. *recode comuna if 
. *http://www.sinim.cl/archivos/centro_descargas/modificacion_instructivo_pres_codigos.pdf
. *file:///C:/Users/CISSFO~1/AppData/Local/Temp/MicrosoftEdgeDownloads/4ef08de9-6832-4db6-8124-f69a7b256270/codigoComunas-20180
> 801%20(1).pdf
. 
. replace comuna= "16101" if strpos(strlower(comuna),"8401")>0
(434 real changes made)

. replace comuna= "16102" if strpos(strlower(comuna),"8402")>0
(10 real changes made)

. replace comuna= "16103" if strpos(strlower(comuna),"8406")>0
(32 real changes made)

. replace comuna= "16104" if strpos(strlower(comuna),"8407")>0
(2 real changes made)

. replace comuna= "16105" if strpos(strlower(comuna),"8410")>0
(1 real change made)

. replace comuna= "16106" if strpos(strlower(comuna),"8411")>0
(8 real changes made)

. replace comuna= "16107" if strpos(strlower(comuna),"8413")>0
(12 real changes made)

. replace comuna= "16108" if strpos(strlower(comuna),"8418")>0
(4 real changes made)

. replace comuna= "16109" if strpos(strlower(comuna),"8421")>0
(6 real changes made)

. replace comuna= "16201" if strpos(strlower(comuna),"8414")>0
(22 real changes made)

. replace comuna= "16202" if strpos(strlower(comuna),"8403")>0
(0 real changes made)

. replace comuna= "16203" if strpos(strlower(comuna),"8404")>0
(13 real changes made)

. replace comuna= "16204" if strpos(strlower(comuna),"8408")>0
(1 real change made)

. replace comuna= "16205" if strpos(strlower(comuna),"8412")>0
(1 real change made)

. replace comuna= "16206" if strpos(strlower(comuna),"8415")>0
(2 real changes made)

. replace comuna= "16207" if strpos(strlower(comuna),"8420")>0
(1 real change made)

. replace comuna= "16301" if strpos(strlower(comuna),"8416")>0
(12 real changes made)

. replace comuna= "16302" if strpos(strlower(comuna),"8405")>0
(6 real changes made)

. replace comuna= "16303" if strpos(strlower(comuna),"8409")>0
(0 real changes made)

. replace comuna= "16304" if strpos(strlower(comuna),"8417")>0
(0 real changes made)

. replace comuna= "16305" if strpos(strlower(comuna),"8419")>0
(0 real changes made)

. 
. destring comuna, replace
comuna: all characters numeric; replaced as int
(2 missing values generated)

. 
. *frame temp: gen str20 comuna = ustrregexs(1) if ustrregexm(cod_com,"([\d,]+)")
. 
. frlink m:1 comuna, frame(temp cod_com) //*Clasificación
  (2 observations in frame default unmatched)

. frget Clasificación, from(temp)
(2 missing values generated)
  (1 variable copied from linked frame)

. 
. encode Clasificación, generate(clas)

. *70,863
. *si no está perdido cod_region, significa que hubo un registro (0/1) y el tiempo es el tiempo desde 
. *set the indicator
. gen event=0

. replace event=1 if !missing(offender_d)
(5,144 real changes made)

. *replace event=1 if !missing(sex)
. 
. gen diff= age_offending_imp-edad_al_egres_imp

. 
. *age time
. stset age_offending_imp, fail(event ==1) enter(edad_al_egres_imp)

     failure event:  event == 1
obs. time interval:  (0, age_offending_imp]
 enter on or after:  time edad_al_egres_imp
 exit on or before:  failure

------------------------------------------------------------------------------
     70,863  total observations
          1  observation ends on or before enter()
------------------------------------------------------------------------------
     70,862  observations remaining, representing
      5,144  failures in single-record/single-failure data
 302,812.78  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =  10.95068
                                          last observed exit t =  90.65027

. 
. stdescribe, weight

         failure _d:  event == 1
   analysis time _t:  age_offending_imp
  enter on or after:  time edad_al_egres_imp

                                   |-------------- per subject --------------|
Category                   total        mean         min     median        max
------------------------------------------------------------------------------
no. of subjects            70862   
no. of records             70862           1           1          1          1

(first) entry time                  36.52205    10.95068    34.6274   88.91507
(final) exit time                   40.79532    14.98082    39.0765   90.65027

subjects with gap              0   
time on gap if gap             0   
time at risk           302812.78    4.273275    .0000449   3.964384   10.75828

failures                    5144    .0725918           0          0          1
------------------------------------------------------------------------------

We calculate the incidence rate.

. stsum, by (motivodeegreso_mod_imp_rec)

         failure _d:  event == 1
   analysis time _t:  age_offending_imp
  enter on or after:  time edad_al_egres_imp

         |               Incidence     Number of   |------ Survival time -----|
motivo~c | Time at risk       rate      subjects        25%       50%       75%
---------+---------------------------------------------------------------------
Treatmen |  76,631.0344   .0086649         19275   34.88843         .         .
Treatmen |  65,879.5067   .0259717         15797   23.57016  34.91855         .
Treatmen |  160,259.188   .0172595         35781   25.36071  48.78303         .
---------+---------------------------------------------------------------------
   Total |  302,769.729   .0169799         70853   24.87337  46.45585         .

We open the files

. *si no está perdido cod_region, significa que hubo un registro (0/1) y el tiempo es el tiempo desde 
. *set the indicator
. gen event=0
variable event already defined
r(110);

. replace event=1 if !missing(offender_d)
(0 real changes made)

. *replace event=1 if !missing(sex)
. 
. gen diff= age_offending_imp-edad_al_egres_imp
variable diff already defined
r(110);

. 
. *age time
. stset age_offending_imp, fail(event ==1) enter(edad_al_egres_imp)

     failure event:  event == 1
obs. time interval:  (0, age_offending_imp]
 enter on or after:  time edad_al_egres_imp
 exit on or before:  failure

------------------------------------------------------------------------------
     70,863  total observations
          1  observation ends on or before enter()
------------------------------------------------------------------------------
     70,862  observations remaining, representing
      5,144  failures in single-record/single-failure data
 302,812.78  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =  10.95068
                                          last observed exit t =  90.65027

. 
. stdescribe, weight

         failure _d:  event == 1
   analysis time _t:  age_offending_imp
  enter on or after:  time edad_al_egres_imp

                                   |-------------- per subject --------------|
Category                   total        mean         min     median        max
------------------------------------------------------------------------------
no. of subjects            70862   
no. of records             70862           1           1          1          1

(first) entry time                  36.52205    10.95068    34.6274   88.91507
(final) exit time                   40.79532    14.98082    39.0765   90.65027

subjects with gap              0   
time on gap if gap             0   
time at risk           302812.78    4.273275    .0000449   3.964384   10.75828

failures                    5144    .0725918           0          0          1
------------------------------------------------------------------------------

We calculate the incidence rate.

. stsum, by (motivodeegreso_mod_imp_rec)

         failure _d:  event == 1
   analysis time _t:  age_offending_imp
  enter on or after:  time edad_al_egres_imp

         |               Incidence     Number of   |------ Survival time -----|
motivo~c | Time at risk       rate      subjects        25%       50%       75%
---------+---------------------------------------------------------------------
Treatmen |  76,631.0344   .0086649         19275   34.88843         .         .
Treatmen |  65,879.5067   .0259717         15797   23.57016  34.91855         .
Treatmen |  160,259.188   .0172595         35781   25.36071  48.78303         .
---------+---------------------------------------------------------------------
   Total |  302,769.729   .0169799         70853   24.87337  46.45585         .

=============================================================================

Descriptives

=============================================================================

. 
. local ttl `" "Tr Completion" "Tr Disch (Early)" "Tr Disch (Late)" "' 

. forvalues i = 1/3 {
  2. cap drop sum_*
  3.         gettoken title ttl: ttl
  4. cap qui egen sum_`i' = total(_t) if motivodeegreso_mod_imp_rec3==`i'
  5. cap qui tab _d motivodeegreso_mod_imp_rec3 if _d==1 & motivodeegreso_mod_imp_rec3==`i'
  6. scalar n_eventos`i' =r(N)
  7. qui tabstat sum_`i', save
  8. scalar sum_`i'_total =r(StatTotal)[1,1]
  9. scalar ir_t = round((n_eventos`i'/sum_`i'_total)*1000,.1)
 10. *di ir_t
. *es numérico, para no generar incompatibilidad, se pasa a escalar
. global dens_inc`i' "Incidence rate ratio for `title' (`i') (x1,000 person-days):  `=scalar(ir_t)'"
 11. *di %9.1f (n_eventos`i'/sum_`i'_total)*1000
. }

We recode the discharge cause to contrast them

. cap noi recode motivodeegreso_mod_imp_rec3 (1=0 "Tr Completion" ) ///
>                          (2=1 "Early Disch") ///
>                          (else=.), gen(tto_2_1)
(70863 differences between motivodeegreso_mod_imp_rec3 and tto_2_1)

. cap noi recode motivodeegreso_mod_imp_rec3 (1=0 "Tr Completion" ) ///
>                          (3=1 "Late Disch") ///
>                          (else=.), gen(tto_3_1)
(70863 differences between motivodeegreso_mod_imp_rec3 and tto_3_1)

. cap noi recode motivodeegreso_mod_imp_rec3 (2=0 "Early Disch" ) ///
>                          (3=1 "Late Disch") ///
>                          (else=.), gen(tto_3_2)
(70863 differences between motivodeegreso_mod_imp_rec3 and tto_3_2)

We explored the inicidence rate ratios (IRR) of each cause of discharge.

. 
. *set trace on
. local stname `" "2_1" "3_1" "3_2" "' 

. local titl `" "Early Disch vs Tr Completion" "Late Disch vs Tr Completion" "Late vs Early Disch" "' 

. foreach s of local stname {
  2.         gettoken title titl: titl
  3. cap noi qui ir _d tto_`s' _t
  4. scalar ir_`s' =round(r(irr),.01)
  5. *di ir_`s'
. scalar ir_`s'_lb =round(r(lb_irr),.01) 
  6. *di ir_`s'_lb
. scalar ir_`s'_ub =round(r(ub_irr),.01)
  7. *di ir_`s'_ub
. local ir1= ir_`s'
  8. local ir2= ir_`s'_lb
  9. local ir3= ir_`s'_ub
 10. *di  in gr _col(13) " `title': IRR `ir1' (IC 95% `ir2' - `ir3') "
. global irr_`s' " `title': IRR `ir1' (IC 95% `ir2' - `ir3') "
 11. global ir_`s' "`ir1' (IC 95% `ir2' - `ir3')"
 12. }       

We generated a log-rank test to compare the expected to the observed result, obtaining that:

. *set trace on
. local stname `" "2_1" "3_1" "3_2" "' 

. local titl `" "Early Disch vs Tr Completion" "Late Disch vs Tr Completion" "Late vs Early Disch" "' 

. foreach s of local stname {
  2.         gettoken title titl: titl
  3. cap noi qui sts test tto_`s', logrank
  4. scalar logrank_chi`s'= round(r(chi2),.01)
  5. scalar logrank_df`s'= r(df)
  6. scalar logrank_p_`s'= round(chiprob(r(df),r(chi2)),.001)
  7. local lr1= logrank_chi`s'
  8. local lr2= logrank_df`s'
  9. local lr3= logrank_p_`s'
 10. global logrank_`s' " Chi^2(`lr2')=`lr1',p=`lr3'"
 11. }

. *set trace off

=============================================================================

Graph

=============================================================================

We generated a graph with every type of treatment and the Nelson-Aalen estimate.

. cap rm "tto2.svg"

. sts graph, na by (motivodeegreso_mod_imp_rec) ci ///
> title("Comission of an offense (end with imprisonment)") /// 
> subtitle("Nelson-Aalen Cum Hazards w/ Confidence Intervals 95%") ///
> risktable(, size(*.5) order(1 "Tr Completion" 2 "Early Disch" 3 "Late Disch")) ///
> ytitle("Cum. Hazards") ylabel(#8) ///
> xtitle("Years of age") xlabel(#8) ///
> note("Source: nDP, SENDA's SUD Treatments & POs Office Data period 2010-2019 ") ///
> legend(rows(3)) ///
> legend(cols(4)) ///
> graphregion(color(white) lwidth(large)) bgcolor(white) ///
> plotregion(fcolor(white)) graphregion(fcolor(white) ) /// //text(.5 1 "IR = <0.001") ///
> legend(order(1 "95CI Tr Completion" 2 "Tr Completion" 3 "95CI Early Tr Disch" 4 "Early Tr Disch " 5 "95CI Late Tr Disch" 6 "L
> ate Tr Disch" )size(*.5)region(lstyle(none)) region(c(none)) nobox)

         failure _d:  event == 1
   analysis time _t:  age_offending_imp
  enter on or after:  time edad_al_egres_imp
(note:  named style large not found in class linewidth, default attributes used)
(note:  linewidth not found in scheme, default attributes used)
(note:  named style large not found in class linewidth, default attributes used)
(note:  linewidth not found in scheme, default attributes used)

. graph save "`c(pwd)'\_figs\tto2.gph", replace
(note: file E:\Mi unidad\Alvacast\SISTRAT 2022 (github)\_figs\tto2.gph not found)
(file E:\Mi unidad\Alvacast\SISTRAT 2022 (github)\_figs\tto2.gph saved)

=============================================================================

Survival Analyses

=============================================================================

We tested the schoefeld residuals.

. *c("edad_al_ing_1", "edad_ini_cons", "dias_treat_imp_sin_na_1", "escolaridad_rec", "sus_principal_mod", "freq_cons_sus_prin",
>  "compromiso_biopsicosocial", "tenencia_de_la_vivienda_mod", "dg_cie_10_rec", "dg_trs_cons_sus_or", "macrozona", "policonsumo
> ", "n_prev_off", "n_off_vio", "n_off_acq", "n_off_sud", "n_off_oth")
. 
. global sim 1e5 //5e1 1e5 

. global boots 1e3 //5e1 2e3

. global times 0 90 365 1096 1826

. range timevar0 90 1826 90
(70,773 missing values generated)

. 
. global covs "edad_al_ing_1 edad_ini_cons dias_treat_imp_sin_na_1 sex esc_rec sus_prin_mod fr_sus_prin comp_biosoc ten_viv dg_
> cie_10_rec sud_severity_icd10 macrozone policonsumo n_off_vio n_off_acq n_off_sud clas"

. global covs_2 "motivodeegreso_mod_imp_rec3 edad_al_ing_1 edad_ini_cons sex_enc esc_rec sus_prin_mod fr_sus_prin comp_biosoc t
> en_viv dg_cie_10_rec sud_severity_icd10 macrozone policonsumo n_off_vio n_off_acq n_off_sud clas"

. 
. 
. stcox  $covs_2 , efron robust nolog schoenfeld(sch*) scaledsch(sca*)

         failure _d:  event == 1
   analysis time _t:  age_offending_imp
  enter on or after:  time edad_al_egres_imp

Cox regression -- Efron method for ties

No. of subjects      =       59,755             Number of obs    =      59,755
No. of failures      =        3,947
Time at risk         =  233401.5585
                                                Wald chi2(17)    =     2899.48
Log pseudolikelihood =   -33229.301             Prob > chi2      =      0.0000

---------------------------------------------------------------------------------------------
                            |               Robust
                         _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------------------+----------------------------------------------------------------
motivodeegreso_mod_imp_rec3 |   1.137893   .0237419     6.19   0.000     1.092298    1.185391
              edad_al_ing_1 |   1.173086   .0118876    15.75   0.000     1.150016    1.196618
              edad_ini_cons |   .9763696    .004763    -4.90   0.000     .9670788    .9857497
                    sex_enc |   .6071509   .0270164   -11.21   0.000     .5564431    .6624796
                    esc_rec |   1.298227    .033886    10.00   0.000     1.233482    1.366371
               sus_prin_mod |   1.253118   .0214601    13.18   0.000     1.211755    1.295893
                fr_sus_prin |   1.033203   .0171907     1.96   0.050     1.000053    1.067452
                comp_biosoc |   1.255332   .0380386     7.50   0.000     1.182948    1.332144
                    ten_viv |   .9701535   .0155257    -1.89   0.058      .940196    1.001066
              dg_cie_10_rec |   1.042133     .01934     2.22   0.026     1.004908    1.080736
         sud_severity_icd10 |   .9046789   .0384707    -2.36   0.018     .8323343    .9833115
                  macrozone |   1.273756   .0305628    10.08   0.000     1.215241    1.335089
                policonsumo |    1.10135   .0537876     1.98   0.048     1.000817    1.211982
                  n_off_vio |   1.455552   .0548066     9.97   0.000     1.352001    1.567034
                  n_off_acq |   2.888106   .0998208    30.69   0.000      2.69894     3.09053
                  n_off_sud |   1.342254   .0498049     7.93   0.000     1.248103    1.443507
                       clas |   1.127385   .0331957     4.07   0.000     1.064165    1.194362
---------------------------------------------------------------------------------------------

. estat phtest, log detail

      Test of proportional-hazards assumption

      Time:  Log(t)
      ----------------------------------------------------------------
                  |       rho            chi2       df       Prob>chi2
      ------------+---------------------------------------------------
      motivodeeg~3|      0.00439         0.06        1         0.8000
      edad_al_in~1|     -0.03089         4.84        1         0.0279
      edad_ini_c~s|      0.03017         4.18        1         0.0410
      sex_enc     |      0.03116         4.01        1         0.0452
      esc_rec     |     -0.04704         8.21        1         0.0042
      sus_prin_mod|     -0.00195         0.01        1         0.9155
      fr_sus_prin |     -0.00758         0.23        1         0.6318
      comp_biosoc |     -0.02198         1.93        1         0.1646
      ten_viv     |     -0.02151         1.99        1         0.1585
      dg_cie_10_~c|     -0.00416         0.07        1         0.7978
      sud_sever~10|      0.02506         2.52        1         0.1124
      macrozone   |      0.00395         0.06        1         0.8121
      policonsumo |      0.02191         1.98        1         0.1595
      n_off_vio   |      0.01895         1.60        1         0.2060
      n_off_acq   |      0.01445         0.97        1         0.3255
      n_off_sud   |      0.05507        13.68        1         0.0002
      clas        |     -0.01318         0.77        1         0.3810
      ------------+---------------------------------------------------
      global test |                     47.44       17         0.0001
      ----------------------------------------------------------------

note: robust variance-covariance matrix used.

. scalar chi2_scho_test = r(chi2)

. 
. mat mat_scho_test = r(phtest)

. 
. esttab matrix(mat_scho_test) using "mat_scho_test2.csv", replace
(output written to mat_scho_test2.csv)

. esttab matrix(mat_scho_test) using "mat_scho_test2.html", replace
(output written to mat_scho_test2.html)

. 

mat_scho_test
rho chi2 df p

motivodeegreso_mod_imp_rec3 .0043948 .0642029 1 .7999724
edad_al_ing_1 -.0308941 4.835282 1 .0278831
edad_ini_cons .0301658 4.177453 1 .0409652
sex_enc .031157 4.012017 1 .0451771
esc_rec -.0470359 8.208679 1 .004169
sus_prin_mod -.0019499 .0112656 1 .9154718
fr_sus_prin -.0075836 .2295747 1 .6318394
comp_biosoc -.0219752 1.931193 1 .164628
ten_viv -.0215142 1.988285 1 .1585203
dg_cie_10_rec -.0041595 .0656467 1 .7977839
sud_severity_icd10 .0250598 2.52076 1 .1123564
macrozone .0039451 .0565365 1 .8120563
policonsumo .0219067 1.978925 1 .1595037
n_off_vio .0189453 1.599513 1 .2059723
n_off_acq .0144483 .9666242 1 .3255235
n_off_sud .055072 13.68308 1 .0002164
clas -.0131839 .7673791 1 .3810291

We generated a list of parametric survival models with different distributions (Exponential, Weibull, Gompertz, Log-logistic, Log-normal & Generalized gamma). Aditionally, we defined a series of Royston-Parmar models with a function of restricted cubic splines, in which the knots (#df -1) are defined in each percentile of the distribution. We saved the estimates in the file called `parmodels_m2_nov_22_2’.

. 
.                 // Cox w/tvc
.         forvalues j=1/7 {
  2.                 di in yellow "{bf: ***********}"
  3.                 di in yellow "{bf: family Cox tvc `j'}"
  4.                 di in yellow "{bf: ***********}"
  5.                 set seed 2125
  6.                 qui cap noi stmerlin $covs_2 , dist(exponential) tvc(motivodeegreso_mod_imp_rec3) dftvc(`j')
  7.                 estimates store m2_1_cox`j'     
  8.         }
 ***********
 family Cox tvc 1
 ***********
note; a delayed entry model is being fitted
variables created for model 1, component 18: _cmp_1_18_1 to _cmp_1_18_1

Fitting full model:

Iteration 0:   log likelihood = -233401.56  
Iteration 1:   log likelihood = -20468.693  
Iteration 2:   log likelihood = -18700.231  
Iteration 3:   log likelihood = -18114.538  
Iteration 4:   log likelihood = -18113.432  
Iteration 5:   log likelihood = -18113.432  

Survival model                                  Number of obs     =     59,755
Log likelihood = -18113.432
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |   .0588047   .0229598     2.56   0.010     .0138043     .103805
edad_al_in~1 |  -.0045602   .0042316    -1.08   0.281    -.0128541    .0037336
edad_ini_c~s |  -.0255373   .0046225    -5.52   0.000    -.0345971   -.0164774
     sex_enc |  -.5072461   .0441771   -11.48   0.000    -.5938316   -.4206606
     esc_rec |   .2281343   .0263698     8.65   0.000     .1764505    .2798181
sus_prin_mod |   .2179554   .0180669    12.06   0.000     .1825449    .2533658
 fr_sus_prin |   .0339021   .0166069     2.04   0.041     .0013532     .066451
 comp_biosoc |   .2212173   .0301702     7.33   0.000     .1620848    .2803497
     ten_viv |   -.017707   .0156754    -1.13   0.259    -.0484303    .0130163
dg_cie_10_~c |     .03996   .0185405     2.16   0.031     .0036214    .0762986
sud_sever~10 |  -.1088304   .0422921    -2.57   0.010    -.1917214   -.0259394
   macrozone |   .2369395   .0243234     9.74   0.000     .1892664    .2846125
 policonsumo |   .0886144   .0487491     1.82   0.069    -.0069321     .184161
   n_off_vio |   .4122978   .0365609    11.28   0.000     .3406397    .4839559
   n_off_acq |   1.116647   .0337349    33.10   0.000     1.050527    1.182766
   n_off_sud |   .3488887   .0357897     9.75   0.000     .2787423    .4190352
        clas |   .1092927   .0286241     3.82   0.000     .0531904     .165395
motivodeeg~( |   -.135411   .0156989    -8.63   0.000    -.1661802   -.1046417
       _cons |  -5.930007   .2478498   -23.93   0.000    -6.415784    -5.44423
------------------------------------------------------------------------------
 ***********
 family Cox tvc 2
 ***********
note; a delayed entry model is being fitted
variables created for model 1, component 18: _cmp_1_18_1 to _cmp_1_18_2

Fitting full model:

Iteration 0:   log likelihood = -233401.56  
Iteration 1:   log likelihood =  -20467.93  
Iteration 2:   log likelihood = -18716.062  
Iteration 3:   log likelihood = -18083.554  
Iteration 4:   log likelihood = -18079.751  
Iteration 5:   log likelihood = -18079.745  
Iteration 6:   log likelihood = -18079.745  

Survival model                                  Number of obs     =     59,755
Log likelihood = -18079.745
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |  -.0118597   .0250325    -0.47   0.636    -.0609225    .0372032
edad_al_in~1 |   .0132548    .004782     2.77   0.006     .0038823    .0226274
edad_ini_c~s |   -.025945   .0046742    -5.55   0.000    -.0351063   -.0167837
     sex_enc |  -.5065669   .0441583   -11.47   0.000    -.5931156   -.4200181
     esc_rec |   .2478654   .0264747     9.36   0.000     .1959759    .2997548
sus_prin_mod |   .2196178   .0181557    12.10   0.000     .1840333    .2552023
 fr_sus_prin |   .0367608   .0165879     2.22   0.027      .004249    .0692725
 comp_biosoc |   .2220271   .0301794     7.36   0.000     .1628765    .2811776
     ten_viv |  -.0234643    .015678    -1.50   0.134    -.0541925     .007264
dg_cie_10_~c |   .0404616    .018528     2.18   0.029     .0041474    .0767758
sud_sever~10 |  -.0985535   .0423189    -2.33   0.020     -.181497     -.01561
   macrozone |   .2418558    .024309     9.95   0.000     .1942109    .2895006
 policonsumo |   .0771658   .0487001     1.58   0.113    -.0182847    .1726163
   n_off_vio |   .4120495   .0365221    11.28   0.000     .3404675    .4836314
   n_off_acq |   1.114617   .0336735    33.10   0.000     1.048618    1.180616
   n_off_sud |   .3350629   .0358019     9.36   0.000     .2648925    .4052334
        clas |   .1137162    .028639     3.97   0.000     .0575848    .1698475
motivodeeg~( |  -.2712167   .0235993   -11.49   0.000    -.3174704    -.224963
motivodeeg~( |    .070912   .0089868     7.89   0.000     .0532983    .0885258
       _cons |  -6.545356   .2612413   -25.05   0.000    -7.057379   -6.033332
------------------------------------------------------------------------------
 ***********
 family Cox tvc 3
 ***********
note; a delayed entry model is being fitted
variables created for model 1, component 18: _cmp_1_18_1 to _cmp_1_18_3

Fitting full model:

Iteration 0:   log likelihood = -233401.56  
Iteration 1:   log likelihood = -20467.815  
Iteration 2:   log likelihood =  -18709.54  
Iteration 3:   log likelihood = -18078.671  
Iteration 4:   log likelihood = -18075.827  
Iteration 5:   log likelihood = -18075.823  
Iteration 6:   log likelihood = -18075.823  

Survival model                                  Number of obs     =     59,755
Log likelihood = -18075.823
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |  -.0253549   .0257843    -0.98   0.325    -.0758912    .0251813
edad_al_in~1 |   .0149346   .0048727     3.06   0.002     .0053842     .024485
edad_ini_c~s |  -.0259697   .0046846    -5.54   0.000    -.0351513   -.0167881
     sex_enc |  -.5061737   .0441552   -11.46   0.000    -.5927163    -.419631
     esc_rec |   .2481186    .026463     9.38   0.000     .1962522     .299985
sus_prin_mod |   .2182386   .0181578    12.02   0.000       .18265    .2538273
 fr_sus_prin |   .0362553   .0165867     2.19   0.029     .0037459    .0687647
 comp_biosoc |   .2208494    .030185     7.32   0.000     .1616878    .2800109
     ten_viv |  -.0232959   .0156757    -1.49   0.137    -.0540197    .0074279
dg_cie_10_~c |   .0398249   .0185304     2.15   0.032      .003506    .0761439
sud_sever~10 |  -.1017041   .0423323    -2.40   0.016    -.1846738   -.0187343
   macrozone |   .2425313   .0243141     9.97   0.000     .1948766     .290186
 policonsumo |   .0744654   .0486615     1.53   0.126    -.0209095    .1698402
   n_off_vio |   .4115074   .0365233    11.27   0.000      .339923    .4830918
   n_off_acq |    1.11462   .0336652    33.11   0.000     1.048637    1.180603
   n_off_sud |   .3375699   .0358054     9.43   0.000     .2673927    .4077472
        clas |   .1127797   .0286381     3.94   0.000     .0566501    .1689093
motivodeeg~( |  -.2974882   .0259687   -11.46   0.000    -.3483859   -.2465906
motivodeeg~( |   .0925428   .0120461     7.68   0.000     .0689328    .1161528
motivodeeg~( |   .0217847   .0066895     3.26   0.001     .0086735     .034896
       _cons |  -6.581578   .2625657   -25.07   0.000    -7.096198   -6.066959
------------------------------------------------------------------------------
 ***********
 family Cox tvc 4
 ***********
note; a delayed entry model is being fitted
variables created for model 1, component 18: _cmp_1_18_1 to _cmp_1_18_4

Fitting full model:

Iteration 0:   log likelihood = -233401.56  
Iteration 1:   log likelihood = -20467.241  
Iteration 2:   log likelihood = -18705.031  
Iteration 3:   log likelihood =  -18079.15  
Iteration 4:   log likelihood = -18075.612  
Iteration 5:   log likelihood =   -18075.6  
Iteration 6:   log likelihood =   -18075.6  

Survival model                                  Number of obs     =     59,755
Log likelihood =   -18075.6
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |  -.0235826   .0260433    -0.91   0.365    -.0746265    .0274614
edad_al_in~1 |   .0147069   .0048938     3.01   0.003     .0051153    .0242985
edad_ini_c~s |  -.0259282   .0046841    -5.54   0.000    -.0351088   -.0167475
     sex_enc |  -.5064588   .0441572   -11.47   0.000    -.5930054   -.4199122
     esc_rec |   .2482672   .0264667     9.38   0.000     .1963934     .300141
sus_prin_mod |   .2180646   .0181613    12.01   0.000     .1824691      .25366
 fr_sus_prin |   .0363112   .0165856     2.19   0.029     .0038041    .0688184
 comp_biosoc |   .2206645    .030186     7.31   0.000     .1615011    .2798279
     ten_viv |  -.0232964   .0156769    -1.49   0.137    -.0540226    .0074298
dg_cie_10_~c |   .0398433   .0185304     2.15   0.032     .0035244    .0761623
sud_sever~10 |   -.101847    .042334    -2.41   0.016    -.1848201   -.0188739
   macrozone |   .2424027   .0243145     9.97   0.000     .1947471    .2900584
 policonsumo |   .0748274   .0486718     1.54   0.124    -.0205676    .1702223
   n_off_vio |   .4119481   .0365289    11.28   0.000     .3403527    .4835435
   n_off_acq |   1.115051   .0336741    33.11   0.000     1.049051    1.181051
   n_off_sud |   .3380121   .0358116     9.44   0.000     .2678227    .4082015
        clas |   .1127038   .0286374     3.94   0.000     .0565755     .168832
motivodeeg~( |  -.2942638   .0269376   -10.92   0.000    -.3470606    -.241467
motivodeeg~( |    .089277   .0136757     6.53   0.000     .0624732    .1160808
motivodeeg~( |   .0208376   .0077381     2.69   0.007     .0056713    .0360039
motivodeeg~( |   .0014435   .0071669     0.20   0.840    -.0126034    .0154903
       _cons |  -6.574735   .2628672   -25.01   0.000    -7.089946   -6.059525
------------------------------------------------------------------------------
 ***********
 family Cox tvc 5
 ***********
note; a delayed entry model is being fitted
variables created for model 1, component 18: _cmp_1_18_1 to _cmp_1_18_5

Fitting full model:

Iteration 0:   log likelihood = -233401.56  
Iteration 1:   log likelihood = -20467.243  
Iteration 2:   log likelihood = -18703.882  
Iteration 3:   log likelihood = -18079.377  
Iteration 4:   log likelihood = -18075.709  
Iteration 5:   log likelihood = -18075.695  
Iteration 6:   log likelihood = -18075.695  

Survival model                                  Number of obs     =     59,755
Log likelihood = -18075.695
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |  -.0245235     .02623    -0.93   0.350    -.0759332    .0268863
edad_al_in~1 |    .014835   .0049131     3.02   0.003     .0052056    .0244645
edad_ini_c~s |  -.0259397   .0046844    -5.54   0.000     -.035121   -.0167584
     sex_enc |  -.5063726   .0441573   -11.47   0.000    -.5929194   -.4198259
     esc_rec |   .2482384   .0264661     9.38   0.000     .1963658     .300111
sus_prin_mod |   .2181423   .0181622    12.01   0.000      .182545    .2537396
 fr_sus_prin |   .0363229   .0165868     2.19   0.029     .0038134    .0688324
 comp_biosoc |   .2206666    .030188     7.31   0.000     .1614992     .279834
     ten_viv |  -.0232836   .0156765    -1.49   0.137    -.0540091    .0074419
dg_cie_10_~c |   .0398204   .0185305     2.15   0.032     .0035013    .0761396
sud_sever~10 |  -.1018858   .0423362    -2.41   0.016    -.1848633   -.0189083
   macrozone |   .2424042    .024316     9.97   0.000     .1947457    .2900626
 policonsumo |    .074717   .0486698     1.54   0.125     -.020674     .170108
   n_off_vio |   .4118762   .0365316    11.27   0.000     .3402755    .4834769
   n_off_acq |    1.11489   .0336741    33.11   0.000      1.04889     1.18089
   n_off_sud |   .3379176   .0358132     9.44   0.000     .2677251    .4081102
        clas |   .1127325   .0286376     3.94   0.000     .0566037    .1688612
motivodeeg~( |  -.2961179   .0277026   -10.69   0.000     -.350414   -.2418217
motivodeeg~( |   .0907403   .0147651     6.15   0.000     .0618013    .1196793
motivodeeg~( |   .0219405   .0077575     2.83   0.005      .006736     .037145
motivodeeg~( |   .0059782   .0079157     0.76   0.450    -.0095363    .0214927
motivodeeg~( |   .0012469   .0076795     0.16   0.871    -.0138046    .0162985
       _cons |  -6.578614   .2632298   -24.99   0.000    -7.094535   -6.062693
------------------------------------------------------------------------------
 ***********
 family Cox tvc 6
 ***********
note; a delayed entry model is being fitted
variables created for model 1, component 18: _cmp_1_18_1 to _cmp_1_18_6

Fitting full model:

Iteration 0:   log likelihood = -233401.56  
Iteration 1:   log likelihood = -20466.967  
Iteration 2:   log likelihood = -18705.391  
Iteration 3:   log likelihood = -18078.202  
Iteration 4:   log likelihood = -18074.185  
Iteration 5:   log likelihood = -18074.162  
Iteration 6:   log likelihood = -18074.162  

Survival model                                  Number of obs     =     59,755
Log likelihood = -18074.162
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |  -.0277658   .0264481    -1.05   0.294     -.079603    .0240715
edad_al_in~1 |   .0151266   .0049345     3.07   0.002     .0054551    .0247981
edad_ini_c~s |  -.0259008    .004685    -5.53   0.000    -.0350832   -.0167183
     sex_enc |  -.5066378   .0441566   -11.47   0.000    -.5931831   -.4200925
     esc_rec |   .2486398   .0264721     9.39   0.000     .1967554    .3005242
sus_prin_mod |   .2184342   .0181657    12.02   0.000     .1828301    .2540384
 fr_sus_prin |   .0362963   .0165875     2.19   0.029     .0037855    .0688071
 comp_biosoc |   .2207212   .0301839     7.31   0.000     .1615619    .2798804
     ten_viv |  -.0234423   .0156763    -1.50   0.135    -.0541672    .0072827
dg_cie_10_~c |   .0400624   .0185313     2.16   0.031     .0037417    .0763831
sud_sever~10 |  -.1012925   .0423361    -2.39   0.017    -.1842697   -.0183154
   macrozone |   .2425192   .0243195     9.97   0.000     .1948539    .2901845
 policonsumo |   .0735254   .0486629     1.51   0.131    -.0218522     .168903
   n_off_vio |   .4113522   .0365321    11.26   0.000     .3397506    .4829537
   n_off_acq |   1.114934   .0336724    33.11   0.000     1.048938    1.180931
   n_off_sud |   .3375462   .0358105     9.43   0.000     .2673589    .4077335
        clas |    .112708   .0286406     3.94   0.000     .0565735    .1688426
motivodeeg~( |   -.302455   .0284002   -10.65   0.000    -.3581184   -.2467917
motivodeeg~( |   .0972553   .0157633     6.17   0.000     .0663597    .1281509
motivodeeg~( |   .0251361   .0078291     3.21   0.001     .0097914    .0404808
motivodeeg~( |   .0123522   .0078726     1.57   0.117    -.0030778    .0277821
motivodeeg~( |   .0034626   .0081939     0.42   0.673    -.0125972    .0195225
motivodeeg~( |   .0121514   .0081748     1.49   0.137    -.0038708    .0281737
       _cons |   -6.58897   .2636875   -24.99   0.000    -7.105788   -6.072152
------------------------------------------------------------------------------
 ***********
 family Cox tvc 7
 ***********
note; a delayed entry model is being fitted
variables created for model 1, component 18: _cmp_1_18_1 to _cmp_1_18_7

Fitting full model:

Iteration 0:   log likelihood = -233401.56  
Iteration 1:   log likelihood = -20466.895  
Iteration 2:   log likelihood = -18706.238  
Iteration 3:   log likelihood = -18078.396  
Iteration 4:   log likelihood = -18074.203  
Iteration 5:   log likelihood = -18074.178  
Iteration 6:   log likelihood = -18074.178  

Survival model                                  Number of obs     =     59,755
Log likelihood = -18074.178
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |  -.0280413   .0265598    -1.06   0.291    -.0800977     .024015
edad_al_in~1 |   .0151507   .0049413     3.07   0.002      .005466    .0248353
edad_ini_c~s |  -.0259001   .0046852    -5.53   0.000    -.0350829   -.0167173
     sex_enc |  -.5066151   .0441569   -11.47   0.000    -.5931609   -.4200692
     esc_rec |   .2486391   .0264726     9.39   0.000     .1967538    .3005245
sus_prin_mod |   .2184772   .0181666    12.03   0.000     .1828713     .254083
 fr_sus_prin |    .036309   .0165877     2.19   0.029     .0037977    .0688202
 comp_biosoc |   .2207143   .0301844     7.31   0.000     .1615539    .2798747
     ten_viv |  -.0234803   .0156762    -1.50   0.134    -.0542051    .0072445
dg_cie_10_~c |   .0400799   .0185315     2.16   0.031     .0037589    .0764009
sud_sever~10 |    -.10119    .042336    -2.39   0.017     -.184167   -.0182131
   macrozone |   .2425635     .02432     9.97   0.000     .1948971    .2902298
 policonsumo |   .0734771   .0486642     1.51   0.131     -.021903    .1688573
   n_off_vio |   .4112923   .0365323    11.26   0.000     .3396903    .4828943
   n_off_acq |   1.114856   .0336721    33.11   0.000      1.04886    1.180852
   n_off_sud |   .3375061   .0358105     9.42   0.000     .2673187    .4076935
        clas |   .1126863   .0286409     3.93   0.000     .0565512    .1688214
motivodeeg~( |  -.3030218   .0287804   -10.53   0.000    -.3594304   -.2466132
motivodeeg~( |   .0978117   .0163626     5.98   0.000     .0657416    .1298817
motivodeeg~( |   .0247419   .0078269     3.16   0.002     .0094016    .0400823
motivodeeg~( |   .0144652   .0079015     1.83   0.067    -.0010214    .0299519
motivodeeg~( |   .0026042   .0079372     0.33   0.743    -.0129524    .0181608
motivodeeg~( |   .0100515   .0083687     1.20   0.230     -.006351    .0264539
motivodeeg~( |   .0080955   .0086512     0.94   0.349    -.0088606    .0250516
       _cons |  -6.589793   .2638208   -24.98   0.000    -7.106872   -6.072713
------------------------------------------------------------------------------

. 
.         // Gompertz
.         di in yellow "{bf: ***********}"
 ***********

.         di in yellow "{bf: family Gomp}"
 family Gomp

.         di in yellow "{bf: ***********}"
 ***********

.         set seed 2125

.         qui cap noi stmerlin $covs_2 , dist(gompertz)
note; a delayed entry model is being fitted

Fitting full model:

Iteration 0:   log likelihood =  -23175439  
Iteration 1:   log likelihood = -25328.979  
Iteration 2:   log likelihood =   -22602.3  
Iteration 3:   log likelihood = -18181.413  
Iteration 4:   log likelihood = -17934.309  
Iteration 5:   log likelihood = -17922.851  
Iteration 6:   log likelihood = -17922.814  
Iteration 7:   log likelihood = -17922.814  

Survival model                                  Number of obs     =     59,755
Log likelihood = -17922.814
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |   .1330271   .0216996     6.13   0.000     .0904967    .1755576
edad_al_in~1 |    .150792   .0095375    15.81   0.000     .1320988    .1694852
edad_ini_c~s |   -.023687   .0046503    -5.09   0.000    -.0328014   -.0145727
     sex_enc |  -.5003202    .044156   -11.33   0.000    -.5868644   -.4137759
     esc_rec |   .2404719   .0263237     9.14   0.000     .1888784    .2920654
sus_prin_mod |   .2267276   .0182075    12.45   0.000     .1910415    .2624137
 fr_sus_prin |   .0303638   .0166098     1.83   0.068    -.0021909    .0629185
 comp_biosoc |   .2295395   .0302129     7.60   0.000     .1703234    .2887556
     ten_viv |  -.0240712   .0156446    -1.54   0.124    -.0547341    .0065918
dg_cie_10_~c |   .0403695   .0186965     2.16   0.031     .0037251    .0770139
sud_sever~10 |  -.1069822   .0422713    -2.53   0.011    -.1898324   -.0241321
   macrozone |   .2354406    .024337     9.67   0.000      .187741    .2831403
 policonsumo |   .1169943    .048632     2.41   0.016     .0216773    .2123114
   n_off_vio |   .3731639   .0365234    10.22   0.000     .3015795    .4447484
   n_off_acq |   1.058839   .0337356    31.39   0.000     .9927182    1.124959
   n_off_sud |   .3049674   .0357986     8.52   0.000     .2348035    .3751313
        clas |   .1184432   .0286173     4.14   0.000     .0623542    .1745322
       _cons |   -4.44128   .2149435   -20.66   0.000    -4.862561   -4.019998
       gamma |  -.1875864   .0092909   -20.19   0.000    -.2057963   -.1693764
------------------------------------------------------------------------------

.         //qui cap noi merlin (_time $covs if _trans == 1, family(gompertz, fail(_status)))
.         estimates store m2_1_gom

. 
.         // Weibull
.         di in yellow "{bf: ***********}"
 ***********

.         di in yellow "{bf: family Weibull}"
 family Weibull

.         di in yellow "{bf: ***********}"
 ***********

.         set seed 2125

.         qui cap noi stmerlin $covs_2 , dist(weibull)
note; a delayed entry model is being fitted

Fitting full model:

Iteration 0:   log likelihood = -233401.56  
Iteration 1:   log likelihood = -20488.609  (not concave)
Iteration 2:   log likelihood = -18605.226  
Iteration 3:   log likelihood = -18162.559  
Iteration 4:   log likelihood =  -18143.04  (not concave)
Iteration 5:   log likelihood = -18142.613  
Iteration 6:   log likelihood = -18137.651  
Iteration 7:   log likelihood = -18131.722  
Iteration 8:   log likelihood = -18121.609  
Iteration 9:   log likelihood = -18114.671  
Iteration 10:  log likelihood = -18106.354  
Iteration 11:  log likelihood = -18104.292  
Iteration 12:  log likelihood = -18101.836  
Iteration 13:  log likelihood = -18100.554  
Iteration 14:  log likelihood = -18098.394  
Iteration 15:  log likelihood = -18097.427  (not concave)
Iteration 16:  log likelihood = -18097.416  
Iteration 17:  log likelihood = -18097.171  
Iteration 18:  log likelihood =  -18096.61  
Iteration 19:  log likelihood =  -18096.34  
Iteration 20:  log likelihood = -18096.167  
Iteration 21:  log likelihood = -18095.933  
Iteration 22:  log likelihood = -18095.916  
Iteration 23:  log likelihood = -18095.914  
Iteration 24:  log likelihood = -18095.913  
Iteration 25:  log likelihood = -18095.913  
Iteration 26:  log likelihood = -18095.913  (not concave)
Iteration 27:  log likelihood = -18095.913  (not concave)
Iteration 28:  log likelihood = -18095.913  (not concave)
Iteration 29:  log likelihood = -18095.913  (not concave)
Iteration 30:  log likelihood = -18095.913  (not concave)
Iteration 31:  log likelihood = -18095.913  (not concave)
Iteration 32:  log likelihood = -18095.913  (not concave)
Iteration 33:  log likelihood = -18095.913  (not concave)
Iteration 34:  log likelihood = -18095.913  (not concave)
Iteration 35:  log likelihood = -18095.913  (not concave)
Iteration 36:  log likelihood = -18095.913  (not concave)
Iteration 37:  log likelihood = -18095.913  (not concave)
Iteration 38:  log likelihood = -18095.913  (not concave)
Iteration 39:  log likelihood = -18095.913  (not concave)
Iteration 40:  log likelihood = -18095.913  (not concave)
Iteration 41:  log likelihood = -18095.913  (not concave)
Iteration 42:  log likelihood = -18095.913  (not concave)
Iteration 43:  log likelihood = -18095.913  (not concave)
Iteration 44:  log likelihood = -18095.913  (not concave)
Iteration 45:  log likelihood = -18095.913  (not concave)
Iteration 46:  log likelihood = -18095.913  (not concave)
Iteration 47:  log likelihood = -18095.913  (not concave)
Iteration 48:  log likelihood = -18095.913  (not concave)
Iteration 49:  log likelihood = -18095.913  (not concave)
Iteration 50:  log likelihood = -18095.913  (not concave)
Iteration 51:  log likelihood = -18095.913  (not concave)
Iteration 52:  log likelihood = -18095.913  (not concave)
Iteration 53:  log likelihood = -18095.913  (not concave)
Iteration 54:  log likelihood = -18095.913  (not concave)
Iteration 55:  log likelihood = -18095.913  (not concave)
Iteration 56:  log likelihood = -18095.913  (not concave)
Iteration 57:  log likelihood = -18095.913  (not concave)
Iteration 58:  log likelihood = -18095.913  (not concave)
Iteration 59:  log likelihood = -18095.913  (not concave)
Iteration 60:  log likelihood = -18095.913  (not concave)
Iteration 61:  log likelihood = -18095.913  (not concave)
Iteration 62:  log likelihood = -18095.913  (not concave)
Iteration 63:  log likelihood = -18095.913  (not concave)
Iteration 64:  log likelihood = -18095.913  (not concave)
Iteration 65:  log likelihood = -18095.913  (not concave)
Iteration 66:  log likelihood = -18095.913  (not concave)
Iteration 67:  log likelihood = -18095.913  (not concave)
Iteration 68:  log likelihood = -18095.913  (not concave)
Iteration 69:  log likelihood = -18095.913  (not concave)
Iteration 70:  log likelihood = -18095.913  (not concave)
Iteration 71:  log likelihood = -18095.913  (not concave)
Iteration 72:  log likelihood = -18095.913  (not concave)
Iteration 73:  log likelihood = -18095.913  (not concave)
Iteration 74:  log likelihood = -18095.913  (not concave)
Iteration 75:  log likelihood = -18095.913  (not concave)
Iteration 76:  log likelihood = -18095.913  (not concave)
Iteration 77:  log likelihood = -18095.913  (not concave)
Iteration 78:  log likelihood = -18095.913  (not concave)
Iteration 79:  log likelihood = -18095.913  (not concave)
Iteration 80:  log likelihood = -18095.913  (not concave)
Iteration 81:  log likelihood = -18095.913  (not concave)
Iteration 82:  log likelihood = -18095.913  (not concave)
Iteration 83:  log likelihood = -18095.913  (not concave)
Iteration 84:  log likelihood = -18095.913  (not concave)
Iteration 85:  log likelihood = -18095.913  (not concave)
Iteration 86:  log likelihood = -18095.913  (not concave)
Iteration 87:  log likelihood = -18095.913  (not concave)
Iteration 88:  log likelihood = -18095.913  (not concave)
Iteration 89:  log likelihood = -18095.913  (not concave)
Iteration 90:  log likelihood = -18095.913  (not concave)
Iteration 91:  log likelihood = -18095.913  (not concave)
Iteration 92:  log likelihood = -18095.913  (not concave)
Iteration 93:  log likelihood = -18095.913  (not concave)
Iteration 94:  log likelihood = -18095.913  (not concave)
Iteration 95:  log likelihood = -18095.913  (not concave)
Iteration 96:  log likelihood = -18095.913  (not concave)
Iteration 97:  log likelihood = -18095.913  (not concave)
Iteration 98:  log likelihood = -18095.913  (not concave)
Iteration 99:  log likelihood = -18095.913  (not concave)
Iteration 100: log likelihood = -18095.913  (not concave)
Iteration 101: log likelihood = -18095.913  (not concave)
Iteration 102: log likelihood = -18095.913  (not concave)
Iteration 103: log likelihood = -18095.913  (not concave)
Iteration 104: log likelihood = -18095.913  (not concave)
Iteration 105: log likelihood = -18095.913  (not concave)
Iteration 106: log likelihood = -18095.913  (not concave)
Iteration 107: log likelihood = -18095.913  (not concave)
Iteration 108: log likelihood = -18095.913  (not concave)
Iteration 109: log likelihood = -18095.913  (not concave)
Iteration 110: log likelihood = -18095.913  (not concave)
Iteration 111: log likelihood = -18095.913  (not concave)
Iteration 112: log likelihood = -18095.913  (not concave)
Iteration 113: log likelihood = -18095.913  (not concave)
Iteration 114: log likelihood = -18095.913  (not concave)
Iteration 115: log likelihood = -18095.913  (not concave)
Iteration 116: log likelihood = -18095.913  (not concave)
Iteration 117: log likelihood = -18095.913  (not concave)
Iteration 118: log likelihood = -18095.913  (not concave)
Iteration 119: log likelihood = -18095.913  (not concave)
Iteration 120: log likelihood = -18095.913  (not concave)
Iteration 121: log likelihood = -18095.913  (not concave)
Iteration 122: log likelihood = -18095.913  (not concave)
Iteration 123: log likelihood = -18095.913  (not concave)
Iteration 124: log likelihood = -18095.913  (not concave)
Iteration 125: log likelihood = -18095.913  (not concave)
Iteration 126: log likelihood = -18095.913  (not concave)
Iteration 127: log likelihood = -18095.913  (not concave)
Iteration 128: log likelihood = -18095.913  (not concave)
Iteration 129: log likelihood = -18095.913  (not concave)
Iteration 130: log likelihood = -18095.913  (not concave)
Iteration 131: log likelihood = -18095.913  (not concave)
Iteration 132: log likelihood = -18095.913  (not concave)
Iteration 133: log likelihood = -18095.913  (not concave)
Iteration 134: log likelihood = -18095.913  (not concave)
Iteration 135: log likelihood = -18095.913  (not concave)
Iteration 136: log likelihood = -18095.913  (not concave)
Iteration 137: log likelihood = -18095.913  (not concave)
Iteration 138: log likelihood = -18095.913  (not concave)
Iteration 139: log likelihood = -18095.913  (not concave)
Iteration 140: log likelihood = -18095.913  (not concave)
Iteration 141: log likelihood = -18095.913  (not concave)
Iteration 142: log likelihood = -18095.913  (not concave)
Iteration 143: log likelihood = -18095.913  (not concave)
Iteration 144: log likelihood = -18095.913  (not concave)
Iteration 145: log likelihood = -18095.913  (not concave)
Iteration 146: log likelihood = -18095.913  (not concave)
Iteration 147: log likelihood = -18095.913  (not concave)
Iteration 148: log likelihood = -18095.913  (not concave)
Iteration 149: log likelihood = -18095.913  (not concave)
Iteration 150: log likelihood = -18095.913  (not concave)
Iteration 151: log likelihood = -18095.913  (not concave)
Iteration 152: log likelihood = -18095.913  (not concave)
Iteration 153: log likelihood = -18095.913  (not concave)
Iteration 154: log likelihood = -18095.913  (not concave)
Iteration 155: log likelihood = -18095.913  (not concave)
Iteration 156: log likelihood = -18095.913  (not concave)
Iteration 157: log likelihood = -18095.913  (not concave)
Iteration 158: log likelihood = -18095.913  (not concave)
Iteration 159: log likelihood = -18095.913  (not concave)
Iteration 160: log likelihood = -18095.913  (not concave)
Iteration 161: log likelihood = -18095.913  (not concave)
Iteration 162: log likelihood = -18095.913  (not concave)
Iteration 163: log likelihood = -18095.913  (not concave)
Iteration 164: log likelihood = -18095.913  (not concave)
Iteration 165: log likelihood = -18095.913  (not concave)
Iteration 166: log likelihood = -18095.913  (not concave)
Iteration 167: log likelihood = -18095.913  (not concave)
Iteration 168: log likelihood = -18095.913  (not concave)
Iteration 169: log likelihood = -18095.913  (not concave)
Iteration 170: log likelihood = -18095.913  (not concave)
Iteration 171: log likelihood = -18095.913  (not concave)
Iteration 172: log likelihood = -18095.913  (not concave)
Iteration 173: log likelihood = -18095.913  (not concave)
Iteration 174: log likelihood = -18095.913  (not concave)
Iteration 175: log likelihood = -18095.913  (not concave)
Iteration 176: log likelihood = -18095.913  (not concave)
Iteration 177: log likelihood = -18095.913  (not concave)
Iteration 178: log likelihood = -18095.913  (not concave)
Iteration 179: log likelihood = -18095.913  (not concave)
Iteration 180: log likelihood = -18095.913  (not concave)
Iteration 181: log likelihood = -18095.913  (not concave)
Iteration 182: log likelihood = -18095.913  (not concave)
Iteration 183: log likelihood = -18095.913  (not concave)
Iteration 184: log likelihood = -18095.913  (not concave)
Iteration 185: log likelihood = -18095.913  (not concave)
Iteration 186: log likelihood = -18095.913  (not concave)
Iteration 187: log likelihood = -18095.913  (not concave)
Iteration 188: log likelihood = -18095.913  (not concave)
Iteration 189: log likelihood = -18095.913  (not concave)
Iteration 190: log likelihood = -18095.913  (not concave)
Iteration 191: log likelihood = -18095.913  (not concave)
Iteration 192: log likelihood = -18095.913  (not concave)
Iteration 193: log likelihood = -18095.913  (not concave)
Iteration 194: log likelihood = -18095.913  (not concave)
Iteration 195: log likelihood = -18095.913  (not concave)
Iteration 196: log likelihood = -18095.913  (not concave)
Iteration 197: log likelihood = -18095.913  (not concave)
Iteration 198: log likelihood = -18095.913  (not concave)
Iteration 199: log likelihood = -18095.913  (not concave)
Iteration 200: log likelihood = -18095.913  (not concave)
Iteration 201: log likelihood = -18095.913  (not concave)
Iteration 202: log likelihood = -18095.913  (not concave)
Iteration 203: log likelihood = -18095.913  (not concave)
Iteration 204: log likelihood = -18095.913  (not concave)
Iteration 205: log likelihood = -18095.913  (not concave)
Iteration 206: log likelihood = -18095.913  (not concave)
Iteration 207: log likelihood = -18095.913  (not concave)
Iteration 208: log likelihood = -18095.913  (not concave)
Iteration 209: log likelihood = -18095.913  (not concave)
Iteration 210: log likelihood = -18095.913  (not concave)
Iteration 211: log likelihood = -18095.913  (not concave)
Iteration 212: log likelihood = -18095.913  (not concave)
Iteration 213: log likelihood = -18095.913  (not concave)
Iteration 214: log likelihood = -18095.913  (not concave)
Iteration 215: log likelihood = -18095.913  (not concave)
Iteration 216: log likelihood = -18095.913  (not concave)
Iteration 217: log likelihood = -18095.913  (not concave)
Iteration 218: log likelihood = -18095.913  (not concave)
Iteration 219: log likelihood = -18095.913  (not concave)
Iteration 220: log likelihood = -18095.913  (not concave)
Iteration 221: log likelihood = -18095.913  (not concave)
Iteration 222: log likelihood = -18095.913  (not concave)
Iteration 223: log likelihood = -18095.913  (not concave)
Iteration 224: log likelihood = -18095.913  (not concave)
Iteration 225: log likelihood = -18095.913  (not concave)
Iteration 226: log likelihood = -18095.913  (not concave)
Iteration 227: log likelihood = -18095.913  (not concave)
Iteration 228: log likelihood = -18095.913  (not concave)
Iteration 229: log likelihood = -18095.913  (not concave)
Iteration 230: log likelihood = -18095.913  (not concave)
Iteration 231: log likelihood = -18095.913  (not concave)
Iteration 232: log likelihood = -18095.913  (not concave)
Iteration 233: log likelihood = -18095.913  (not concave)
Iteration 234: log likelihood = -18095.913  (not concave)
Iteration 235: log likelihood = -18095.913  (not concave)
Iteration 236: log likelihood = -18095.913  (not concave)
Iteration 237: log likelihood = -18095.913  (not concave)
Iteration 238: log likelihood = -18095.913  (not concave)
Iteration 239: log likelihood = -18095.913  (not concave)
Iteration 240: log likelihood = -18095.913  (not concave)
Iteration 241: log likelihood = -18095.913  (not concave)
Iteration 242: log likelihood = -18095.913  (not concave)
Iteration 243: log likelihood = -18095.913  (not concave)
Iteration 244: log likelihood = -18095.913  (not concave)
Iteration 245: log likelihood = -18095.913  (not concave)
Iteration 246: log likelihood = -18095.913  (not concave)
Iteration 247: log likelihood = -18095.913  (not concave)
Iteration 248: log likelihood = -18095.913  (not concave)
Iteration 249: log likelihood = -18095.913  (not concave)
Iteration 250: log likelihood = -18095.913  (not concave)
Iteration 251: log likelihood = -18095.913  (not concave)
Iteration 252: log likelihood = -18095.913  (not concave)
Iteration 253: log likelihood = -18095.913  (not concave)
Iteration 254: log likelihood = -18095.913  (not concave)
Iteration 255: log likelihood = -18095.913  (not concave)
Iteration 256: log likelihood = -18095.913  (not concave)
Iteration 257: log likelihood = -18095.913  (not concave)
Iteration 258: log likelihood = -18095.913  (not concave)
Iteration 259: log likelihood = -18095.913  (not concave)
Iteration 260: log likelihood = -18095.913  (not concave)
Iteration 261: log likelihood = -18095.913  (not concave)
Iteration 262: log likelihood = -18095.913  (not concave)
Iteration 263: log likelihood = -18095.913  (not concave)
Iteration 264: log likelihood = -18095.913  (not concave)
Iteration 265: log likelihood = -18095.913  (not concave)
Iteration 266: log likelihood = -18095.913  (not concave)
Iteration 267: log likelihood = -18095.913  (not concave)
Iteration 268: log likelihood = -18095.913  (not concave)
Iteration 269: log likelihood = -18095.913  (not concave)
Iteration 270: log likelihood = -18095.913  (not concave)
Iteration 271: log likelihood = -18095.913  (not concave)
Iteration 272: log likelihood = -18095.913  (not concave)
Iteration 273: log likelihood = -18095.913  (not concave)
Iteration 274: log likelihood = -18095.913  (not concave)
Iteration 275: log likelihood = -18095.913  (not concave)
Iteration 276: log likelihood = -18095.913  (not concave)
Iteration 277: log likelihood = -18095.913  (not concave)
Iteration 278: log likelihood = -18095.913  (not concave)
Iteration 279: log likelihood = -18095.913  (not concave)
Iteration 280: log likelihood = -18095.913  (not concave)
Iteration 281: log likelihood = -18095.913  (not concave)
Iteration 282: log likelihood = -18095.913  (not concave)
Iteration 283: log likelihood = -18095.913  (not concave)
Iteration 284: log likelihood = -18095.913  (not concave)
Iteration 285: log likelihood = -18095.913  (not concave)
Iteration 286: log likelihood = -18095.913  (not concave)
Iteration 287: log likelihood = -18095.913  (not concave)
Iteration 288: log likelihood = -18095.913  (not concave)
Iteration 289: log likelihood = -18095.913  (not concave)
Iteration 290: log likelihood = -18095.913  (not concave)
Iteration 291: log likelihood = -18095.913  (not concave)
Iteration 292: log likelihood = -18095.913  (not concave)
Iteration 293: log likelihood = -18095.913  (not concave)
Iteration 294: log likelihood = -18095.913  (not concave)
Iteration 295: log likelihood = -18095.913  (not concave)
Iteration 296: log likelihood = -18095.913  (not concave)
Iteration 297: log likelihood = -18095.913  (not concave)
Iteration 298: log likelihood = -18095.913  (not concave)
Iteration 299: log likelihood = -18095.913  (not concave)
Iteration 300: log likelihood = -18095.913  (not concave)
convergence not achieved

Survival model                                  Number of obs     =     59,755
Log likelihood = -18095.913
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |   .1317154    .021417     6.15   0.000     .0897388     .173692
edad_al_in~1 |   -.008856    .002061    -4.30   0.000    -.0128955   -.0048165
edad_ini_c~s |  -.0255288   .0046395    -5.50   0.000    -.0346221   -.0164355
     sex_enc |  -.5067476   .0441787   -11.47   0.000    -.5933362    -.420159
     esc_rec |   .2307585   .0263562     8.76   0.000     .1791013    .2824157
sus_prin_mod |   .2169924   .0180854    12.00   0.000     .1815456    .2524392
 fr_sus_prin |   .0340983   .0166141     2.05   0.040     .0015353    .0666613
 comp_biosoc |   .2192777   .0301563     7.27   0.000     .1601724     .278383
     ten_viv |  -.0185395   .0156644    -1.18   0.237    -.0492412    .0121621
dg_cie_10_~c |   .0397738   .0185807     2.14   0.032     .0033564    .0761912
sud_sever~10 |   -.107603   .0422691    -2.55   0.011    -.1904488   -.0247571
   macrozone |   .2385112   .0243282     9.80   0.000     .1908288    .2861936
 policonsumo |    .082049   .0485853     1.69   0.091    -.0131765    .1772744
   n_off_vio |    .417209   .0364886    11.43   0.000     .3456926    .4887253
   n_off_acq |   1.119769   .0336202    33.31   0.000     1.053874    1.185663
   n_off_sud |   .3490227   .0357809     9.75   0.000     .2788934     .419152
        clas |   .1076992   .0286249     3.76   0.000     .0515955    .1638029
       _cons |   14.38984          .        .       .            .           .
  log(gamma) |   -16.6463   .2137268   -77.89   0.000     -17.0652    -16.2274
------------------------------------------------------------------------------

.         //qui cap noi merlin (_time $covs if _trans == 1, family(gompertz, fail(_status)))
.         estimates store m2_1_wei

.         
.         // Log logistic
.         di in yellow "{bf: ***********}"
 ***********

.         di in yellow "{bf: family Logl}"
 family Logl

.         di in yellow "{bf: ***********}"
 ***********

.         set seed 2125

.         qui cap noi stmerlin $covs_2 , dist(loglogistic)
note; a delayed entry model is being fitted

Fitting full model:

Iteration 0:   log likelihood = -20064.873  (not concave)
Iteration 1:   log likelihood =  -20033.19  (not concave)
Iteration 2:   log likelihood = -18734.102  (not concave)
Iteration 3:   log likelihood = -18504.793  (not concave)
Iteration 4:   log likelihood = -18410.588  (not concave)
Iteration 5:   log likelihood =  -18366.73  (not concave)
Iteration 6:   log likelihood = -18346.993  (not concave)
Iteration 7:   log likelihood = -18326.771  (not concave)
Iteration 8:   log likelihood =  -18317.54  (not concave)
Iteration 9:   log likelihood = -18305.826  (not concave)
Iteration 10:  log likelihood = -18294.415  (not concave)
Iteration 11:  log likelihood = -18288.176  
Iteration 12:  log likelihood = -18199.328  
Iteration 13:  log likelihood = -18140.751  
Iteration 14:  log likelihood = -18136.237  
Iteration 15:  log likelihood = -18135.484  
Iteration 16:  log likelihood =  -18135.48  
Iteration 17:  log likelihood =  -18135.48  

Survival model                                  Number of obs     =     59,755
Log likelihood =  -18135.48
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |  -.0974722   .0165511    -5.89   0.000    -.1299118   -.0650327
edad_al_in~1 |   .0357222   .0016083    22.21   0.000     .0325701    .0388743
edad_ini_c~s |   .0161467   .0031915     5.06   0.000     .0098915    .0224019
     sex_enc |   .3716758   .0364986    10.18   0.000     .3001399    .4432116
     esc_rec |  -.1647651   .0212071    -7.77   0.000    -.2063302   -.1231999
sus_prin_mod |  -.1484725    .015564    -9.54   0.000    -.1789774   -.1179676
 fr_sus_prin |  -.0342671   .0121928    -2.81   0.005    -.0581645   -.0103697
 comp_biosoc |  -.1564546   .0237645    -6.58   0.000    -.2030322    -.109877
     ten_viv |   .0153271   .0122025     1.26   0.209    -.0085894    .0392436
dg_cie_10_~c |  -.0217444   .0142456    -1.53   0.127    -.0496652    .0061765
sud_sever~10 |    .057354   .0306366     1.87   0.061    -.0026926    .1174007
   macrozone |  -.1750096   .0220358    -7.94   0.000    -.2181989   -.1318202
 policonsumo |  -.0286542    .034173    -0.84   0.402     -.095632    .0383235
   n_off_vio |  -.4167489   .0404012   -10.32   0.000    -.4959337   -.3375641
   n_off_acq |  -.9952754   .0719441   -13.83   0.000    -1.136283   -.8542677
   n_off_sud |  -.3448578   .0374426    -9.21   0.000    -.4182439   -.2714716
        clas |  -.0611817    .021535    -2.84   0.004    -.1033896   -.0189738
       _cons |    4.24267   .1617643    26.23   0.000     3.925618    4.559722
       dap:1 |    -.81126   .0382933   -21.19   0.000    -.8863135   -.7362065
------------------------------------------------------------------------------

.         //qui cap noi merlin (_time $covs if _trans == 1, family(loglogistic, fail(_status)))
.         estimates store m2_1_logl

. 
.         // Log normal
.         di in yellow "{bf: ***********}"
 ***********

.         di in yellow "{bf: family Logn}"
 family Logn

.         di in yellow "{bf: ***********}"
 ***********

.         set seed 2125

.         qui cap noi stmerlin $covs_2 , dist(lognormal)
note; a delayed entry model is being fitted

Fitting full model:

Iteration 0:   log likelihood = -33053.961  (not concave)
Iteration 1:   log likelihood = -21475.955  (not concave)
Iteration 2:   log likelihood = -19430.343  (not concave)
Iteration 3:   log likelihood = -18719.789  
Iteration 4:   log likelihood = -18414.254  (backed up)
Iteration 5:   log likelihood = -18246.139  
Iteration 6:   log likelihood = -18171.858  
Iteration 7:   log likelihood = -18145.434  
Iteration 8:   log likelihood = -18115.354  
Iteration 9:   log likelihood = -18115.248  
Iteration 10:  log likelihood = -18097.462  
Iteration 11:  log likelihood = -18094.582  
Iteration 12:  log likelihood =  -18091.98  
Iteration 13:  log likelihood = -18091.415  
Iteration 14:  log likelihood = -18090.586  
Iteration 15:  log likelihood = -18090.468  
Iteration 16:  log likelihood = -18090.445  
Iteration 17:  log likelihood = -18090.444  

Survival model                                  Number of obs     =     59,755
Log likelihood = -18090.444
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |  -.2863444   .0707408    -4.05   0.000    -.4249939    -.147695
edad_al_in~1 |    .052058   .0067099     7.76   0.000     .0389068    .0652092
edad_ini_c~s |   .0424814   .0114114     3.72   0.000     .0201155    .0648472
     sex_enc |   1.139331   .2308911     4.93   0.000     .6867926    1.591869
     esc_rec |  -.5055517     .11013    -4.59   0.000    -.7214025   -.2897009
sus_prin_mod |   -.477813    .099348    -4.81   0.000    -.6725315   -.2830945
 fr_sus_prin |  -.1212626   .0441213    -2.75   0.006    -.2077389   -.0347864
 comp_biosoc |  -.4615491    .108843    -4.24   0.000    -.6748774   -.2482208
     ten_viv |   .0512756   .0397362     1.29   0.197    -.0266058    .1291571
dg_cie_10_~c |  -.0733538   .0464226    -1.58   0.114    -.1643405    .0176329
sud_sever~10 |   .1532806   .0959881     1.60   0.110    -.0348527    .3414139
   macrozone |  -.5577172   .1226181    -4.55   0.000    -.7980442   -.3173901
 policonsumo |    -.12277   .1059545    -1.16   0.247     -.330437     .084897
   n_off_vio |  -1.339563   .2857668    -4.69   0.000    -1.899656   -.7794704
   n_off_acq |   -3.41275   .7199551    -4.74   0.000    -4.823837   -2.001664
   n_off_sud |  -1.147916   .2525861    -4.54   0.000    -1.642976   -.6528565
        clas |  -.2041612     .07502    -2.72   0.007    -.3511978   -.0571246
       _cons |   6.063686   .6085038     9.96   0.000     4.871041    7.256332
       dap:1 |   .4687489   .1237405     3.79   0.000     .2262219    .7112759
------------------------------------------------------------------------------

.         //qui cap noi merlin (_time $covs if _trans == 1, family(lognormal, fail(_status)))
.         estimates store m2_1_logn

.         
.         // Generalised gamma
.         di in yellow "{bf: ***********}"
 ***********

.         di in yellow "{bf: family Ggam}"
 family Ggam

.         di in yellow "{bf: ***********}"
 ***********

.         set seed 2125

.         qui cap noi stmerlin $covs_2 , dist(ggamma)
note; a delayed entry model is being fitted

Fitting full model:

Iteration 0:   log likelihood = -21405.054  (not concave)
Iteration 1:   log likelihood = -19350.697  (not concave)
Iteration 2:   log likelihood = -18762.239  (not concave)
Iteration 3:   log likelihood = -18543.466  
Iteration 4:   log likelihood = -18299.243  (not concave)
Iteration 5:   log likelihood = -18282.705  (not concave)
Iteration 6:   log likelihood = -18189.688  (not concave)
Iteration 7:   log likelihood = -18146.109  (not concave)
Iteration 8:   log likelihood = -18109.262  (not concave)
Iteration 9:   log likelihood = -18096.961  
Iteration 10:  log likelihood =  -18084.54  
Iteration 11:  log likelihood = -18080.785  
Iteration 12:  log likelihood =  -18076.61  (not concave)
Iteration 13:  log likelihood = -18075.569  (not concave)
Iteration 14:  log likelihood = -18075.389  (not concave)
Iteration 15:  log likelihood = -18075.244  (not concave)
Iteration 16:  log likelihood = -18075.123  (not concave)
Iteration 17:  log likelihood = -18075.029  
Iteration 18:  log likelihood = -18074.115  (not concave)
Iteration 19:  log likelihood = -18072.707  (not concave)
Iteration 20:  log likelihood = -18072.542  (not concave)
Iteration 21:  log likelihood = -18072.387  (not concave)
Iteration 22:  log likelihood = -18072.311  (not concave)
Iteration 23:  log likelihood = -18072.258  (not concave)
Iteration 24:  log likelihood = -18072.219  (not concave)
Iteration 25:  log likelihood = -18072.187  (not concave)
Iteration 26:  log likelihood = -18072.165  (not concave)
Iteration 27:  log likelihood = -18072.138  (not concave)
Iteration 28:  log likelihood = -18072.114  
Iteration 29:  log likelihood = -18072.025  (not concave)
Iteration 30:  log likelihood = -18071.937  (not concave)
Iteration 31:  log likelihood = -18071.899  
Iteration 32:  log likelihood = -18071.872  (not concave)
Iteration 33:  log likelihood = -18071.848  (not concave)
Iteration 34:  log likelihood = -18071.815  (not concave)
Iteration 35:  log likelihood = -18071.795  (not concave)
Iteration 36:  log likelihood = -18071.775  (not concave)
Iteration 37:  log likelihood = -18071.753  (not concave)
Iteration 38:  log likelihood = -18071.721  (not concave)
Iteration 39:  log likelihood = -18071.717  
Iteration 40:  log likelihood = -18071.684  (not concave)
Iteration 41:  log likelihood = -18071.578  (not concave)
Iteration 42:  log likelihood = -18071.531  (not concave)
Iteration 43:  log likelihood = -18071.482  (not concave)
Iteration 44:  log likelihood = -18071.459  (not concave)
Iteration 45:  log likelihood = -18071.451  (not concave)
Iteration 46:  log likelihood = -18071.448  (not concave)
Iteration 47:  log likelihood = -18071.236  (not concave)
Iteration 48:  log likelihood = -18071.212  (not concave)
Iteration 49:  log likelihood = -18071.195  (not concave)
Iteration 50:  log likelihood =  -18071.18  (not concave)
Iteration 51:  log likelihood = -18071.169  (not concave)
Iteration 52:  log likelihood =  -18071.13  (not concave)
Iteration 53:  log likelihood = -18071.122  (not concave)
Iteration 54:  log likelihood = -18071.117  (not concave)
Iteration 55:  log likelihood = -18071.112  (not concave)
Iteration 56:  log likelihood = -18071.108  (not concave)
Iteration 57:  log likelihood = -18071.092  (not concave)
Iteration 58:  log likelihood = -18071.084  (not concave)
Iteration 59:  log likelihood = -18071.065  (not concave)
Iteration 60:  log likelihood = -18071.033  (not concave)
Iteration 61:  log likelihood = -18071.013  (not concave)
Iteration 62:  log likelihood = -18070.997  (not concave)
Iteration 63:  log likelihood = -18070.973  (not concave)
Iteration 64:  log likelihood = -18070.963  (not concave)
Iteration 65:  log likelihood = -18070.926  (not concave)
Iteration 66:  log likelihood = -18070.907  (not concave)
Iteration 67:  log likelihood = -18070.879  (not concave)
Iteration 68:  log likelihood = -18070.872  (not concave)
Iteration 69:  log likelihood = -18070.859  (not concave)
Iteration 70:  log likelihood = -18070.846  (not concave)
Iteration 71:  log likelihood = -18070.842  (not concave)
Iteration 72:  log likelihood = -18070.841  (not concave)
Iteration 73:  log likelihood = -18070.838  (not concave)
Iteration 74:  log likelihood = -18070.837  (not concave)
Iteration 75:  log likelihood = -18070.808  (not concave)
Iteration 76:  log likelihood =   -18070.8  (not concave)
Iteration 77:  log likelihood = -18070.793  (not concave)
Iteration 78:  log likelihood = -18070.788  (not concave)
Iteration 79:  log likelihood = -18070.784  (not concave)
Iteration 80:  log likelihood = -18070.781  (not concave)
Iteration 81:  log likelihood = -18070.779  (not concave)
Iteration 82:  log likelihood = -18070.778  (not concave)
Iteration 83:  log likelihood = -18070.761  (not concave)
Iteration 84:  log likelihood = -18070.745  (not concave)
Iteration 85:  log likelihood = -18070.739  (not concave)
Iteration 86:  log likelihood = -18070.736  (not concave)
Iteration 87:  log likelihood = -18070.733  (not concave)
Iteration 88:  log likelihood = -18070.717  (not concave)
Iteration 89:  log likelihood = -18070.712  (not concave)
Iteration 90:  log likelihood = -18070.708  (not concave)
Iteration 91:  log likelihood = -18070.703  (not concave)
Iteration 92:  log likelihood = -18070.702  (not concave)
Iteration 93:  log likelihood = -18070.699  (not concave)
Iteration 94:  log likelihood = -18070.696  (not concave)
Iteration 95:  log likelihood = -18070.694  (not concave)
Iteration 96:  log likelihood = -18070.692  (not concave)
Iteration 97:  log likelihood = -18070.677  (not concave)
Iteration 98:  log likelihood = -18070.674  (not concave)
Iteration 99:  log likelihood = -18070.664  (not concave)
Iteration 100: log likelihood = -18070.656  (not concave)
Iteration 101: log likelihood =  -18070.65  (not concave)
Iteration 102: log likelihood = -18070.646  (not concave)
Iteration 103: log likelihood = -18070.644  (not concave)
Iteration 104: log likelihood = -18070.638  (not concave)
Iteration 105: log likelihood = -18070.631  (not concave)
Iteration 106: log likelihood = -18070.628  (not concave)
Iteration 107: log likelihood = -18070.627  (not concave)
Iteration 108: log likelihood = -18070.615  (not concave)
Iteration 109: log likelihood = -18070.609  (not concave)
Iteration 110: log likelihood = -18070.609  (not concave)
Iteration 111: log likelihood = -18070.599  (not concave)
Iteration 112: log likelihood =  -18070.59  (not concave)
Iteration 113: log likelihood = -18070.585  (not concave)
Iteration 114: log likelihood = -18070.584  (not concave)
Iteration 115: log likelihood = -18070.583  (not concave)
Iteration 116: log likelihood = -18070.557  (not concave)
Iteration 117: log likelihood =  -18070.55  (not concave)
Iteration 118: log likelihood = -18070.542  (not concave)
Iteration 119: log likelihood = -18070.539  (not concave)
Iteration 120: log likelihood = -18070.538  (not concave)
Iteration 121: log likelihood = -18070.538  (not concave)
Iteration 122: log likelihood = -18070.537  (not concave)
Iteration 123: log likelihood = -18070.537  (not concave)
Iteration 124: log likelihood = -18070.535  (not concave)
Iteration 125: log likelihood = -18070.534  (not concave)
Iteration 126: log likelihood = -18070.532  (not concave)
Iteration 127: log likelihood = -18070.529  (not concave)
Iteration 128: log likelihood = -18070.528  (not concave)
Iteration 129: log likelihood = -18070.526  (not concave)
Iteration 130: log likelihood = -18070.523  (not concave)
Iteration 131: log likelihood =  -18070.52  (not concave)
Iteration 132: log likelihood = -18070.516  (not concave)
Iteration 133: log likelihood = -18070.513  (not concave)
Iteration 134: log likelihood = -18070.513  (not concave)
Iteration 135: log likelihood = -18070.511  (not concave)
Iteration 136: log likelihood =  -18070.51  (not concave)
Iteration 137: log likelihood = -18070.508  (not concave)
Iteration 138: log likelihood = -18070.506  (not concave)
Iteration 139: log likelihood = -18070.505  (not concave)
Iteration 140: log likelihood = -18070.498  (not concave)
Iteration 141: log likelihood = -18070.495  (not concave)
Iteration 142: log likelihood = -18070.492  (not concave)
Iteration 143: log likelihood = -18070.489  (not concave)
Iteration 144: log likelihood = -18070.479  (not concave)
Iteration 145: log likelihood = -18070.472  (not concave)
Iteration 146: log likelihood = -18070.469  (not concave)
Iteration 147: log likelihood = -18070.467  (not concave)
Iteration 148: log likelihood = -18070.467  (not concave)
Iteration 149: log likelihood = -18070.467  (not concave)
Iteration 150: log likelihood = -18070.442  (not concave)
Iteration 151: log likelihood = -18070.435  (not concave)
Iteration 152: log likelihood = -18070.433  (not concave)
Iteration 153: log likelihood = -18070.433  (not concave)
Iteration 154: log likelihood = -18070.433  (not concave)
Iteration 155: log likelihood = -18070.433  (not concave)
Iteration 156: log likelihood =  -18070.41  (not concave)
Iteration 157: log likelihood = -18070.408  (not concave)
Iteration 158: log likelihood =   -18070.4  (not concave)
Iteration 159: log likelihood =   -18070.4  (not concave)
Iteration 160: log likelihood =  -18070.39  (not concave)
Iteration 161: log likelihood = -18070.384  (not concave)
Iteration 162: log likelihood =  -18070.38  (not concave)
Iteration 163: log likelihood = -18070.378  (not concave)
Iteration 164: log likelihood = -18070.364  (not concave)
Iteration 165: log likelihood = -18070.361  (not concave)
Iteration 166: log likelihood = -18070.359  (not concave)
Iteration 167: log likelihood = -18070.359  (not concave)
Iteration 168: log likelihood = -18070.359  (not concave)
Iteration 169: log likelihood = -18070.359  (not concave)
Iteration 170: log likelihood = -18070.358  (not concave)
Iteration 171: log likelihood = -18070.358  (not concave)
Iteration 172: log likelihood = -18070.358  (not concave)
Iteration 173: log likelihood = -18070.358  (not concave)
Iteration 174: log likelihood = -18070.358  (not concave)
Iteration 175: log likelihood = -18070.358  (not concave)
Iteration 176: log likelihood = -18070.358  (not concave)
Iteration 177: log likelihood = -18070.358  (not concave)
Iteration 178: log likelihood = -18070.358  (not concave)
Iteration 179: log likelihood = -18070.358  (not concave)
Iteration 180: log likelihood = -18070.358  (not concave)
Iteration 181: log likelihood = -18070.358  (not concave)
Iteration 182: log likelihood = -18070.358  (not concave)
Iteration 183: log likelihood = -18070.358  (not concave)
Iteration 184: log likelihood = -18070.358  (not concave)
Iteration 185: log likelihood = -18070.358  (not concave)
Iteration 186: log likelihood = -18070.358  (not concave)
Iteration 187: log likelihood = -18070.358  (not concave)
Iteration 188: log likelihood = -18070.358  (not concave)
Iteration 189: log likelihood = -18070.358  (not concave)
Iteration 190: log likelihood = -18070.358  (not concave)
Iteration 191: log likelihood = -18070.358  (not concave)
Iteration 192: log likelihood = -18070.358  (not concave)
Iteration 193: log likelihood = -18070.358  (not concave)
Iteration 194: log likelihood = -18070.358  (not concave)
Iteration 195: log likelihood = -18070.358  (not concave)
Iteration 196: log likelihood = -18070.358  (not concave)
Iteration 197: log likelihood = -18070.358  (not concave)
Iteration 198: log likelihood = -18070.358  (not concave)
Iteration 199: log likelihood = -18070.358  (not concave)
Iteration 200: log likelihood = -18070.358  (not concave)
Iteration 201: log likelihood = -18070.358  (not concave)
Iteration 202: log likelihood = -18070.358  (not concave)
Iteration 203: log likelihood = -18070.358  (not concave)
Iteration 204: log likelihood = -18070.358  (not concave)
Iteration 205: log likelihood = -18070.358  (not concave)
Iteration 206: log likelihood = -18070.358  (not concave)
Iteration 207: log likelihood = -18070.358  (not concave)
Iteration 208: log likelihood = -18070.358  (not concave)
Iteration 209: log likelihood = -18070.358  (not concave)
Iteration 210: log likelihood = -18070.358  (not concave)
Iteration 211: log likelihood = -18070.358  (not concave)
Iteration 212: log likelihood = -18070.358  (not concave)
Iteration 213: log likelihood = -18070.358  (not concave)
Iteration 214: log likelihood = -18070.358  (not concave)
Iteration 215: log likelihood = -18070.358  (not concave)
Iteration 216: log likelihood = -18070.358  (not concave)
Iteration 217: log likelihood = -18070.358  (not concave)
Iteration 218: log likelihood = -18070.358  (not concave)
Iteration 219: log likelihood = -18070.358  (not concave)
Iteration 220: log likelihood = -18070.358  (not concave)
Iteration 221: log likelihood = -18070.358  (not concave)
Iteration 222: log likelihood = -18070.358  (not concave)
Iteration 223: log likelihood = -18070.358  (not concave)
Iteration 224: log likelihood = -18070.358  (not concave)
Iteration 225: log likelihood = -18070.358  (not concave)
Iteration 226: log likelihood = -18070.358  (not concave)
Iteration 227: log likelihood = -18070.358  (not concave)
Iteration 228: log likelihood = -18070.358  (not concave)
Iteration 229: log likelihood = -18070.358  (not concave)
Iteration 230: log likelihood = -18070.358  (not concave)
Iteration 231: log likelihood = -18070.358  (not concave)
Iteration 232: log likelihood = -18070.358  (not concave)
Iteration 233: log likelihood = -18070.358  (not concave)
Iteration 234: log likelihood = -18070.358  (not concave)
Iteration 235: log likelihood = -18070.358  (not concave)
Iteration 236: log likelihood = -18070.358  (not concave)
Iteration 237: log likelihood = -18070.358  (not concave)
Iteration 238: log likelihood = -18070.358  (not concave)
Iteration 239: log likelihood = -18070.358  (not concave)
Iteration 240: log likelihood = -18070.358  (not concave)
Iteration 241: log likelihood = -18070.358  (not concave)
Iteration 242: log likelihood = -18070.358  (not concave)
Iteration 243: log likelihood = -18070.358  (not concave)
Iteration 244: log likelihood = -18070.358  (not concave)
Iteration 245: log likelihood = -18070.358  (not concave)
Iteration 246: log likelihood = -18070.358  (not concave)
Iteration 247: log likelihood = -18070.358  (not concave)
Iteration 248: log likelihood = -18070.358  (not concave)
Iteration 249: log likelihood = -18070.358  (not concave)
Iteration 250: log likelihood = -18070.358  (not concave)
Iteration 251: log likelihood = -18070.358  (not concave)
Iteration 252: log likelihood = -18070.358  (not concave)
Iteration 253: log likelihood = -18070.358  (not concave)
Iteration 254: log likelihood = -18070.358  (not concave)
Iteration 255: log likelihood = -18070.358  (not concave)
Iteration 256: log likelihood = -18070.358  (not concave)
Iteration 257: log likelihood = -18070.358  (not concave)
Iteration 258: log likelihood = -18070.358  (not concave)
Iteration 259: log likelihood = -18070.358  (not concave)
Iteration 260: log likelihood = -18070.358  (not concave)
Iteration 261: log likelihood = -18070.358  (not concave)
Iteration 262: log likelihood = -18070.358  (not concave)
Iteration 263: log likelihood = -18070.358  (not concave)
Iteration 264: log likelihood = -18070.358  (not concave)
Iteration 265: log likelihood = -18070.358  (not concave)
Iteration 266: log likelihood = -18070.358  (not concave)
Iteration 267: log likelihood = -18070.358  (not concave)
Iteration 268: log likelihood = -18070.358  (not concave)
Iteration 269: log likelihood = -18070.358  (not concave)
Iteration 270: log likelihood = -18070.358  (not concave)
Iteration 271: log likelihood = -18070.358  (not concave)
Iteration 272: log likelihood = -18070.358  (not concave)
Iteration 273: log likelihood = -18070.358  (not concave)
Iteration 274: log likelihood = -18070.358  (not concave)
Iteration 275: log likelihood = -18070.358  (not concave)
Iteration 276: log likelihood = -18070.358  (not concave)
Iteration 277: log likelihood = -18070.358  (not concave)
Iteration 278: log likelihood = -18070.358  (not concave)
Iteration 279: log likelihood = -18070.358  (not concave)
Iteration 280: log likelihood = -18070.358  (not concave)
Iteration 281: log likelihood = -18070.358  (not concave)
Iteration 282: log likelihood = -18070.358  (not concave)
Iteration 283: log likelihood = -18070.358  (not concave)
Iteration 284: log likelihood = -18070.358  (not concave)
Iteration 285: log likelihood = -18070.358  (not concave)
Iteration 286: log likelihood = -18070.358  (not concave)
Iteration 287: log likelihood = -18070.358  (not concave)
Iteration 288: log likelihood = -18070.358  (not concave)
Iteration 289: log likelihood = -18070.358  (not concave)
Iteration 290: log likelihood = -18070.358  (not concave)
Iteration 291: log likelihood = -18070.358  (not concave)
Iteration 292: log likelihood = -18070.358  (not concave)
Iteration 293: log likelihood = -18070.358  (not concave)
Iteration 294: log likelihood = -18070.358  (not concave)
Iteration 295: log likelihood = -18070.358  (not concave)
Iteration 296: log likelihood = -18070.358  (not concave)
Iteration 297: log likelihood = -18070.358  (not concave)
Iteration 298: log likelihood = -18070.358  (not concave)
Iteration 299: log likelihood = -18070.358  (not concave)
Iteration 300: log likelihood = -18070.358  (not concave)
convergence not achieved

Survival model                                  Number of obs     =     59,755
Log likelihood = -18070.358
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |  -.4661748   .0275377   -16.93   0.000    -.5201477   -.4122019
edad_al_in~1 |   .0649589   .0037795    17.19   0.000     .0575512    .0723666
edad_ini_c~s |   .0757888   .0071795    10.56   0.000     .0617172    .0898604
     sex_enc |   1.840372   .0410558    44.83   0.000     1.759904     1.92084
     esc_rec |  -.8171341          .        .       .            .           .
sus_prin_mod |  -.7780551          .        .       .            .           .
 fr_sus_prin |  -.1625322    .027628    -5.88   0.000    -.2166821   -.1083823
 comp_biosoc |  -.7608284          .        .       .            .           .
     ten_viv |   .0812349   .0153993     5.28   0.000     .0510529     .111417
dg_cie_10_~c |  -.1255617   .0354895    -3.54   0.000    -.1951199   -.0560035
sud_sever~10 |   .3114935   .0428679     7.27   0.000      .227474    .3955129
   macrozone |  -.8913888   .0915375    -9.74   0.000    -1.070799   -.7119786
 policonsumo |  -.2233535   .0941391    -2.37   0.018    -.4078627   -.0388443
   n_off_vio |  -1.910195     .21573    -8.85   0.000    -2.333018   -1.487372
   n_off_acq |  -4.699182          .        .       .            .           .
   n_off_sud |   -1.60925          .        .       .            .           .
        clas |  -.3429518   .0222005   -15.45   0.000    -.3864639   -.2994397
       _cons |    7.01491   .0832339    84.28   0.000     6.851775    7.178046
  log(sigma) |   .8961913    .015385    58.25   0.000     .8660372    .9263455
       kappa |   .2764748          .        .       .            .           .
------------------------------------------------------------------------------

.         //qui cap noi merlin (_time $covs if _trans == 1, family(ggamma, fail(_status)))
.         estimates store m2_1_ggam

. 
.         // Royston Parmar models
.         forvalues j=1/10 {
  2.                 di in yellow "{bf: ***********}"
  3.                 di in yellow "{bf: family RP`j'}"
  4.                 di in yellow "{bf: ***********}"
  5.                 set seed 2125
  6.                 qui cap noi stmerlin $covs_2, dist(rp) df(`j')
  7.                 //qui cap noi merlin (_time $covs if _trans == 1, family(rp, df(`j') fail(_status)))
.                 estimates store m2_1_rp`j'
  8.                 *estimates save "${pathdata2}parmodels.ster", append    
.         }       
 ***********
 family RP1
 ***********
note; a delayed entry model is being fitted
variables created: _rcs1_1 to _rcs1_1

Fitting full model:

Iteration 0:   log likelihood = -36826.906  (not concave)
Iteration 1:   log likelihood = -20926.082  
Iteration 2:   log likelihood = -20071.583  (not concave)
Iteration 3:   log likelihood = -18560.105  (not concave)
Iteration 4:   log likelihood = -18258.367  
Iteration 5:   log likelihood = -18134.596  (not concave)
Iteration 6:   log likelihood = -18131.637  
Iteration 7:   log likelihood = -18125.268  
Iteration 8:   log likelihood =  -18118.35  
Iteration 9:   log likelihood = -18110.519  
Iteration 10:  log likelihood = -18107.682  
Iteration 11:  log likelihood = -18104.471  
Iteration 12:  log likelihood =  -18102.79  
Iteration 13:  log likelihood = -18101.569  
Iteration 14:  log likelihood = -18100.502  
Iteration 15:  log likelihood = -18099.187  
Iteration 16:  log likelihood = -18098.932  
Iteration 17:  log likelihood = -18098.541  
Iteration 18:  log likelihood = -18098.088  
Iteration 19:  log likelihood = -18097.878  
Iteration 20:  log likelihood = -18097.554  
Iteration 21:  log likelihood = -18097.453  
Iteration 22:  log likelihood = -18097.291  
Iteration 23:  log likelihood = -18097.105  
Iteration 24:  log likelihood = -18096.986  
Iteration 25:  log likelihood = -18096.878  
Iteration 26:  log likelihood = -18096.798  
Iteration 27:  log likelihood = -18096.654  
Iteration 28:  log likelihood =   -18096.6  
Iteration 29:  log likelihood = -18096.532  
Iteration 30:  log likelihood = -18096.462  
Iteration 31:  log likelihood =  -18096.46  
Iteration 32:  log likelihood = -18096.391  (not concave)
Iteration 33:  log likelihood = -18096.391  
Iteration 34:  log likelihood = -18096.371  
Iteration 35:  log likelihood = -18096.338  
Iteration 36:  log likelihood = -18096.302  
Iteration 37:  log likelihood = -18096.259  
Iteration 38:  log likelihood = -18096.215  
Iteration 39:  log likelihood = -18096.204  
Iteration 40:  log likelihood = -18096.188  
Iteration 41:  log likelihood = -18096.159  
Iteration 42:  log likelihood = -18096.139  
Iteration 43:  log likelihood = -18096.131  
Iteration 44:  log likelihood = -18096.106  
Iteration 45:  log likelihood = -18096.101  
Iteration 46:  log likelihood = -18096.085  
Iteration 47:  log likelihood = -18096.063  
Iteration 48:  log likelihood = -18096.049  
Iteration 49:  log likelihood = -18096.045  
Iteration 50:  log likelihood = -18096.037  
Iteration 51:  log likelihood = -18096.027  
Iteration 52:  log likelihood = -18096.022  
Iteration 53:  log likelihood = -18096.016  
Iteration 54:  log likelihood =  -18096.01  
Iteration 55:  log likelihood = -18096.005  
Iteration 56:  log likelihood = -18095.999  
Iteration 57:  log likelihood = -18095.999  
Iteration 58:  log likelihood = -18095.993  (not concave)
Iteration 59:  log likelihood = -18095.993  
Iteration 60:  log likelihood = -18095.991  (backed up)
Iteration 61:  log likelihood = -18095.989  
Iteration 62:  log likelihood = -18095.981  
Iteration 63:  log likelihood = -18095.978  
Iteration 64:  log likelihood = -18095.975  
Iteration 65:  log likelihood =  -18095.97  
Iteration 66:  log likelihood = -18095.969  
Iteration 67:  log likelihood = -18095.965  
Iteration 68:  log likelihood = -18095.964  
Iteration 69:  log likelihood = -18095.962  
Iteration 70:  log likelihood = -18095.959  
Iteration 71:  log likelihood = -18095.958  
Iteration 72:  log likelihood = -18095.955  
Iteration 73:  log likelihood = -18095.953  (not concave)
Iteration 74:  log likelihood = -18095.953  
Iteration 75:  log likelihood = -18095.953  
Iteration 76:  log likelihood = -18095.951  (not concave)
Iteration 77:  log likelihood =  -18095.95  (not concave)
Iteration 78:  log likelihood =  -18095.95  
Iteration 79:  log likelihood =  -18095.95  
Iteration 80:  log likelihood = -18095.947  
Iteration 81:  log likelihood = -18095.947  
Iteration 82:  log likelihood = -18095.946  
Iteration 83:  log likelihood = -18095.945  
Iteration 84:  log likelihood = -18095.944  
Iteration 85:  log likelihood = -18095.942  
Iteration 86:  log likelihood = -18095.941  
Iteration 87:  log likelihood =  -18095.94  
Iteration 88:  log likelihood =  -18095.94  
Iteration 89:  log likelihood = -18095.938  (not concave)
Iteration 90:  log likelihood = -18095.938  
Iteration 91:  log likelihood = -18095.938  
Iteration 92:  log likelihood = -18095.937  (not concave)
Iteration 93:  log likelihood = -18095.937  (backed up)
Iteration 94:  log likelihood = -18095.936  
Iteration 95:  log likelihood = -18095.935  (not concave)
Iteration 96:  log likelihood = -18095.935  
Iteration 97:  log likelihood = -18095.935  (backed up)
Iteration 98:  log likelihood = -18095.934  
Iteration 99:  log likelihood = -18095.933  
Iteration 100: log likelihood = -18095.932  
Iteration 101: log likelihood = -18095.932  
Iteration 102: log likelihood = -18095.931  
Iteration 103: log likelihood = -18095.931  
Iteration 104: log likelihood =  -18095.93  
Iteration 105: log likelihood =  -18095.93  
Iteration 106: log likelihood = -18095.929  (not concave)
Iteration 107: log likelihood = -18095.929  
Iteration 108: log likelihood = -18095.928  
Iteration 109: log likelihood = -18095.928  
Iteration 110: log likelihood = -18095.928  
Iteration 111: log likelihood = -18095.927  
Iteration 112: log likelihood = -18095.927  
Iteration 113: log likelihood = -18095.926  
Iteration 114: log likelihood = -18095.926  
Iteration 115: log likelihood = -18095.926  (not concave)
Iteration 116: log likelihood = -18095.926  
Iteration 117: log likelihood = -18095.925  
Iteration 118: log likelihood = -18095.925  
Iteration 119: log likelihood = -18095.925  
Iteration 120: log likelihood = -18095.925  
Iteration 121: log likelihood = -18095.924  (not concave)
Iteration 122: log likelihood = -18095.924  (backed up)
Iteration 123: log likelihood = -18095.924  
Iteration 124: log likelihood = -18095.924  
Iteration 125: log likelihood = -18095.923  
Iteration 126: log likelihood = -18095.923  
Iteration 127: log likelihood = -18095.923  
Iteration 128: log likelihood = -18095.923  
Iteration 129: log likelihood = -18095.922  
Iteration 130: log likelihood = -18095.922  
Iteration 131: log likelihood = -18095.922  
Iteration 132: log likelihood = -18095.922  
Iteration 133: log likelihood = -18095.921  
Iteration 134: log likelihood = -18095.921  
Iteration 135: log likelihood = -18095.921  
Iteration 136: log likelihood = -18095.921  
Iteration 137: log likelihood =  -18095.92  (not concave)
Iteration 138: log likelihood =  -18095.92  
Iteration 139: log likelihood =  -18095.92  
Iteration 140: log likelihood =  -18095.92  
Iteration 141: log likelihood =  -18095.92  
Iteration 142: log likelihood =  -18095.92  
Iteration 143: log likelihood =  -18095.92  
Iteration 144: log likelihood = -18095.919  
Iteration 145: log likelihood = -18095.919  
Iteration 146: log likelihood = -18095.919  
Iteration 147: log likelihood = -18095.919  
Iteration 148: log likelihood = -18095.919  
Iteration 149: log likelihood = -18095.919  
Iteration 150: log likelihood = -18095.919  
Iteration 151: log likelihood = -18095.918  
Iteration 152: log likelihood = -18095.918  
Iteration 153: log likelihood = -18095.918  
Iteration 154: log likelihood = -18095.918  
Iteration 155: log likelihood = -18095.918  
Iteration 156: log likelihood = -18095.918  
Iteration 157: log likelihood = -18095.918  
Iteration 158: log likelihood = -18095.918  
Iteration 159: log likelihood = -18095.918  
Iteration 160: log likelihood = -18095.917  
Iteration 161: log likelihood = -18095.917  
Iteration 162: log likelihood = -18095.917  
Iteration 163: log likelihood = -18095.917  
Iteration 164: log likelihood = -18095.917  
Iteration 165: log likelihood = -18095.917  
Iteration 166: log likelihood = -18095.917  (not concave)
Iteration 167: log likelihood = -18095.917  (backed up)
Iteration 168: log likelihood = -18095.917  
Iteration 169: log likelihood = -18095.917  
Iteration 170: log likelihood = -18095.917  
Iteration 171: log likelihood = -18095.916  
Iteration 172: log likelihood = -18095.916  
Iteration 173: log likelihood = -18095.916  
Iteration 174: log likelihood = -18095.916  
Iteration 175: log likelihood = -18095.916  
Iteration 176: log likelihood = -18095.916  
Iteration 177: log likelihood = -18095.916  
Iteration 178: log likelihood = -18095.916  
Iteration 179: log likelihood = -18095.916  
Iteration 180: log likelihood = -18095.916  
Iteration 181: log likelihood = -18095.916  
Iteration 182: log likelihood = -18095.916  
Iteration 183: log likelihood = -18095.916  
Iteration 184: log likelihood = -18095.916  
Iteration 185: log likelihood = -18095.916  
Iteration 186: log likelihood = -18095.916  
Iteration 187: log likelihood = -18095.916  (not concave)
Iteration 188: log likelihood = -18095.916  
Iteration 189: log likelihood = -18095.916  
Iteration 190: log likelihood = -18095.916  
Iteration 191: log likelihood = -18095.915  
Iteration 192: log likelihood = -18095.915  
Iteration 193: log likelihood = -18095.915  
Iteration 194: log likelihood = -18095.915  
Iteration 195: log likelihood = -18095.915  
Iteration 196: log likelihood = -18095.915  
Iteration 197: log likelihood = -18095.915  
Iteration 198: log likelihood = -18095.915  
Iteration 199: log likelihood = -18095.915  
Iteration 200: log likelihood = -18095.915  
Iteration 201: log likelihood = -18095.915  
Iteration 202: log likelihood = -18095.915  
Iteration 203: log likelihood = -18095.915  
Iteration 204: log likelihood = -18095.915  
Iteration 205: log likelihood = -18095.915  
Iteration 206: log likelihood = -18095.915  (not concave)
Iteration 207: log likelihood = -18095.915  
Iteration 208: log likelihood = -18095.915  
Iteration 209: log likelihood = -18095.915  
Iteration 210: log likelihood = -18095.915  
Iteration 211: log likelihood = -18095.915  
Iteration 212: log likelihood = -18095.915  
Iteration 213: log likelihood = -18095.915  (not concave)
Iteration 214: log likelihood = -18095.915  (backed up)
Iteration 215: log likelihood = -18095.915  
Iteration 216: log likelihood = -18095.915  
Iteration 217: log likelihood = -18095.915  
Iteration 218: log likelihood = -18095.915  
Iteration 219: log likelihood = -18095.915  
Iteration 220: log likelihood = -18095.915  
Iteration 221: log likelihood = -18095.915  (not concave)
Iteration 222: log likelihood = -18095.915  (backed up)
Iteration 223: log likelihood = -18095.914  
Iteration 224: log likelihood = -18095.914  
Iteration 225: log likelihood = -18095.914  
Iteration 226: log likelihood = -18095.914  
Iteration 227: log likelihood = -18095.914  (not concave)
Iteration 228: log likelihood = -18095.914  (backed up)
Iteration 229: log likelihood = -18095.914  
Iteration 230: log likelihood = -18095.914  
Iteration 231: log likelihood = -18095.914  
Iteration 232: log likelihood = -18095.914  
Iteration 233: log likelihood = -18095.914  
Iteration 234: log likelihood = -18095.914  
Iteration 235: log likelihood = -18095.914  
Iteration 236: log likelihood = -18095.914  
Iteration 237: log likelihood = -18095.914  (not concave)
Iteration 238: log likelihood = -18095.914  (backed up)
Iteration 239: log likelihood = -18095.914  (backed up)
Iteration 240: log likelihood = -18095.914  
Iteration 241: log likelihood = -18095.914  
Iteration 242: log likelihood = -18095.914  (not concave)
Iteration 243: log likelihood = -18095.914  
Iteration 244: log likelihood = -18095.914  
Iteration 245: log likelihood = -18095.914  
Iteration 246: log likelihood = -18095.914  
Iteration 247: log likelihood = -18095.914  
Iteration 248: log likelihood = -18095.914  
Iteration 249: log likelihood = -18095.914  
Iteration 250: log likelihood = -18095.914  
Iteration 251: log likelihood = -18095.914  
Iteration 252: log likelihood = -18095.914  
Iteration 253: log likelihood = -18095.914  
Iteration 254: log likelihood = -18095.914  (not concave)
Iteration 255: log likelihood = -18095.914  (not concave)
Iteration 256: log likelihood = -18095.914  (not concave)
Iteration 257: log likelihood = -18095.914  (not concave)
Iteration 258: log likelihood = -18095.914  (not concave)
Iteration 259: log likelihood = -18095.914  (not concave)
Iteration 260: log likelihood = -18095.914  (not concave)
Iteration 261: log likelihood = -18095.914  (not concave)
Iteration 262: log likelihood = -18095.914  (not concave)
Iteration 263: log likelihood = -18095.914  (not concave)
Iteration 264: log likelihood = -18095.914  (not concave)
Iteration 265: log likelihood = -18095.914  (not concave)
Iteration 266: log likelihood = -18095.914  (not concave)
Iteration 267: log likelihood = -18095.914  (not concave)
Iteration 268: log likelihood = -18095.914  (not concave)
Iteration 269: log likelihood = -18095.914  (not concave)
Iteration 270: log likelihood = -18095.914  (not concave)
Iteration 271: log likelihood = -18095.914  (not concave)
Iteration 272: log likelihood = -18095.914  (not concave)
Iteration 273: log likelihood = -18095.914  (not concave)
Iteration 274: log likelihood = -18095.914  (not concave)
Iteration 275: log likelihood = -18095.914  (not concave)
Iteration 276: log likelihood = -18095.914  (not concave)
Iteration 277: log likelihood = -18095.914  (not concave)
Iteration 278: log likelihood = -18095.914  (not concave)
Iteration 279: log likelihood = -18095.914  (not concave)
Iteration 280: log likelihood = -18095.914  (not concave)
Iteration 281: log likelihood = -18095.914  (not concave)
Iteration 282: log likelihood = -18095.914  (not concave)
Iteration 283: log likelihood = -18095.914  (not concave)
Iteration 284: log likelihood = -18095.914  (not concave)
Iteration 285: log likelihood = -18095.914  (not concave)
Iteration 286: log likelihood = -18095.914  (not concave)
Iteration 287: log likelihood = -18095.914  (not concave)
Iteration 288: log likelihood = -18095.914  (not concave)
Iteration 289: log likelihood = -18095.914  (not concave)
Iteration 290: log likelihood = -18095.914  (not concave)
Iteration 291: log likelihood = -18095.914  (not concave)
Iteration 292: log likelihood = -18095.914  (not concave)
Iteration 293: log likelihood = -18095.914  (not concave)
Iteration 294: log likelihood = -18095.914  (not concave)
Iteration 295: log likelihood = -18095.914  (not concave)
Iteration 296: log likelihood = -18095.914  (not concave)
Iteration 297: log likelihood = -18095.914  (not concave)
Iteration 298: log likelihood = -18095.914  (not concave)
Iteration 299: log likelihood = -18095.914  (not concave)
Iteration 300: log likelihood = -18095.914  (not concave)
convergence not achieved

Survival model                                  Number of obs     =     59,755
Log likelihood = -18095.914
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |   .1317145   .0214172     6.15   0.000     .0897376    .1736914
edad_al_in~1 |  -.0088567   .0020611    -4.30   0.000    -.0128963    -.004817
edad_ini_c~s |  -.0255291   .0046396    -5.50   0.000    -.0346225   -.0164357
     sex_enc |  -.5067487   .0441787   -11.47   0.000    -.5933373   -.4201602
     esc_rec |   .2307575   .0263563     8.76   0.000     .1791001     .282415
sus_prin_mod |   .2169922   .0180855    12.00   0.000     .1815453    .2524391
 fr_sus_prin |   .0340977   .0166141     2.05   0.040     .0015347    .0666608
 comp_biosoc |   .2192767   .0301565     7.27   0.000      .160171    .2783823
     ten_viv |  -.0185402   .0156645    -1.18   0.237     -.049242    .0121617
dg_cie_10_~c |   .0397734   .0185806     2.14   0.032     .0033561    .0761907
sud_sever~10 |  -.1076052   .0422698    -2.55   0.011    -.1904525   -.0247579
   macrozone |   .2385104   .0243283     9.80   0.000     .1908278     .286193
 policonsumo |   .0820477   .0485855     1.69   0.091    -.0131781    .1772734
   n_off_vio |   .4172096   .0364885    11.43   0.000     .3456935    .4887257
   n_off_acq |    1.11977     .03362    33.31   0.000     1.053876    1.185664
   n_off_sud |   .3490232   .0357808     9.75   0.000     .2788941    .4191522
        clas |   .1076979   .0286254     3.76   0.000     .0515932    .1638025
       _cons |    8.24193          .        .       .            .           .
------------------------------------------------------------------------------
    Warning: Baseline spline coefficients not shown - use ml display
 ***********
 family RP2
 ***********
note; a delayed entry model is being fitted
Obtaining initial values
convergence not achieved
variables created: _rcs1_1 to _rcs1_2

Fitting full model:

Iteration 0:   log likelihood = -18095.914  (not concave)
Iteration 1:   log likelihood = -18092.365  (not concave)
Iteration 2:   log likelihood = -18090.171  (not concave)
Iteration 3:   log likelihood = -18088.781  (not concave)
Iteration 4:   log likelihood = -18087.762  (not concave)
Iteration 5:   log likelihood = -18086.967  (not concave)
Iteration 6:   log likelihood = -18086.209  (not concave)
Iteration 7:   log likelihood = -18084.966  (not concave)
Iteration 8:   log likelihood = -18083.807  (not concave)
Iteration 9:   log likelihood = -18055.047  (not concave)
Iteration 10:  log likelihood = -18050.087  (not concave)
Iteration 11:  log likelihood = -18048.413  (not concave)
Iteration 12:  log likelihood =  -18046.74  (not concave)
Iteration 13:  log likelihood =  -18035.78  (not concave)
Iteration 14:  log likelihood = -18024.735  (not concave)
Iteration 15:  log likelihood = -18022.121  (not concave)
Iteration 16:  log likelihood = -18019.624  (not concave)
Iteration 17:  log likelihood = -18017.404  (not concave)
Iteration 18:  log likelihood =   -18015.1  (not concave)
Iteration 19:  log likelihood = -18012.832  
Iteration 20:  log likelihood = -18000.843  (backed up)
Iteration 21:  log likelihood = -17987.168  
Iteration 22:  log likelihood = -17968.873  (not concave)
Iteration 23:  log likelihood = -17968.819  
Iteration 24:  log likelihood = -17968.799  (not concave)
Iteration 25:  log likelihood = -17968.799  (backed up)

Survival model                                  Number of obs     =     59,755
Log likelihood = -17968.799
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |   .1295081   .0215156     6.02   0.000     .0873383    .1716779
edad_al_in~1 |   .0565853   .0021893    25.85   0.000     .0522942    .0608763
edad_ini_c~s |  -.0249519   .0046793    -5.33   0.000    -.0341231   -.0157806
     sex_enc |  -.5033819   .0441584   -11.40   0.000    -.5899307    -.416833
     esc_rec |   .2457802   .0263576     9.32   0.000     .1941202    .2974402
sus_prin_mod |   .2217259   .0181735    12.20   0.000     .1861065    .2573454
 fr_sus_prin |   .0341394   .0166014     2.06   0.040     .0016012    .0666775
 comp_biosoc |   .2227039   .0301768     7.38   0.000     .1635584    .2818493
     ten_viv |   -.023784   .0156454    -1.52   0.128    -.0544484    .0068804
dg_cie_10_~c |   .0400168   .0186269     2.15   0.032     .0035087    .0765249
sud_sever~10 |  -.1032074    .042273    -2.44   0.015    -.1860609    -.020354
   macrozone |    .240902   .0243289     9.90   0.000     .1932181    .2885859
 policonsumo |   .0855065   .0484852     1.76   0.078    -.0095227    .1805356
   n_off_vio |   .4002926   .0364487    10.98   0.000     .3288545    .4717307
   n_off_acq |   1.095175   .0335546    32.64   0.000     1.029409    1.160941
   n_off_sud |   .3243698   .0357509     9.07   0.000     .2542994    .3944402
        clas |   .1132079   .0286261     3.95   0.000     .0571017    .1693141
       _cons |   6.441748   6.736474     0.96   0.339    -6.761498    19.64499
------------------------------------------------------------------------------
    Warning: Baseline spline coefficients not shown - use ml display
 ***********
 family RP3
 ***********
note; a delayed entry model is being fitted
Obtaining initial values
convergence not achieved
variables created: _rcs1_1 to _rcs1_3

Fitting full model:

Iteration 0:   log likelihood = -18095.914  (not concave)
Iteration 1:   log likelihood = -18074.139  (not concave)
Iteration 2:   log likelihood = -18073.514  (not concave)
Iteration 3:   log likelihood = -18064.603  (not concave)
Iteration 4:   log likelihood = -18046.931  (not concave)
Iteration 5:   log likelihood = -18040.883  
Iteration 6:   log likelihood = -18015.985  
Iteration 7:   log likelihood = -17999.501  
Iteration 8:   log likelihood = -17984.855  
Iteration 9:   log likelihood = -17969.168  
Iteration 10:  log likelihood = -17969.102  
Iteration 11:  log likelihood =   -17969.1  
Iteration 12:  log likelihood =   -17969.1  (not concave)
Iteration 13:  log likelihood =   -17969.1  (backed up)
Iteration 14:  log likelihood =   -17969.1  

Survival model                                  Number of obs     =     59,755
Log likelihood =   -17969.1
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |   .1293093    .021518     6.01   0.000     .0871348    .1714838
edad_al_in~1 |   .0548853   .0032915    16.67   0.000     .0484341    .0613365
edad_ini_c~s |  -.0249922   .0046838    -5.34   0.000    -.0341722   -.0158122
     sex_enc |   -.503372    .044158   -11.40   0.000    -.5899201    -.416824
     esc_rec |    .246615   .0264639     9.32   0.000     .1947468    .2984832
sus_prin_mod |   .2213331   .0181806    12.17   0.000     .1856997    .2569664
 fr_sus_prin |   .0342162    .016605     2.06   0.039      .001671    .0667614
 comp_biosoc |   .2223621   .0301815     7.37   0.000     .1632075    .2815166
     ten_viv |   -.023951   .0156552    -1.53   0.126    -.0546346    .0067327
dg_cie_10_~c |    .039956    .018626     2.15   0.032     .0034496    .0764623
sud_sever~10 |  -.1031572   .0422808    -2.44   0.015    -.1860261   -.0202883
   macrozone |    .241375   .0243457     9.91   0.000     .1936584    .2890917
 policonsumo |   .0838793   .0485609     1.73   0.084    -.0112984     .179057
   n_off_vio |   .4009949   .0364806    10.99   0.000     .3294943    .4724955
   n_off_acq |   1.096215    .033599    32.63   0.000     1.030362    1.162068
   n_off_sud |   .3248655   .0357493     9.09   0.000     .2547982    .3949329
        clas |   .1129821   .0286267     3.95   0.000     .0568749    .1690894
       _cons |   6.367222   3.065058     2.08   0.038      .359819    12.37463
------------------------------------------------------------------------------
    Warning: Baseline spline coefficients not shown - use ml display
 ***********
 family RP4
 ***********
note; a delayed entry model is being fitted
Obtaining initial values
convergence not achieved
variables created: _rcs1_1 to _rcs1_4

Fitting full model:

Iteration 0:   log likelihood = -18095.914  (not concave)
Iteration 1:   log likelihood = -18074.796  (not concave)
Iteration 2:   log likelihood = -18066.769  (not concave)
Iteration 3:   log likelihood = -18063.016  (not concave)
Iteration 4:   log likelihood = -18057.792  (not concave)
Iteration 5:   log likelihood = -18052.926  (not concave)
Iteration 6:   log likelihood =  -18026.35  (not concave)
Iteration 7:   log likelihood = -18023.363  (not concave)
Iteration 8:   log likelihood =  -18021.04  (not concave)
Iteration 9:   log likelihood = -18019.121  (not concave)
Iteration 10:  log likelihood = -18017.405  (not concave)
Iteration 11:  log likelihood = -18015.826  (not concave)
Iteration 12:  log likelihood =  -18014.38  
Iteration 13:  log likelihood = -17999.046  
Iteration 14:  log likelihood = -17975.684  
Iteration 15:  log likelihood = -17967.863  
Iteration 16:  log likelihood = -17967.827  (not concave)
Iteration 17:  log likelihood = -17967.827  (not concave)
Iteration 18:  log likelihood = -17967.827  
Iteration 19:  log likelihood = -17967.827  
Iteration 20:  log likelihood = -17967.827  

Survival model                                  Number of obs     =     59,755
Log likelihood = -17967.827
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |   .1293869   .0215235     6.01   0.000     .0872016    .1715722
edad_al_in~1 |   .0591395    .003936    15.03   0.000     .0514251    .0668539
edad_ini_c~s |  -.0249051   .0046781    -5.32   0.000    -.0340741   -.0157361
     sex_enc |  -.5036204   .0441584   -11.40   0.000    -.5901694   -.4170714
     esc_rec |   .2469256   .0264774     9.33   0.000     .1950307    .2988204
sus_prin_mod |   .2225338    .018195    12.23   0.000     .1868724    .2581953
 fr_sus_prin |   .0344952   .0166054     2.08   0.038     .0019491    .0670412
 comp_biosoc |    .223171   .0301834     7.39   0.000     .1640126    .2823293
     ten_viv |   -.024188   .0156573    -1.54   0.122    -.0548757    .0064996
dg_cie_10_~c |   .0403025    .018629     2.16   0.031     .0037903    .0768147
sud_sever~10 |  -.1018293   .0422926    -2.41   0.016    -.1847213   -.0189373
   macrozone |   .2407212   .0243446     9.89   0.000     .1930067    .2884357
 policonsumo |   .0867405   .0485998     1.78   0.074    -.0085134    .1819944
   n_off_vio |   .4001823   .0364789    10.97   0.000      .328685    .4716796
   n_off_acq |   1.094255   .0336102    32.56   0.000     1.028381     1.16013
   n_off_sud |   .3221694   .0357883     9.00   0.000     .2520255    .3923133
        clas |   .1139249   .0286321     3.98   0.000      .057807    .1700428
       _cons |   6.425347   9.106904     0.71   0.480    -11.42386    24.27455
------------------------------------------------------------------------------
    Warning: Baseline spline coefficients not shown - use ml display
 ***********
 family RP5
 ***********
note; a delayed entry model is being fitted
Obtaining initial values
convergence not achieved
variables created: _rcs1_1 to _rcs1_5

Fitting full model:

Iteration 0:   log likelihood = -18095.914  (not concave)
Iteration 1:   log likelihood = -18076.917  (not concave)
Iteration 2:   log likelihood = -18068.763  (not concave)
Iteration 3:   log likelihood = -18063.122  (not concave)
Iteration 4:   log likelihood = -18059.484  (not concave)
Iteration 5:   log likelihood = -18056.221  (not concave)
Iteration 6:   log likelihood = -18053.362  
Iteration 7:   log likelihood =  -18026.92  
Iteration 8:   log likelihood =  -17968.46  
Iteration 9:   log likelihood = -17963.272  
Iteration 10:  log likelihood = -17958.553  (not concave)
Iteration 11:  log likelihood = -17958.543  
Iteration 12:  log likelihood = -17958.535  
Iteration 13:  log likelihood = -17958.535  
Iteration 14:  log likelihood = -17958.535  
Iteration 15:  log likelihood = -17958.535  (backed up)

Survival model                                  Number of obs     =     59,755
Log likelihood = -17958.535
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |    .130385   .0215472     6.05   0.000     .0881533    .1726166
edad_al_in~1 |    .067934    .004441    15.30   0.000     .0592299    .0766381
edad_ini_c~s |  -.0244857   .0046722    -5.24   0.000    -.0336431   -.0153283
     sex_enc |  -.5046427   .0441558   -11.43   0.000    -.5911865   -.4180989
     esc_rec |   .2478366   .0265025     9.35   0.000     .1958927    .2997804
sus_prin_mod |   .2221272   .0182108    12.20   0.000     .1864346    .2578198
 fr_sus_prin |   .0340353   .0166042     2.05   0.040     .0014917     .066579
 comp_biosoc |   .2239229   .0301858     7.42   0.000     .1647598     .283086
     ten_viv |  -.0246237   .0156644    -1.57   0.116    -.0553253     .006078
dg_cie_10_~c |   .0408693   .0186353     2.19   0.028     .0043448    .0773937
sud_sever~10 |  -.1008462    .042297    -2.38   0.017    -.1837469   -.0179456
   macrozone |   .2400879   .0243471     9.86   0.000     .1923684    .2878074
 policonsumo |   .0909305     .04865     1.87   0.062    -.0044218    .1862827
   n_off_vio |   .3977987   .0364858    10.90   0.000     .3262878    .4693097
   n_off_acq |   1.092395   .0336199    32.49   0.000     1.026501    1.158289
   n_off_sud |   .3205464   .0357928     8.96   0.000     .2503937     .390699
        clas |   .1140363   .0286294     3.98   0.000     .0579236     .170149
       _cons |   6.093842   4.012833     1.52   0.129    -1.771166    13.95885
------------------------------------------------------------------------------
    Warning: Baseline spline coefficients not shown - use ml display
 ***********
 family RP6
 ***********
note; a delayed entry model is being fitted
Obtaining initial values
convergence not achieved
variables created: _rcs1_1 to _rcs1_6

Fitting full model:

Iteration 0:   log likelihood = -18095.914  (not concave)
Iteration 1:   log likelihood =  -18095.59  (not concave)
Iteration 2:   log likelihood = -18064.536  (not concave)
Iteration 3:   log likelihood = -18057.636  (not concave)
Iteration 4:   log likelihood = -18054.561  
Iteration 5:   log likelihood = -18029.343  
Iteration 6:   log likelihood = -18005.374  
Iteration 7:   log likelihood = -17982.951  
Iteration 8:   log likelihood = -17955.382  
Iteration 9:   log likelihood =  -17955.12  
Iteration 10:  log likelihood = -17955.093  
Iteration 11:  log likelihood = -17954.383  (not concave)
Iteration 12:  log likelihood = -17954.168  
Iteration 13:  log likelihood = -17954.119  
Iteration 14:  log likelihood = -17954.118  
Iteration 15:  log likelihood = -17954.118  
Iteration 16:  log likelihood = -17954.118  (backed up)

Survival model                                  Number of obs     =     59,755
Log likelihood = -17954.118
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |   .1303047   .0215589     6.04   0.000       .08805    .1725594
edad_al_in~1 |   .0737065   .0048142    15.31   0.000     .0642708    .0831422
edad_ini_c~s |  -.0243688   .0046722    -5.22   0.000    -.0335262   -.0152115
     sex_enc |  -.5041012   .0441559   -11.42   0.000    -.5906452   -.4175573
     esc_rec |   .2487896   .0265044     9.39   0.000      .196842    .3007373
sus_prin_mod |   .2220002   .0182211    12.18   0.000     .1862874     .257713
 fr_sus_prin |   .0337664   .0166054     2.03   0.042     .0012204    .0663123
 comp_biosoc |   .2248986   .0301961     7.45   0.000     .1657152    .2840819
     ten_viv |  -.0250568   .0156652    -1.60   0.110    -.0557601    .0056465
dg_cie_10_~c |   .0408707   .0186383     2.19   0.028     .0043403    .0774012
sud_sever~10 |  -.1001643   .0422988    -2.37   0.018    -.1830685   -.0172602
   macrozone |   .2404059   .0243445     9.88   0.000     .1926916    .2881202
 policonsumo |   .0929098   .0486768     1.91   0.056    -.0024949    .1883146
   n_off_vio |   .3958711   .0364895    10.85   0.000      .324353    .4673891
   n_off_acq |   1.090382   .0336267    32.43   0.000     1.024475    1.156289
   n_off_sud |   .3179083   .0358087     8.88   0.000     .2477245    .3880921
        clas |    .114424   .0286268     4.00   0.000     .0583166    .1705315
       _cons |   5.828352   4.198461     1.39   0.165     -2.40048    14.05718
------------------------------------------------------------------------------
    Warning: Baseline spline coefficients not shown - use ml display
 ***********
 family RP7
 ***********
note; a delayed entry model is being fitted
Obtaining initial values
convergence not achieved
variables created: _rcs1_1 to _rcs1_7

Fitting full model:

Iteration 0:   log likelihood = -18095.914  (not concave)
Iteration 1:   log likelihood = -18075.863  (not concave)
Iteration 2:   log likelihood = -18074.131  (not concave)
Iteration 3:   log likelihood = -18065.215  (not concave)
Iteration 4:   log likelihood = -18061.798  (not concave)
Iteration 5:   log likelihood = -18058.737  (not concave)
Iteration 6:   log likelihood = -18055.853  (not concave)
Iteration 7:   log likelihood = -18053.364  (not concave)
Iteration 8:   log likelihood = -18051.265  
Iteration 9:   log likelihood = -18027.158  (backed up)
Iteration 10:  log likelihood = -18005.933  
Iteration 11:  log likelihood = -17991.984  
Iteration 12:  log likelihood = -17974.566  
Iteration 13:  log likelihood = -17952.283  
Iteration 14:  log likelihood = -17951.276  (not concave)
Iteration 15:  log likelihood = -17950.379  (not concave)
Iteration 16:  log likelihood =  -17950.37  
Iteration 17:  log likelihood = -17950.365  
Iteration 18:  log likelihood = -17950.365  

Survival model                                  Number of obs     =     59,755
Log likelihood = -17950.365
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |   .1302706   .0215693     6.04   0.000     .0879955    .1725457
edad_al_in~1 |   .0790367   .0052145    15.16   0.000     .0688165    .0892569
edad_ini_c~s |  -.0243046   .0046723    -5.20   0.000    -.0334622    -.015147
     sex_enc |  -.5038985   .0441556   -11.41   0.000    -.5904418   -.4173552
     esc_rec |   .2494012   .0265044     9.41   0.000     .1974534    .3013489
sus_prin_mod |   .2220058   .0182286    12.18   0.000     .1862784    .2577333
 fr_sus_prin |   .0335933   .0166051     2.02   0.043     .0010479    .0661387
 comp_biosoc |   .2254081   .0302034     7.46   0.000     .1662106    .2846056
     ten_viv |  -.0254157    .015667    -1.62   0.105    -.0561225    .0052911
dg_cie_10_~c |   .0408734   .0186421     2.19   0.028     .0043356    .0774112
sud_sever~10 |  -.0997524      .0423    -2.36   0.018    -.1826588   -.0168459
   macrozone |   .2404287    .024342     9.88   0.000     .1927193    .2881382
 policonsumo |   .0951073   .0487023     1.95   0.051    -.0003476    .1905621
   n_off_vio |   .3945109   .0364912    10.81   0.000     .3229895    .4660324
   n_off_acq |   1.088588   .0336344    32.37   0.000     1.022666     1.15451
   n_off_sud |   .3162357   .0358146     8.83   0.000     .2460404    .3864311
        clas |   .1148571   .0286259     4.01   0.000     .0587513    .1709628
       _cons |    5.59626   4.229343     1.32   0.186    -2.693099    13.88562
------------------------------------------------------------------------------
    Warning: Baseline spline coefficients not shown - use ml display
 ***********
 family RP8
 ***********
note; a delayed entry model is being fitted
Obtaining initial values
convergence not achieved
variables created: _rcs1_1 to _rcs1_8

Fitting full model:

Iteration 0:   log likelihood = -18095.914  (not concave)
Iteration 1:   log likelihood = -18075.903  (not concave)
Iteration 2:   log likelihood = -18073.002  (not concave)
Iteration 3:   log likelihood =  -18064.75  (not concave)
Iteration 4:   log likelihood = -18061.202  (not concave)
Iteration 5:   log likelihood = -18058.174  (not concave)
Iteration 6:   log likelihood = -18055.698  (not concave)
Iteration 7:   log likelihood = -18053.594  (not concave)
Iteration 8:   log likelihood = -18051.633  (not concave)
Iteration 9:   log likelihood =  -18049.82  (not concave)
Iteration 10:  log likelihood = -18048.034  
Iteration 11:  log likelihood =  -18029.74  (backed up)
Iteration 12:  log likelihood = -18002.175  
Iteration 13:  log likelihood = -17980.049  
Iteration 14:  log likelihood = -17952.719  
Iteration 15:  log likelihood = -17948.754  
Iteration 16:  log likelihood = -17947.608  (not concave)
Iteration 17:  log likelihood = -17947.608  (backed up)
Iteration 18:  log likelihood = -17947.606  
Iteration 19:  log likelihood = -17947.606  
Iteration 20:  log likelihood = -17947.606  (backed up)

Survival model                                  Number of obs     =     59,755
Log likelihood = -17947.606
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |   .1301788   .0215768     6.03   0.000      .087889    .1724686
edad_al_in~1 |   .0830698   .0054628    15.21   0.000     .0723629    .0937768
edad_ini_c~s |  -.0242941   .0046734    -5.20   0.000    -.0334538   -.0151344
     sex_enc |  -.5037363    .044155   -11.41   0.000    -.5902785   -.4171941
     esc_rec |   .2498123    .026502     9.43   0.000     .1978694    .3017553
sus_prin_mod |   .2220603   .0182335    12.18   0.000     .1863232    .2577974
 fr_sus_prin |   .0334862   .0166045     2.02   0.044      .000942    .0660304
 comp_biosoc |   .2256518   .0302087     7.47   0.000     .1664438    .2848598
     ten_viv |  -.0256728   .0156682    -1.64   0.101    -.0563818    .0050363
dg_cie_10_~c |   .0408292    .018645     2.19   0.029     .0042858    .0773727
sud_sever~10 |  -.0995895   .0423001    -2.35   0.019    -.1824962   -.0166827
   macrozone |   .2404606     .02434     9.88   0.000      .192755    .2881662
 policonsumo |   .0967127   .0487168     1.99   0.047     .0012295    .1921959
   n_off_vio |   .3936155   .0364913    10.79   0.000     .3220938    .4651372
   n_off_acq |   1.087179   .0336376    32.32   0.000     1.021251    1.153107
   n_off_sud |   .3151569   .0358168     8.80   0.000     .2449573    .3853565
        clas |   .1152424   .0286262     4.03   0.000     .0591361    .1713487
       _cons |   5.519335   5.128446     1.08   0.282    -4.532234     15.5709
------------------------------------------------------------------------------
    Warning: Baseline spline coefficients not shown - use ml display
 ***********
 family RP9
 ***********
note; a delayed entry model is being fitted
Obtaining initial values
convergence not achieved
variables created: _rcs1_1 to _rcs1_9

Fitting full model:

Iteration 0:   log likelihood = -18095.914  (not concave)
Iteration 1:   log likelihood = -18077.788  (not concave)
Iteration 2:   log likelihood = -18072.064  (not concave)
Iteration 3:   log likelihood =   -18066.8  (not concave)
Iteration 4:   log likelihood = -18054.402  
Iteration 5:   log likelihood = -18029.006  (backed up)
Iteration 6:   log likelihood = -18003.959  
Iteration 7:   log likelihood = -17990.111  
Iteration 8:   log likelihood = -17971.554  
Iteration 9:   log likelihood = -17947.291  
Iteration 10:  log likelihood = -17944.351  (not concave)
Iteration 11:  log likelihood = -17942.987  
Iteration 12:  log likelihood = -17942.948  
Iteration 13:  log likelihood = -17942.947  

Survival model                                  Number of obs     =     59,755
Log likelihood = -17942.947
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |   .1301544   .0215869     6.03   0.000     .0878449    .1724639
edad_al_in~1 |   .0884168   .0057526    15.37   0.000     .0771419    .0996918
edad_ini_c~s |  -.0242875   .0046749    -5.20   0.000    -.0334503   -.0151248
     sex_enc |   -.503899   .0441533   -11.41   0.000    -.5904379   -.4173601
     esc_rec |   .2504213   .0264998     9.45   0.000     .1984827    .3023599
sus_prin_mod |   .2222191   .0182405    12.18   0.000     .1864683    .2579699
 fr_sus_prin |   .0332895   .0166039     2.00   0.045     .0007465    .0658325
 comp_biosoc |   .2258205   .0302111     7.47   0.000     .1666078    .2850332
     ten_viv |  -.0259655   .0156693    -1.66   0.098    -.0566768    .0047458
dg_cie_10_~c |   .0409165   .0186501     2.19   0.028      .004363    .0774701
sud_sever~10 |  -.0992754   .0423008    -2.35   0.019    -.1821834   -.0163675
   macrozone |   .2404345   .0243383     9.88   0.000     .1927323    .2881366
 policonsumo |    .098719   .0487332     2.03   0.043     .0032037    .1942342
   n_off_vio |   .3923337   .0364934    10.75   0.000      .320808    .4638593
   n_off_acq |   1.085533   .0336423    32.27   0.000     1.019596    1.151471
   n_off_sud |   .3140495    .035819     8.77   0.000     .2438456    .3842535
        clas |   .1157444    .028627     4.04   0.000     .0596365    .1718523
       _cons |   5.260914   2.724022     1.93   0.053    -.0780721     10.5999
------------------------------------------------------------------------------
    Warning: Baseline spline coefficients not shown - use ml display
 ***********
 family RP10
 ***********
note; a delayed entry model is being fitted
Obtaining initial values
convergence not achieved
variables created: _rcs1_1 to _rcs1_10

Fitting full model:

Iteration 0:   log likelihood = -18095.914  (not concave)
Iteration 1:   log likelihood = -18083.341  (not concave)
Iteration 2:   log likelihood = -18079.095  (not concave)
Iteration 3:   log likelihood = -18067.784  (not concave)
Iteration 4:   log likelihood = -18065.008  (not concave)
Iteration 5:   log likelihood = -18061.084  (not concave)
Iteration 6:   log likelihood = -18057.024  (not concave)
Iteration 7:   log likelihood = -18050.671  (not concave)
Iteration 8:   log likelihood = -18044.683  (not concave)
Iteration 9:   log likelihood = -18039.196  (not concave)
Iteration 10:  log likelihood = -18035.561  
Iteration 11:  log likelihood = -18011.856  
Iteration 12:  log likelihood = -17983.638  
Iteration 13:  log likelihood = -17962.308  
Iteration 14:  log likelihood = -17951.185  
Iteration 15:  log likelihood = -17939.864  (not concave)
Iteration 16:  log likelihood = -17939.834  
Iteration 17:  log likelihood =  -17939.74  
Iteration 18:  log likelihood =  -17939.74  

Survival model                                  Number of obs     =     59,755
Log likelihood =  -17939.74
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_t:          |            
motivodeeg~3 |   .1300112   .0215946     6.02   0.000     .0876865    .1723359
edad_al_in~1 |   .0927599   .0060199    15.41   0.000     .0809612    .1045586
edad_ini_c~s |  -.0242853   .0046773    -5.19   0.000    -.0334526    -.015118
     sex_enc |  -.5038711   .0441517   -11.41   0.000    -.5904069   -.4173353
     esc_rec |   .2512038    .026496     9.48   0.000     .1992725     .303135
sus_prin_mod |   .2224494   .0182466    12.19   0.000     .1866867     .258212
 fr_sus_prin |   .0331595   .0166028     2.00   0.046     .0006187    .0657003
 comp_biosoc |   .2260753   .0302122     7.48   0.000     .1668605      .28529
     ten_viv |  -.0260899   .0156688    -1.67   0.096    -.0568002    .0046203
dg_cie_10_~c |   .0409866   .0186535     2.20   0.028     .0044263    .0775469
sud_sever~10 |  -.0991656   .0423005    -2.34   0.019    -.1820731    -.016258
   macrozone |   .2406702    .024337     9.89   0.000     .1929706    .2883698
 policonsumo |   .0999092   .0487411     2.05   0.040     .0043785    .1954399
   n_off_vio |   .3915739   .0364923    10.73   0.000     .3200503    .4630975
   n_off_acq |   1.083966   .0336446    32.22   0.000     1.018023    1.149908
   n_off_sud |   .3127504   .0358205     8.73   0.000     .2425436    .3829572
        clas |   .1162043   .0286281     4.06   0.000     .0600942    .1723144
       _cons |   5.345024   38.20365     0.14   0.889    -69.53275     80.2228
------------------------------------------------------------------------------
    Warning: Baseline spline coefficients not shown - use ml display

. 
. *rcs(time, df(3) orthog)
. estwrite _all using "${pathdata2}parmodels_m2_nov_22_2.sters", replace
(saving m2_1_cox1)
(saving m2_1_cox2)
(saving m2_1_cox3)
(saving m2_1_cox4)
(saving m2_1_cox5)
(saving m2_1_cox6)
(saving m2_1_cox7)
(saving m2_1_gom)
(saving m2_1_wei)
(saving m2_1_logl)
(saving m2_1_logn)
(saving m2_1_ggam)
(saving m2_1_rp1)
(saving m2_1_rp2)
(saving m2_1_rp3)
(saving m2_1_rp4)
(saving m2_1_rp5)
(saving m2_1_rp6)
(saving m2_1_rp7)
(saving m2_1_rp8)
(saving m2_1_rp9)
(saving m2_1_rp10)
(file parmodels_m2_nov_22_2.sters saved)

We obtained a summary of distributions by AICs and BICs.

. *estread "${pathdata2}parmodels_aic_bic_22_2.sters"
. 
. *file:///G:/Mi%20unidad/Alvacast/SISTRAT%202019%20(github)/_supp_mstates/stata/1806.01615.pdf
. *rcs - restricted cubic splines on log hazard scale
. *rp - Royston-Parmar model (restricted cubic spline on log cumulative hazard scale)
. qui count if _d == 1

.         // we count the amount of cases with the event in the strata
.         //we call the estimates stored, and the results...
. estimates stat m2_1_*, n(`r(N)')

Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
   m2_1_cox1 |      5,144          .  -18113.43      19   36264.86   36389.23
   m2_1_cox2 |      5,144          .  -18079.75      20   36199.49    36330.4
   m2_1_cox3 |      5,144          .  -18075.82      21   36193.65    36331.1
   m2_1_cox4 |      5,144          .   -18075.6      22    36195.2    36339.2
   m2_1_cox5 |      5,144          .  -18075.69      23   36197.39   36347.94
   m2_1_cox6 |      5,144          .  -18074.16      24   36196.32   36353.42
   m2_1_cox7 |      5,144          .  -18074.18      25   36198.36      36362
    m2_1_gom |      5,144          .  -17922.81      19   35883.63   36007.99
    m2_1_wei |      5,144          .  -18095.91      18   36227.83   36345.65
   m2_1_logl |      5,144          .  -18135.48      19   36308.96   36433.33
   m2_1_logn |      5,144          .  -18090.44      19   36218.89   36343.25
   m2_1_ggam |      5,144          .  -18070.36      14   36168.72   36260.35
    m2_1_rp1 |      5,144          .  -18095.91      18   36227.83   36345.65
    m2_1_rp2 |      5,144          .   -17968.8      20    35977.6   36108.51
    m2_1_rp3 |      5,144          .   -17969.1      21    35980.2   36117.66
    m2_1_rp4 |      5,144          .  -17967.83      22   35979.65   36123.66
    m2_1_rp5 |      5,144          .  -17958.54      23   35963.07   36113.62
    m2_1_rp6 |      5,144          .  -17954.12      24   35956.24   36113.33
    m2_1_rp7 |      5,144          .  -17950.36      25   35950.73   36114.37
    m2_1_rp8 |      5,144          .  -17947.61      26   35947.21    36117.4
    m2_1_rp9 |      5,144          .  -17942.95      27   35939.89   36116.62
   m2_1_rp10 |      5,144          .  -17939.74      28   35935.48   36118.76
-----------------------------------------------------------------------------

.         //we store in a matrix de survival
. matrix stats_1=r(S)

. 
. 
. estimates clear

. 
. ** to order AICs
. *https://www.statalist.org/forums/forum/general-stata-discussion/general/1665263-sorting-matrix-including-rownames
. mata :
------------------------------------------------- mata (type end to exit) -----------------------------------------------------
: 
: void st_sort_matrix(
> //argumento de la matriz
>     string scalar matname, 
> //argumento de las columnas
>     real   rowvector columns
>     )
> {
>     string matrix   rownames
>     real  colvector sort_order
> // defino una base      
>         //Y = st_matrix(matname)
>         //[.,(1, 2, 3, 4, 6, 5)]
>  //ordeno las columnas  
>     rownames = st_matrixrowstripe(matname) //[.,(1, 2, 3, 4, 6, 5)]
>     sort_order = order(st_matrix(matname),  (columns))
>     st_replacematrix(matname, st_matrix(matname)[sort_order,.])
>     st_matrixrowstripe(matname, rownames[sort_order,.])
> }

: 
: end
-------------------------------------------------------------------------------------------------------------------------------

. //mata: mata drop st_sort_matrix()
. 
. mata : st_sort_matrix("stats_1", 6)

. esttab matrix(stats_1) using "testreg_aic_bic_22_2.csv", replace
(output written to testreg_aic_bic_22_2.csv)

. esttab matrix(stats_1) using "testreg_aic_bic_22_2.html", replace
(output written to testreg_aic_bic_22_2.html)

. 

stats_1
N ll0 ll df AIC BIC

m2_1_gom 5144 . -17922.81 19 35883.63 36007.99
m2_1_rp2 5144 . -17968.8 20 35977.6 36108.51
m2_1_rp6 5144 . -17954.12 24 35956.24 36113.33
m2_1_rp5 5144 . -17958.54 23 35963.07 36113.62
m2_1_rp7 5144 . -17950.36 25 35950.73 36114.37
m2_1_rp9 5144 . -17942.95 27 35939.89 36116.62
m2_1_rp8 5144 . -17947.61 26 35947.21 36117.4
m2_1_rp3 5144 . -17969.1 21 35980.2 36117.66
m2_1_rp10 5144 . -17939.74 28 35935.48 36118.76
m2_1_rp4 5144 . -17967.83 22 35979.65 36123.66
m2_1_ggam 5144 . -18070.36 14 36168.72 36260.35
m2_1_cox2 5144 . -18079.75 20 36199.49 36330.4
m2_1_cox3 5144 . -18075.82 21 36193.65 36331.1
m2_1_cox4 5144 . -18075.6 22 36195.2 36339.2
m2_1_logn 5144 . -18090.44 19 36218.89 36343.25
m2_1_wei 5144 . -18095.91 18 36227.83 36345.65
m2_1_rp1 5144 . -18095.91 18 36227.83 36345.65
m2_1_cox5 5144 . -18075.69 23 36197.39 36347.94
m2_1_cox6 5144 . -18074.16 24 36196.32 36353.42
m2_1_cox7 5144 . -18074.18 25 36198.36 36362
m2_1_cox1 5144 . -18113.43 19 36264.86 36389.23
m2_1_logl 5144 . -18135.48 19 36308.96 36433.33

IPTW Royston-Parmar

. *reset time, only compatible with stteffects (same entry times)
. stset diff, failure(event ==1) 

     failure event:  event == 1
obs. time interval:  (0, diff]
 exit on or before:  failure

------------------------------------------------------------------------------
     70,863  total observations
          1  observation ends on or before enter()
------------------------------------------------------------------------------
     70,862  observations remaining, representing
      5,144  failures in single-record/single-failure data
 302,812.78  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =         0
                                          last observed exit t =  10.75828

. *stset age_offending_imp, fail(event ==1) enter(edad_al_egres_imp)
. 
. cap rm bsreg12.dta bsreg22.dta

. 
. *count if missing(motivodeegreso_mod_imp_rec3, edad_al_ing_1, edad_ini_cons, dias_treat_imp_sin_na_1, esc_rec, sus_prin_mod, 
> fr_sus_prin, comp_biosoc, ten_viv, dg_cie_10_rec, sud_severity_icd10, macrozone, policonsumo, n_off_vio, n_off_acq, n_off_sud
> , n_off_oth)

First we calculated the difference between those patients who did and did not complete baseline treatment, given that this analysis is restricted to 2 values.

. *Micki Hill & Paul C Lambert & Michael J Crowther, 2021. "Introducing stipw: inverse probability weighted parametric survival
>  models," London Stata Conference 2021 15, Stata Users Group.
. *https://view.officeapps.live.com/op/view.aspx?src=http%3A%2F%2Ffmwww.bc.edu%2Frepec%2Fusug2021%2Fusug21_hill.pptx&wdOrigin=B
> ROWSELINK
. 
. *Treatment variable should be a binary variable with values 0 and 1.
. gen     motivodeegreso_mod_imp_rec2 = 0

. replace motivodeegreso_mod_imp_rec2 = 1 if strpos(motivodeegreso_mod_imp_rec,"Early")>0
(15,797 real changes made)

. replace motivodeegreso_mod_imp_rec2 = 1 if strpos(motivodeegreso_mod_imp_rec,"Late")>0
(35,781 real changes made)

. 
. recode motivodeegreso_mod_imp_rec3 (1=0 "Tr Completion") (3=1 "Tr Non-completion (Late)") (2=2 "Tr Non-completion (Early)"), 
> gen(caus_disch_mod_imp_rec) 
(55066 differences between motivodeegreso_mod_imp_rec3 and caus_disch_mod_imp_rec)

. lab var caus_disch_mod_imp_rec "Baseline treatment outcome" 

. 
. global covs_3 "i.caus_disch_mod_imp_rec edad_al_ing_1 edad_ini_cons i.sex_enc i.esc_rec i.sus_prin_mod i.fr_sus_prin i.comp_b
> iosoc i.ten_viv i.dg_cie_10_rec i.sud_severity_icd10 i.macrozone i.policonsumo i.n_off_vio i.n_off_acq i.n_off_sud i.clas"

. 
. global covs_3b "i.caus_disch_mod_imp_rec edad_al_ing_1 edad_ini_cons i.sex_enc i.esc_rec i.sus_prin_mod i.fr_sus_prin i.comp_
> biosoc i.origen_ingreso_mod numero_de_hijos_mod i.dg_cie_10_rec i.sud_severity_icd10 i.macrozone i.policonsumo i.n_off_vio i.
> n_off_acq i.n_off_sud i.clas"

. 
. *______________________________________________
. *______________________________________________
. * ADJUSTED ROYSTON PARMAR - DF5, NO STAGGERED ENTRY, BINARY TREATMENT (1-DROPOUT VS. 0-COMPLETION)
. 
. stpm2 $covs_3 , scale(hazard) df(5) eform

Iteration 0:   log likelihood = -17234.196  
Iteration 1:   log likelihood = -17231.695  
Iteration 2:   log likelihood = -17231.689  
Iteration 3:   log likelihood = -17231.689  

Log likelihood = -17231.689                     Number of obs     =     59,755

-------------------------------------------------------------------------------------------------------------
                                            |     exp(b)   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------------------------------------+----------------------------------------------------------------
xb                                          |
                     caus_disch_mod_imp_rec |
                  Tr Non-completion (Late)  |   1.580846   .0801927     9.03   0.000     1.431232      1.7461
                 Tr Non-completion (Early)  |   1.773658   .1068178     9.52   0.000     1.576183    1.995874
                                            |
                              edad_al_ing_1 |   .9656771   .0020826   -16.19   0.000     .9616039    .9697675
                              edad_ini_cons |   .9753055   .0045823    -5.32   0.000     .9663655    .9843281
                                            |
                                    sex_enc |
                                     Women  |   .5986703   .0265192   -11.58   0.000     .5488859    .6529701
                                            |
                                    esc_rec |
           2-Completed high school or less  |   1.347667   .0781147     5.15   0.000     1.202941    1.509804
        3-Completed primary school or less  |   1.580901   .0971921     7.45   0.000     1.401438    1.783346
                                            |
                               sus_prin_mod |
                     Cocaine hydrochloride  |   1.190785   .0789714     2.63   0.008     1.045641    1.356076
                             Cocaine paste  |   2.013516    .105595    13.35   0.000     1.816834    2.231488
                                 Marijuana  |   1.335079   .1050888     3.67   0.000     1.144211    1.557787
                                     Other  |   1.827998   .2719367     4.05   0.000     1.365681    2.446821
                                            |
                                fr_sus_prin |
                        2 to 3 days a week  |   1.007899   .0813709     0.10   0.922     .8603925    1.180693
                        4 to 6 days a week  |    1.04442   .0881621     0.51   0.607     .8851624     1.23233
                                     Daily  |   1.075197   .0856135     0.91   0.363     .9198359    1.256799
                    Less than 1 day a week  |   1.039195   .1175102     0.34   0.734     .8326161    1.297028
                                            |
                                comp_biosoc |
                                2-Moderate  |   1.266761   .0998843     3.00   0.003     1.085369    1.478468
                                  3-Severe  |   1.496528    .124804     4.83   0.000     1.270862    1.762266
                                            |
                                    ten_viv |
                                    Others  |    1.05098   .1523573     0.34   0.732     .7910397    1.396338
Owner/Transferred dwellings/Pays Dividends  |   .8284898   .1030874    -1.51   0.131      .649193    1.057306
                                   Renting  |   .8895818   .1129814    -0.92   0.357     .6935519    1.141019
         Stays temporarily with a relative  |   .8337576   .1029156    -1.47   0.141     .6545925    1.061961
                                            |
                              dg_cie_10_rec |
           Diagnosis unknown (under study)  |   1.104307   .0539795     2.03   0.042     1.003419    1.215338
              With psychiatric comorbidity  |   1.091941   .0419372     2.29   0.022     1.012763    1.177309
                                            |
                         sud_severity_icd10 |
                     Hazardous consumption  |   .9542209    .041079    -1.09   0.276     .8770107    1.038229
                                            |
                                  macrozone |
                                     North  |   1.459505   .0587789     9.39   0.000      1.34873    1.579378
                                     South  |   1.523434   .0945671     6.78   0.000     1.348918    1.720529
                                            |
                              1.policonsumo |   1.070096   .0523896     1.38   0.166     .9721866    1.177865
                                1.n_off_vio |   1.479257   .0541271    10.70   0.000     1.376885    1.589241
                                1.n_off_acq |   2.774692   .0941079    30.09   0.000     2.596241    2.965409
                                1.n_off_sud |   1.332665   .0478742     7.99   0.000      1.24206    1.429879
                                            |
                                       clas |
                                     Rural  |    .968178   .0831156    -0.38   0.706     .8182419    1.145589
                                    Urbana  |   1.132403   .0686805     2.05   0.040     1.005485    1.275342
                                            |
                                      _rcs1 |   2.120386   .0233154    68.35   0.000     2.075178    2.166579
                                      _rcs2 |    1.03444   .0083409     4.20   0.000      1.01822    1.050917
                                      _rcs3 |   1.024283   .0067694     3.63   0.000     1.011101    1.037637
                                      _rcs4 |   1.008095   .0048166     1.69   0.092     .9986986     1.01758
                                      _rcs5 |   1.007675   .0035055     2.20   0.028     1.000828    1.014569
                                      _cons |   .0350692   .0075509   -15.56   0.000      .022996    .0534812
-------------------------------------------------------------------------------------------------------------
Note: Estimates are transformed only in the first equation.

. 
. stpm2 $covs_3b , scale(hazard) df(5) eform

Iteration 0:   log likelihood = -18606.277  
Iteration 1:   log likelihood = -18603.761  
Iteration 2:   log likelihood = -18603.756  
Iteration 3:   log likelihood = -18603.756  

Log likelihood = -18603.756                     Number of obs     =     62,500

-----------------------------------------------------------------------------------------------------
                                    |     exp(b)   Std. Err.      z    P>|z|     [95% Conf. Interval]
------------------------------------+----------------------------------------------------------------
xb                                  |
             caus_disch_mod_imp_rec |
          Tr Non-completion (Late)  |   1.569941   .0766706     9.24   0.000     1.426637     1.72764
         Tr Non-completion (Early)  |   1.781134   .1025723    10.02   0.000     1.591026    1.993957
                                    |
                      edad_al_ing_1 |   .9625573   .0021803   -16.85   0.000     .9582935    .9668401
                      edad_ini_cons |   .9757844   .0043571    -5.49   0.000      .967282    .9843616
                                    |
                            sex_enc |
                             Women  |   .5545934   .0249293   -13.11   0.000     .5078235    .6056708
                                    |
                            esc_rec |
   2-Completed high school or less  |   1.341292   .0752994     5.23   0.000     1.201537    1.497301
3-Completed primary school or less  |   1.528273   .0912013     7.11   0.000     1.359579    1.717897
                                    |
                       sus_prin_mod |
             Cocaine hydrochloride  |   1.160094   .0742901     2.32   0.020     1.023256    1.315232
                     Cocaine paste  |   1.933162   .0973797    13.09   0.000     1.751421    2.133763
                         Marijuana  |   1.288088   .0977557     3.34   0.001     1.110059    1.494669
                             Other  |   1.752284   .2507087     3.92   0.000     1.323788    2.319479
                                    |
                        fr_sus_prin |
                2 to 3 days a week  |   .9988362   .0793161    -0.01   0.988     .8548731    1.167043
                4 to 6 days a week  |   1.044521   .0867684     0.52   0.600     .8875806    1.229211
                             Daily  |   1.097092   .0858412     1.18   0.236     .9411123    1.278924
            Less than 1 day a week  |   1.076366   .1173255     0.68   0.500     .8693159     1.33273
                                    |
                        comp_biosoc |
                        2-Moderate  |    1.24577   .0959075     2.85   0.004     1.071289    1.448668
                          3-Severe  |   1.478772   .1201811     4.81   0.000     1.261024     1.73412
                                    |
                 origen_ingreso_mod |
                 Assisted Referral  |   1.132939   .0562078     2.52   0.012      1.02796    1.248638
                             Other  |   1.237856   .0751535     3.51   0.000     1.098984    1.394276
                    Justice Sector  |   1.089302   .0616221     1.51   0.131     .9749796    1.217029
                     Health Sector  |   .9782757   .0384313    -0.56   0.576     .9057786    1.056575
                                    |
                numero_de_hijos_mod |   1.059249   .0139961     4.36   0.000     1.032169    1.087039
                                    |
                      dg_cie_10_rec |
   Diagnosis unknown (under study)  |   1.088941    .050905     1.82   0.068      .993603    1.193426
      With psychiatric comorbidity  |   1.091049   .0402993     2.36   0.018     1.014855    1.172963
                                    |
                 sud_severity_icd10 |
             Hazardous consumption  |   .9597286   .0398832    -0.99   0.323     .8846577     1.04117
                                    |
                          macrozone |
                             North  |   1.475661   .0578781     9.92   0.000     1.366473    1.593574
                             South  |   1.561551    .093145     7.47   0.000     1.389258    1.755212
                                    |
                      1.policonsumo |   1.061669   .0490577     1.30   0.195     .9697431    1.162309
                        1.n_off_vio |   1.441362   .0509122    10.35   0.000     1.344952    1.544684
                        1.n_off_acq |    2.77654   .0901767    31.44   0.000     2.605305    2.959029
                        1.n_off_sud |   1.320371   .0454872     8.07   0.000     1.234161    1.412603
                                    |
                               clas |
                             Rural  |   .9074739   .0761642    -1.16   0.247     .7698264    1.069733
                            Urbana  |   1.103512   .0643768     1.69   0.091     .9842826    1.237185
                                    |
                              _rcs1 |   2.118815   .0223299    71.25   0.000     2.075498    2.163036
                              _rcs2 |   1.036965    .008098     4.65   0.000     1.021214    1.052959
                              _rcs3 |   1.023772   .0064971     3.70   0.000     1.011117    1.036586
                              _rcs4 |   1.006088   .0045712     1.34   0.182     .9971687    1.015088
                              _rcs5 |     1.0073   .0033307     2.20   0.028     1.000794     1.01385
                              _cons |   .0332125   .0056956   -19.85   0.000     .0237318    .0464807
-----------------------------------------------------------------------------------------------------
Note: Estimates are transformed only in the first equation.

. 
. *______________________________________________
. *______________________________________________
. * INVERSE PROBABILITY WEIGHTED ADJUSTED ROYSTON PARMAR - DF5, NO STAGGERED ENTRY, BINARY TREATMENT (1-DROPOUT VS. 0-COMPLETIO
> N)
. 
. stipw (logit motivodeegreso_mod_imp_rec2 edad_al_ing_1 edad_ini_cons sex_enc esc_rec sus_prin_mod fr_sus_prin comp_biosoc ten
> _viv dg_cie_10_rec sud_severity_icd10 macrozone policonsumo n_off_vio n_off_acq n_off_sud clas), distribution(rp) df(5) genw(
> rpdf5_m_nostag_ten_viv) ipwtype(stabilised) vce(mestimation) eform
11108 observations have missing treatment and/or missing confounder values and/or _st = 0.
These observations are excluded from the analysis, see variable _stipw_flag

Fitting logistic regression to obtain denominator for weights

Iteration 0:   log likelihood = -35121.157  
Iteration 1:   log likelihood = -33474.525  
Iteration 2:   log likelihood = -33449.458  
Iteration 3:   log likelihood =  -33449.44  
Iteration 4:   log likelihood =  -33449.44  
Fitting second logistic regression with no confounders to obtain numerator for stabilised weights

Iteration 0:   log likelihood = -35121.157  
Iteration 1:   log likelihood = -35121.157  

Fitting weighted survival model to obtain point estimates

Iteration 0:   log pseudolikelihood = -18625.698  
Iteration 1:   log pseudolikelihood = -18622.913  
Iteration 2:   log pseudolikelihood = -18622.906  
Iteration 3:   log pseudolikelihood = -18622.906  

Displaying weighted survival model with M-estimation standard errors

Log pseudolikelihood = -18622.906               Number of obs     =     59,755

---------------------------------------------------------------------------------------------
                            |            M-estimation
                            |     exp(b)   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------------------+----------------------------------------------------------------
xb                          |
motivodeegreso_mod_imp_rec2 |   1.665297   .0835877    10.16   0.000     1.509269    1.837455
                      _rcs1 |   2.073877   .0232869    64.96   0.000     2.028734    2.120024
                      _rcs2 |   1.040242    .009121     4.50   0.000     1.022518    1.058273
                      _rcs3 |   1.023716   .0072611     3.30   0.001     1.009583    1.038047
                      _rcs4 |    1.00922   .0048043     1.93   0.054     .9998477     1.01868
                      _rcs5 |   1.009227    .003495     2.65   0.008       1.0024      1.0161
                      _cons |   .0354904   .0016903   -70.10   0.000     .0323273    .0389629
---------------------------------------------------------------------------------------------
Note: Estimates are transformed only in the first equation.

. stipw (logit motivodeegreso_mod_imp_rec2 edad_al_ing_1 edad_ini_cons sex_enc esc_rec sus_prin_mod fr_sus_prin comp_biosoc ori
> gen_ingreso_mod numero_de_hijos_mod dg_cie_10_rec sud_severity_icd10 macrozone policonsumo n_off_vio n_off_acq n_off_sud clas
> ), distribution(rp) df(5) genw(rpdf5_m_nostag_or_ing_num_hij) ipwtype(stabilised) vce(mestimation) eform
8363 observations have missing treatment and/or missing confounder values and/or _st = 0.
These observations are excluded from the analysis, see variable _stipw_flag

Fitting logistic regression to obtain denominator for weights

Iteration 0:   log likelihood = -36548.788  
Iteration 1:   log likelihood = -34725.723  
Iteration 2:   log likelihood =  -34696.15  
Iteration 3:   log likelihood = -34696.127  
Iteration 4:   log likelihood = -34696.127  
Fitting second logistic regression with no confounders to obtain numerator for stabilised weights

Iteration 0:   log likelihood = -36548.788  
Iteration 1:   log likelihood = -36548.788  

Fitting weighted survival model to obtain point estimates

Iteration 0:   log pseudolikelihood = -20117.963  
Iteration 1:   log pseudolikelihood = -20115.352  
Iteration 2:   log pseudolikelihood = -20115.347  
Iteration 3:   log pseudolikelihood = -20115.347  

Displaying weighted survival model with M-estimation standard errors

Log pseudolikelihood = -20115.347               Number of obs     =     62,500

---------------------------------------------------------------------------------------------
                            |            M-estimation
                            |     exp(b)   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------------------+----------------------------------------------------------------
xb                          |
motivodeegreso_mod_imp_rec2 |   1.639443   .0789035    10.27   0.000     1.491864    1.801619
                      _rcs1 |   2.074982   .0222781    67.99   0.000     2.031774    2.119109
                      _rcs2 |   1.043215   .0086947     5.08   0.000     1.026312    1.060396
                      _rcs3 |   1.023483   .0068888     3.45   0.001      1.01007    1.037074
                      _rcs4 |   1.007252   .0045625     1.60   0.111     .9983494    1.016234
                      _rcs5 |   1.008696   .0033288     2.62   0.009     1.002192    1.015241
                      _cons |    .037377    .001704   -72.09   0.000     .0341821    .0408706
---------------------------------------------------------------------------------------------
Note: Estimates are transformed only in the first equation.

. 
. predict rmst03 in 1, at(motivodeegreso_mod_imp_rec2 0) rmst stdp tmax(3)

. predict rmst13 in 1, at(motivodeegreso_mod_imp_rec2 1) rmst stdp tmax(3)

. predictnl drmst= predict(rmst at(motivodeegreso_mod_imp_rec2 1) tmax(3))- predict(rmst at(motivodeegreso_mod_imp_rec2 1) tmax
> (3)) in 1, se(drmst_se)
Warning: prediction doesn't vary with respect to e(b).
(70,862 missing values generated)
Warning: prediction constant over observations; perhaps you meant to run nlcom.

. 
. cap list rmst03 rmst13  drmst in 1

We used a gompertz distribution, assuming that baseline treatment outcome showed proportional hazards

. *______________________________________________
. *______________________________________________
. * INVERSE PROBABILITY WEIGHTED ADJUSTED GOMPERTZ - NO STAGGERED ENTRY, BINARY TREATMENT (1-DROPOUT VS. 0-COMPLETION)
. 
. stipw (logit motivodeegreso_mod_imp_rec2 edad_al_ing_1 edad_ini_cons sex_enc esc_rec sus_prin_mod fr_sus_prin comp_biosoc ten
> _viv dg_cie_10_rec sud_severity_icd10 macrozone policonsumo n_off_vio n_off_acq n_off_sud clas), distribution(gompertz) genw(
> gomp_m_nostag_ten_viv) ipwtype(stabilised) vce(mestimation)
11108 observations have missing treatment and/or missing confounder values and/or _st = 0.
These observations are excluded from the analysis, see variable _stipw_flag

Fitting logistic regression to obtain denominator for weights

Iteration 0:   log likelihood = -35121.157  
Iteration 1:   log likelihood = -33474.525  
Iteration 2:   log likelihood = -33449.458  
Iteration 3:   log likelihood =  -33449.44  
Iteration 4:   log likelihood =  -33449.44  
Fitting second logistic regression with no confounders to obtain numerator for stabilised weights

Iteration 0:   log likelihood = -35121.157  
Iteration 1:   log likelihood = -35121.157  

Fitting weighted survival model to obtain point estimates

         failure _d:  event == 1
   analysis time _t:  diff
             weight:  [pweight=gomp_m_nostag_ten_viv]

Fitting constant-only model:

Iteration 0:   log pseudolikelihood = -18959.069  
Iteration 1:   log pseudolikelihood = -18738.321  
Iteration 2:   log pseudolikelihood = -18729.984  
Iteration 3:   log pseudolikelihood = -18729.975  
Iteration 4:   log pseudolikelihood = -18729.975  

Fitting full model:

Iteration 0:   log pseudolikelihood = -18729.975  
Iteration 1:   log pseudolikelihood = -18652.414  
Iteration 2:   log pseudolikelihood = -18651.466  
Iteration 3:   log pseudolikelihood = -18651.466  

Displaying weighted survival model with M-estimation standard errors

Gompertz PH regression                          Number of obs     =     59,755
                                                Wald chi2(1)      =     102.94
Log pseudolikelihood = -18651.466               Prob > chi2       =     0.0000

---------------------------------------------------------------------------------------------
                            |            M-estimation
                         _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------------------+----------------------------------------------------------------
motivodeegreso_mod_imp_rec2 |    1.66392   .0835046    10.15   0.000     1.508046    1.835906
                      _cons |   .0172597   .0008842   -79.24   0.000     .0156108    .0190827
----------------------------+----------------------------------------------------------------
                     /gamma |  -.1942119   .0100127   -19.40   0.000    -.2138364   -.1745873
---------------------------------------------------------------------------------------------
Note: _cons estimates baseline hazard.

. stipw (logit motivodeegreso_mod_imp_rec2 edad_al_ing_1 edad_ini_cons sex_enc esc_rec sus_prin_mod fr_sus_prin comp_biosoc ori
> gen_ingreso_mod numero_de_hijos_mod dg_cie_10_rec sud_severity_icd10 macrozone policonsumo n_off_vio n_off_acq n_off_sud clas
> ), distribution(gompertz) genw(gomp_m_nostag_or_ing_num_hij) ipwtype(stabilised) vce(mestimation)
8363 observations have missing treatment and/or missing confounder values and/or _st = 0.
These observations are excluded from the analysis, see variable _stipw_flag

Fitting logistic regression to obtain denominator for weights

Iteration 0:   log likelihood = -36548.788  
Iteration 1:   log likelihood = -34725.723  
Iteration 2:   log likelihood =  -34696.15  
Iteration 3:   log likelihood = -34696.127  
Iteration 4:   log likelihood = -34696.127  
Fitting second logistic regression with no confounders to obtain numerator for stabilised weights

Iteration 0:   log likelihood = -36548.788  
Iteration 1:   log likelihood = -36548.788  

Fitting weighted survival model to obtain point estimates

         failure _d:  event == 1
   analysis time _t:  diff
             weight:  [pweight=gomp_m_nostag_or_ing_num_hij]

Fitting constant-only model:

Iteration 0:   log pseudolikelihood = -20478.705  
Iteration 1:   log pseudolikelihood = -20235.755  
Iteration 2:   log pseudolikelihood = -20226.682  
Iteration 3:   log pseudolikelihood = -20226.659  
Iteration 4:   log pseudolikelihood = -20226.659  

Fitting full model:

Iteration 0:   log pseudolikelihood = -20226.659  
Iteration 1:   log pseudolikelihood = -20147.658  
Iteration 2:   log pseudolikelihood = -20146.756  
Iteration 3:   log pseudolikelihood = -20146.756  

Displaying weighted survival model with M-estimation standard errors

Gompertz PH regression                          Number of obs     =     62,500
                                                Wald chi2(1)      =     105.12
Log pseudolikelihood = -20146.756               Prob > chi2       =     0.0000

---------------------------------------------------------------------------------------------
                            |            M-estimation
                         _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------------------+----------------------------------------------------------------
motivodeegreso_mod_imp_rec2 |   1.637935   .0788273    10.25   0.000     1.490499    1.799954
                      _cons |   .0180679   .0008824   -82.18   0.000     .0164187    .0198828
----------------------------+----------------------------------------------------------------
                     /gamma |  -.1942989   .0096124   -20.21   0.000    -.2131389   -.1754589
---------------------------------------------------------------------------------------------
Note: _cons estimates baseline hazard.

. 
. predict rmst03_c in 1, at(motivodeegreso_mod_imp_rec2 0) rmst stdp tmax(3)
option at() not allowed
r(198);

. predict rmst13_c in 1, at(motivodeegreso_mod_imp_rec2 1) rmst stdp tmax(3)
option at() not allowed
r(198);

. predictnl drmst_c= predict(rmst at(motivodeegreso_mod_imp_rec2 1) tmax(3))- predict(rmst at(motivodeegreso_mod_imp_rec2 1) tm
> ax(3)) in 1, se(drmst_c_se)
option rmst not allowed
predict(rmst at(motivodeegreso_mod_imp_rec2 1) tmax(3)) invalid
r(198);

. 
. cap list rmst03_c rmst13_c  drmst_c in 1

We used another model with only 2 degrees of freedom according to the lowest BIC

. 
. *______________________________________________
. *______________________________________________
. * ADJUSTED ROYSTON PARMAR - DF2,  NO STAGGERED ENTRY, BINARY TREATMENT (1-DROPOUT VS. 0-COMPLETION)
. 
. stpm2 $covs_3 , scale(hazard) df(2) eform

Iteration 0:   log likelihood = -17255.265  
Iteration 1:   log likelihood = -17238.669  
Iteration 2:   log likelihood = -17238.625  
Iteration 3:   log likelihood = -17238.625  

Log likelihood = -17238.625                     Number of obs     =     59,755

-------------------------------------------------------------------------------------------------------------
                                            |     exp(b)   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------------------------------------+----------------------------------------------------------------
xb                                          |
                     caus_disch_mod_imp_rec |
                  Tr Non-completion (Late)  |   1.580526   .0801744     9.02   0.000     1.430946    1.745741
                 Tr Non-completion (Early)  |    1.77177    .106684     9.50   0.000      1.57454    1.993705
                                            |
                              edad_al_ing_1 |   .9657862   .0020824   -16.15   0.000     .9617133    .9698763
                              edad_ini_cons |   .9751776   .0045818    -5.35   0.000     .9662386    .9841992
                                            |
                                    sex_enc |
                                     Women  |   .5987102   .0265214   -11.58   0.000     .5489218    .6530145
                                            |
                                    esc_rec |
           2-Completed high school or less  |   1.346334   .0780354     5.13   0.000     1.201755    1.508306
        3-Completed primary school or less  |   1.579302   .0970888     7.43   0.000     1.400029    1.781532
                                            |
                               sus_prin_mod |
                     Cocaine hydrochloride  |    1.19043   .0789389     2.63   0.009     1.045345    1.355652
                             Cocaine paste  |   2.008108   .1052966    13.30   0.000     1.811981    2.225463
                                 Marijuana  |   1.330003   .1046669     3.62   0.000     1.139897    1.551813
                                     Other  |   1.819524   .2706549     4.02   0.000     1.359381    2.435423
                                            |
                                fr_sus_prin |
                        2 to 3 days a week  |   1.006876   .0812875     0.08   0.932     .8595214    1.179494
                        4 to 6 days a week  |   1.043037    .088046     0.50   0.618     .8839892      1.2307
                                     Daily  |   1.074868   .0855897     0.91   0.365     .9195503    1.256419
                    Less than 1 day a week  |   1.038196   .1173982     0.33   0.740      .831814    1.295783
                                            |
                                comp_biosoc |
                                2-Moderate  |   1.266485   .0998575     3.00   0.003      1.08514    1.478135
                                  3-Severe  |   1.492968   .1244934     4.81   0.000     1.267861    1.758042
                                            |
                                    ten_viv |
                                    Others  |   1.048122   .1519439     0.32   0.746     .7888872    1.392543
Owner/Transferred dwellings/Pays Dividends  |   .8292786   .1031887    -1.50   0.132     .6498061     1.05832
                                   Renting  |   .8899448   .1130312    -0.92   0.359     .6938293    1.141494
         Stays temporarily with a relative  |   .8342702    .102983    -1.47   0.142     .6549886    1.062624
                                            |
                              dg_cie_10_rec |
           Diagnosis unknown (under study)  |   1.105475   .0540238     2.05   0.040     1.004503    1.216596
              With psychiatric comorbidity  |   1.092734   .0419668     2.31   0.021       1.0135    1.178162
                                            |
                         sud_severity_icd10 |
                     Hazardous consumption  |   .9548681   .0411061    -1.07   0.283      .877607    1.038931
                                            |
                                  macrozone |
                                     North  |   1.458862    .058752     9.38   0.000     1.348138    1.578681
                                     South  |   1.525214   .0947003     6.80   0.000     1.350454    1.722589
                                            |
                              1.policonsumo |   1.065537   .0521407     1.30   0.195     .9680909    1.172792
                                1.n_off_vio |   1.484814   .0543324    10.80   0.000     1.382054    1.595215
                                1.n_off_acq |   2.789096    .094564    30.25   0.000     2.609778    2.980735
                                1.n_off_sud |   1.338274   .0480653     8.11   0.000     1.247307    1.435875
                                            |
                                       clas |
                                     Rural  |   .9676282   .0830675    -0.38   0.701     .8177788    1.144936
                                    Urbana  |   1.130196   .0685454     2.02   0.044     1.003527    1.272854
                                            |
                                      _rcs1 |   2.114537   .0230575    68.67   0.000     2.069825    2.160216
                                      _rcs2 |   1.039588   .0087519     4.61   0.000     1.022575    1.056884
                                      _cons |   .0351971   .0075782   -15.54   0.000       .02308    .0536755
-------------------------------------------------------------------------------------------------------------
Note: Estimates are transformed only in the first equation.

. 
. stpm2 $covs_3b , scale(hazard) df(2) eform

Iteration 0:   log likelihood = -18626.898  
Iteration 1:   log likelihood =   -18610.3  
Iteration 2:   log likelihood = -18610.259  
Iteration 3:   log likelihood = -18610.259  

Log likelihood = -18610.259                     Number of obs     =     62,500

-----------------------------------------------------------------------------------------------------
                                    |     exp(b)   Std. Err.      z    P>|z|     [95% Conf. Interval]
------------------------------------+----------------------------------------------------------------
xb                                  |
             caus_disch_mod_imp_rec |
          Tr Non-completion (Late)  |   1.569445   .0766446     9.23   0.000      1.42619     1.72709
         Tr Non-completion (Early)  |   1.778948   .1024245    10.00   0.000     1.589112    1.991461
                                    |
                      edad_al_ing_1 |   .9626527   .0021801   -16.81   0.000     .9583892    .9669352
                      edad_ini_cons |   .9756694   .0043567    -5.52   0.000     .9671676    .9842459
                                    |
                            sex_enc |
                             Women  |   .5547138    .024935   -13.11   0.000     .5079332     .605803
                                    |
                            esc_rec |
   2-Completed high school or less  |   1.340196   .0752358     5.22   0.000     1.200559    1.496074
3-Completed primary school or less  |   1.527171   .0911328     7.10   0.000     1.358604    1.716653
                                    |
                       sus_prin_mod |
             Cocaine hydrochloride  |   1.159808   .0742634     2.32   0.021     1.023017    1.314889
                     Cocaine paste  |   1.928451   .0971265    13.04   0.000     1.747181    2.128529
                         Marijuana  |   1.283856   .0974146     3.29   0.001     1.106446    1.489713
                             Other  |   1.745289   .2496887     3.89   0.000     1.318532     2.31017
                                    |
                        fr_sus_prin |
                2 to 3 days a week  |   .9979966   .0792489    -0.03   0.980     .8541553    1.166061
                4 to 6 days a week  |   1.043345   .0866718     0.51   0.610     .8865792     1.22783
                             Daily  |   1.096827   .0858223     1.18   0.238     .9408815    1.278619
            Less than 1 day a week  |   1.075056   .1171828     0.66   0.507     .8682575    1.331108
                                    |
                        comp_biosoc |
                        2-Moderate  |   1.245305   .0958666     2.85   0.004     1.070898    1.448115
                          3-Severe  |   1.475568   .1199068     4.79   0.000     1.258315    1.730331
                                    |
                 origen_ingreso_mod |
                 Assisted Referral  |    1.13159   .0561387     2.49   0.013     1.026741    1.247147
                             Other  |    1.23398   .0749126     3.46   0.001     1.095553    1.389899
                    Justice Sector  |   1.087033   .0614901     1.48   0.140     .9729557    1.214487
                     Health Sector  |   .9770014   .0383799    -0.59   0.554     .9046012    1.055196
                                    |
                numero_de_hijos_mod |   1.059284   .0139942     4.36   0.000     1.032208     1.08707
                                    |
                      dg_cie_10_rec |
   Diagnosis unknown (under study)  |   1.090284   .0509523     1.85   0.064     .9948566    1.194865
      With psychiatric comorbidity  |   1.091903     .04033     2.38   0.017     1.015651     1.17388
                                    |
                 sud_severity_icd10 |
             Hazardous consumption  |   .9604382   .0399123    -0.97   0.331     .8853125    1.041939
                                    |
                          macrozone |
                             North  |   1.475441   .0578702     9.92   0.000     1.366268    1.593339
                             South  |   1.563474   .0932775     7.49   0.000     1.390938    1.757412
                                    |
                      1.policonsumo |   1.057931   .0488641     1.22   0.223     .9663662    1.158172
                        1.n_off_vio |   1.446422   .0510897    10.45   0.000     1.349675    1.550104
                        1.n_off_acq |   2.789555   .0905607    31.60   0.000     2.617588    2.972819
                        1.n_off_sud |   1.325195   .0456445     8.17   0.000     1.238686    1.417745
                                    |
                               clas |
                             Rural  |    .906769   .0761044    -1.17   0.244     .7692296    1.068901
                            Urbana  |   1.101454   .0642563     1.66   0.098     .9824473    1.234876
                                    |
                              _rcs1 |   2.113744   .0221173    71.53   0.000     2.070836     2.15754
                              _rcs2 |   1.042234   .0084581     5.10   0.000     1.025788    1.058945
                              _cons |   .0333609   .0057207   -19.83   0.000     .0238383    .0466876
-----------------------------------------------------------------------------------------------------
Note: Estimates are transformed only in the first equation.

. 
. *______________________________________________
. *______________________________________________
. * INVERSE PROBABILITY WEIGHTED ADJUSTED ROYSTON PARMAR - DF2, NO STAGGERED ENTRY, BINARY TREATMENT (1-DROPOUT VS. 0-COMPLETIO
> N)
. 
. stipw (logit motivodeegreso_mod_imp_rec2 edad_al_ing_1 edad_ini_cons sex_enc esc_rec sus_prin_mod fr_sus_prin comp_biosoc ten
> _viv dg_cie_10_rec sud_severity_icd10 macrozone policonsumo n_off_vio n_off_acq n_off_sud clas), distribution(rp) df(2) genw(
> rpdf2_m_nostag_ten_viv) ipwtype(stabilised) vce(mestimation) eform
11108 observations have missing treatment and/or missing confounder values and/or _st = 0.
These observations are excluded from the analysis, see variable _stipw_flag

Fitting logistic regression to obtain denominator for weights

Iteration 0:   log likelihood = -35121.157  
Iteration 1:   log likelihood = -33474.525  
Iteration 2:   log likelihood = -33449.458  
Iteration 3:   log likelihood =  -33449.44  
Iteration 4:   log likelihood =  -33449.44  
Fitting second logistic regression with no confounders to obtain numerator for stabilised weights

Iteration 0:   log likelihood = -35121.157  
Iteration 1:   log likelihood = -35121.157  

Fitting weighted survival model to obtain point estimates

Iteration 0:   log pseudolikelihood =  -18647.26  
Iteration 1:   log pseudolikelihood = -18630.822  
Iteration 2:   log pseudolikelihood = -18630.775  
Iteration 3:   log pseudolikelihood = -18630.775  

Displaying weighted survival model with M-estimation standard errors

Log pseudolikelihood = -18630.775               Number of obs     =     59,755

---------------------------------------------------------------------------------------------
                            |            M-estimation
                            |     exp(b)   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------------------+----------------------------------------------------------------
xb                          |
motivodeegreso_mod_imp_rec2 |   1.664996   .0835719    10.16   0.000     1.508997    1.837121
                      _rcs1 |   2.066911    .023429    64.05   0.000     2.021498    2.113345
                      _rcs2 |   1.046111   .0100606     4.69   0.000     1.026577    1.066016
                      _cons |   .0355151    .001691   -70.10   0.000     .0323507     .038989
---------------------------------------------------------------------------------------------
Note: Estimates are transformed only in the first equation.

. stipw (logit motivodeegreso_mod_imp_rec2 edad_al_ing_1 edad_ini_cons sex_enc esc_rec sus_prin_mod fr_sus_prin comp_biosoc ori
> gen_ingreso_mod numero_de_hijos_mod dg_cie_10_rec sud_severity_icd10 macrozone policonsumo n_off_vio n_off_acq n_off_sud clas
> ), distribution(rp) df(2) genw(rpdf2_m_nostag_or_ing_num_hij) ipwtype(stabilised) vce(mestimation) eform
8363 observations have missing treatment and/or missing confounder values and/or _st = 0.
These observations are excluded from the analysis, see variable _stipw_flag

Fitting logistic regression to obtain denominator for weights

Iteration 0:   log likelihood = -36548.788  
Iteration 1:   log likelihood = -34725.723  
Iteration 2:   log likelihood =  -34696.15  
Iteration 3:   log likelihood = -34696.127  
Iteration 4:   log likelihood = -34696.127  
Fitting second logistic regression with no confounders to obtain numerator for stabilised weights

Iteration 0:   log likelihood = -36548.788  
Iteration 1:   log likelihood = -36548.788  

Fitting weighted survival model to obtain point estimates

Iteration 0:   log pseudolikelihood =  -20139.24  
Iteration 1:   log pseudolikelihood =  -20122.77  
Iteration 2:   log pseudolikelihood = -20122.725  
Iteration 3:   log pseudolikelihood = -20122.725  

Displaying weighted survival model with M-estimation standard errors

Log pseudolikelihood = -20122.725               Number of obs     =     62,500

---------------------------------------------------------------------------------------------
                            |            M-estimation
                            |     exp(b)   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------------------+----------------------------------------------------------------
xb                          |
motivodeegreso_mod_imp_rec2 |   1.639117   .0788877    10.27   0.000     1.491569    1.801262
                      _rcs1 |   2.068827    .022426    67.07   0.000     2.025336    2.113251
                      _rcs2 |   1.049317   .0095814     5.27   0.000     1.030705    1.068265
                      _cons |   .0374018   .0017046   -72.10   0.000     .0342057    .0408967
---------------------------------------------------------------------------------------------
Note: Estimates are transformed only in the first equation.

. 
. predict rmst03_b in 1, at(motivodeegreso_mod_imp_rec2 0) rmst stdp tmax(3)

. predict rmst13_b in 1, at(motivodeegreso_mod_imp_rec2 1) rmst stdp tmax(3)

. predictnl drmst_b= predict(rmst at(motivodeegreso_mod_imp_rec2 1) tmax(3))- predict(rmst at(motivodeegreso_mod_imp_rec2 1) tm
> ax(3)) in 1, se(drmst_b_se)
Warning: prediction doesn't vary with respect to e(b).
(70,862 missing values generated)
Warning: prediction constant over observations; perhaps you meant to run nlcom.

. 
. cap list rmst03_b rmst13_b  drmst_b in 1

Staggered entry

. *______________________________________________
. *______________________________________________
. * ADJUSTED ROYSTON PARMAR - DF5,  STAGGERED ENTRY, BINARY TREATMENT (1-DROPOUT VS. 0-COMPLETION)
. 
. stset age_offending_imp, fail(event ==1) enter(edad_al_egres_imp)

     failure event:  event == 1
obs. time interval:  (0, age_offending_imp]
 enter on or after:  time edad_al_egres_imp
 exit on or before:  failure

------------------------------------------------------------------------------
     70,863  total observations
          1  observation ends on or before enter()
------------------------------------------------------------------------------
     70,862  observations remaining, representing
      5,144  failures in single-record/single-failure data
 302,812.78  total analysis time at risk and under observation
                                                at risk from t =         0
                                     earliest observed entry t =  10.95068
                                          last observed exit t =  90.65027

. 
. stipw (logit motivodeegreso_mod_imp_rec2 edad_al_ing_1 edad_ini_cons sex_enc esc_rec sus_prin_mod fr_sus_prin comp_biosoc ten
> _viv dg_cie_10_rec sud_severity_icd10 macrozone policonsumo n_off_vio n_off_acq n_off_sud), distribution(rp) df(5) genw(rpdf5
> _m_stag_ten_viv) ipwtype(stabilised) vce(mestimation) eform
11106 observations have missing treatment and/or missing confounder values and/or _st = 0.
These observations are excluded from the analysis, see variable _stipw_flag

Fitting logistic regression to obtain denominator for weights

Iteration 0:   log likelihood = -35121.799  
Iteration 1:   log likelihood =  -33484.63  
Iteration 2:   log likelihood = -33459.824  
Iteration 3:   log likelihood = -33459.806  
Iteration 4:   log likelihood = -33459.806  
Fitting second logistic regression with no confounders to obtain numerator for stabilised weights

Iteration 0:   log likelihood = -35121.799  
Iteration 1:   log likelihood = -35121.799  

Fitting weighted survival model to obtain point estimates
note: delayed entry models are being fitted

Iteration 0:   log pseudolikelihood = -5542.8717  
Iteration 1:   log pseudolikelihood = -5523.0629  
Iteration 2:   log pseudolikelihood =  -5514.988  
Iteration 3:   log pseudolikelihood = -5511.8346  
Iteration 4:   log pseudolikelihood =  -5511.307  
Iteration 5:   log pseudolikelihood = -5511.1369  
Iteration 6:   log pseudolikelihood = -5511.1269  
Iteration 7:   log pseudolikelihood = -5511.1216  
Iteration 8:   log pseudolikelihood = -5511.1214  

Displaying weighted survival model with M-estimation standard errors

Log pseudolikelihood = -5511.1214               Number of obs     =     59,757

---------------------------------------------------------------------------------------------
                            |            M-estimation
                            |     exp(b)   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------------------+----------------------------------------------------------------
xb                          |
motivodeegreso_mod_imp_rec2 |   1.610324   .0817913     9.38   0.000     1.457737    1.778883
                      _rcs1 |   1.158443   .0647043     2.63   0.008      1.03832    1.292463
                      _rcs2 |   1.051606   .0261534     2.02   0.043     1.001575    1.104136
                      _rcs3 |   1.000906   .0035305     0.26   0.797       .99401    1.007849
                      _rcs4 |   1.002826   .0009749     2.90   0.004     1.000917    1.004739
                      _rcs5 |   .9997684   .0009992    -0.23   0.817     .9978119    1.001729
                      _cons |   .6834873   .2467749    -1.05   0.292     .3368231    1.386944
---------------------------------------------------------------------------------------------
Note: Estimates are transformed only in the first equation.

. estimates store df5_stipw

. 
. stipw (logit motivodeegreso_mod_imp_rec2 edad_al_ing_1 edad_ini_cons sex_enc esc_rec sus_prin_mod fr_sus_prin comp_biosoc ori
> gen_ingreso_mod numero_de_hijos_mod dg_cie_10_rec sud_severity_icd10 macrozone policonsumo n_off_vio n_off_acq n_off_sud), di
> stribution(rp) df(5) genw(rpdf5_m_stag_or_ing_num_hij) ipwtype(stabilised) vce(mestimation) eform
8361 observations have missing treatment and/or missing confounder values and/or _st = 0.
These observations are excluded from the analysis, see variable _stipw_flag

Fitting logistic regression to obtain denominator for weights

Iteration 0:   log likelihood = -36549.421  
Iteration 1:   log likelihood = -34737.642  
Iteration 2:   log likelihood = -34708.396  
Iteration 3:   log likelihood = -34708.373  
Iteration 4:   log likelihood = -34708.373  
Fitting second logistic regression with no confounders to obtain numerator for stabilised weights

Iteration 0:   log likelihood = -36549.421  
Iteration 1:   log likelihood = -36549.421  

Fitting weighted survival model to obtain point estimates
note: delayed entry models are being fitted

Iteration 0:   log pseudolikelihood = -5918.6569  
Iteration 1:   log pseudolikelihood = -5903.8654  
Iteration 2:   log pseudolikelihood =  -5886.952  
Iteration 3:   log pseudolikelihood =  -5886.586  
Iteration 4:   log pseudolikelihood = -5886.3212  
Iteration 5:   log pseudolikelihood = -5886.3155  
Iteration 6:   log pseudolikelihood = -5886.3151  

Displaying weighted survival model with M-estimation standard errors

Log pseudolikelihood = -5886.3151               Number of obs     =     62,502

---------------------------------------------------------------------------------------------
                            |            M-estimation
                            |     exp(b)   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------------------+----------------------------------------------------------------
xb                          |
motivodeegreso_mod_imp_rec2 |   1.578604   .0768661     9.38   0.000     1.434915    1.736682
                      _rcs1 |   1.187069   .0588327     3.46   0.001     1.077183    1.308165
                      _rcs2 |   1.062082   .0250486     2.55   0.011     1.014105    1.112329
                      _rcs3 |   .9991374   .0046417    -0.19   0.853     .9900811    1.008276
                      _rcs4 |   1.002728   .0010768     2.54   0.011     1.000619     1.00484
                      _rcs5 |   1.000176   .0009839     0.18   0.858     .9982496    1.002106
                      _cons |   .6226638   .1695861    -1.74   0.082     .3651102    1.061899
---------------------------------------------------------------------------------------------
Note: Estimates are transformed only in the first equation.

. estimates store df5_stipw2

. *______________________________________________
. *______________________________________________
. * INVERSE PROBABILITY WEIGHTED ADJUSTED GOMPERTZ - STAGGERED ENTRY, BINARY TREATMENT (1-DROPOUT VS. 0-COMPLETION)
. 
. stipw (logit motivodeegreso_mod_imp_rec2 edad_al_ing_1 edad_ini_cons sex_enc esc_rec sus_prin_mod fr_sus_prin comp_biosoc ten
> _viv dg_cie_10_rec sud_severity_icd10 macrozone policonsumo n_off_vio n_off_acq n_off_sud), distribution(gompertz) genw(gomp_
> m_stag_ten_viv) ipwtype(stabilised) vce(mestimation)
11106 observations have missing treatment and/or missing confounder values and/or _st = 0.
These observations are excluded from the analysis, see variable _stipw_flag

Fitting logistic regression to obtain denominator for weights

Iteration 0:   log likelihood = -35121.799  
Iteration 1:   log likelihood =  -33484.63  
Iteration 2:   log likelihood = -33459.824  
Iteration 3:   log likelihood = -33459.806  
Iteration 4:   log likelihood = -33459.806  
Fitting second logistic regression with no confounders to obtain numerator for stabilised weights

Iteration 0:   log likelihood = -35121.799  
Iteration 1:   log likelihood = -35121.799  

Fitting weighted survival model to obtain point estimates

         failure _d:  event == 1
   analysis time _t:  age_offending_imp
  enter on or after:  time edad_al_egres_imp
             weight:  [pweight=gomp_m_stag_ten_viv]

Fitting constant-only model:

Iteration 0:   log pseudolikelihood = -6286.1603  
Iteration 1:   log pseudolikelihood = -5654.2431  
Iteration 2:   log pseudolikelihood = -5587.4209  
Iteration 3:   log pseudolikelihood = -5587.2593  
Iteration 4:   log pseudolikelihood = -5587.2593  

Fitting full model:

Iteration 0:   log pseudolikelihood = -5587.2593  
Iteration 1:   log pseudolikelihood = -5519.7285  
Iteration 2:   log pseudolikelihood = -5519.0123  
Iteration 3:   log pseudolikelihood = -5519.0122  

Displaying weighted survival model with M-estimation standard errors

Gompertz PH regression                          Number of obs     =     59,757
                                                Wald chi2(1)      =      88.15
Log pseudolikelihood = -5519.0122               Prob > chi2       =     0.0000

---------------------------------------------------------------------------------------------
                            |            M-estimation
                         _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------------------+----------------------------------------------------------------
motivodeegreso_mod_imp_rec2 |   1.610994   .0818218     9.39   0.000      1.45835    1.779616
                      _cons |   .1194776   .0100089   -25.36   0.000     .1013864    .1407971
----------------------------+----------------------------------------------------------------
                     /gamma |  -.0663733   .0019544   -33.96   0.000    -.0702039   -.0625428
---------------------------------------------------------------------------------------------
Note: _cons estimates baseline hazard.

. estimates store gomp_stipw

. stipw (logit motivodeegreso_mod_imp_rec2 edad_al_ing_1 edad_ini_cons sex_enc esc_rec sus_prin_mod fr_sus_prin comp_biosoc ori
> gen_ingreso_mod numero_de_hijos_mod dg_cie_10_rec sud_severity_icd10 macrozone policonsumo n_off_vio n_off_acq n_off_sud clas
> ), distribution(gompertz) genw(gomp_m_stag_or_ing_num_hij) ipwtype(stabilised) vce(mestimation)
8363 observations have missing treatment and/or missing confounder values and/or _st = 0.
These observations are excluded from the analysis, see variable _stipw_flag

Fitting logistic regression to obtain denominator for weights

Iteration 0:   log likelihood = -36548.788  
Iteration 1:   log likelihood = -34725.723  
Iteration 2:   log likelihood =  -34696.15  
Iteration 3:   log likelihood = -34696.127  
Iteration 4:   log likelihood = -34696.127  
Fitting second logistic regression with no confounders to obtain numerator for stabilised weights

Iteration 0:   log likelihood = -36548.788  
Iteration 1:   log likelihood = -36548.788  

Fitting weighted survival model to obtain point estimates

         failure _d:  event == 1
   analysis time _t:  age_offending_imp
  enter on or after:  time edad_al_egres_imp
             weight:  [pweight=gomp_m_stag_or_ing_num_hij]

Fitting constant-only model:

Iteration 0:   log pseudolikelihood = -6696.1223  
Iteration 1:   log pseudolikelihood = -6025.7735  
Iteration 2:   log pseudolikelihood = -5957.0954  
Iteration 3:   log pseudolikelihood =  -5956.953  
Iteration 4:   log pseudolikelihood =  -5956.953  

Fitting full model:

Iteration 0:   log pseudolikelihood =  -5956.953  
Iteration 1:   log pseudolikelihood = -5890.7529  
Iteration 2:   log pseudolikelihood = -5890.1189  
Iteration 3:   log pseudolikelihood = -5890.1188  

Displaying weighted survival model with M-estimation standard errors

Gompertz PH regression                          Number of obs     =     62,500
                                                Wald chi2(1)      =      86.46
Log pseudolikelihood = -5890.1188               Prob > chi2       =     0.0000

---------------------------------------------------------------------------------------------
                            |            M-estimation
                         _t | Haz. Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------------------+----------------------------------------------------------------
motivodeegreso_mod_imp_rec2 |   1.573035   .0766373     9.30   0.000     1.429777    1.730647
                      _cons |   .1204473   .0096851   -26.32   0.000     .1028851    .1410075
----------------------------+----------------------------------------------------------------
                     /gamma |  -.0650709    .001865   -34.89   0.000    -.0687263   -.0614156
---------------------------------------------------------------------------------------------
Note: _cons estimates baseline hazard.

. estimates store gomp_stipw2

Given that the model with 2 degrees of freedom did not converge, we calculated the estimates with the second model with best AIC (3 degrees of freedom).

. 
. *______________________________________________
. *______________________________________________
. * ADJUSTED ROYSTON PARMAR - DF3,  STAGGERED ENTRY, BINARY TREATMENT (1-DROPOUT VS. 0-COMPLETION)
. 
. stipw (logit motivodeegreso_mod_imp_rec2 edad_al_ing_1 edad_ini_cons sex_enc esc_rec sus_prin_mod fr_sus_prin comp_biosoc ten
> _viv dg_cie_10_rec sud_severity_icd10 macrozone policonsumo n_off_vio n_off_acq n_off_sud), distribution(rp) df(3) genw(rpdf3
> _m_stag_ten_viv) ipwtype(stabilised) vce(mestimation) eform
11106 observations have missing treatment and/or missing confounder values and/or _st = 0.
These observations are excluded from the analysis, see variable _stipw_flag

Fitting logistic regression to obtain denominator for weights

Iteration 0:   log likelihood = -35121.799  
Iteration 1:   log likelihood =  -33484.63  
Iteration 2:   log likelihood = -33459.824  
Iteration 3:   log likelihood = -33459.806  
Iteration 4:   log likelihood = -33459.806  
Fitting second logistic regression with no confounders to obtain numerator for stabilised weights

Iteration 0:   log likelihood = -35121.799  
Iteration 1:   log likelihood = -35121.799  

Fitting weighted survival model to obtain point estimates
note: delayed entry models are being fitted

Iteration 0:   log pseudolikelihood = -5610.0407  (not concave)
Iteration 1:   log pseudolikelihood = -5539.2718  
Iteration 2:   log pseudolikelihood = -5529.4155  
Iteration 3:   log pseudolikelihood = -5519.5292  
Iteration 4:   log pseudolikelihood = -5518.0052  
Iteration 5:   log pseudolikelihood = -5516.3065  
Iteration 6:   log pseudolikelihood = -5515.8985  
Iteration 7:   log pseudolikelihood = -5515.7518  
Iteration 8:   log pseudolikelihood =  -5515.423  
Iteration 9:   log pseudolikelihood = -5515.3463  
Iteration 10:  log pseudolikelihood = -5515.3098  
Iteration 11:  log pseudolikelihood = -5515.2666  (not concave)
Iteration 12:  log pseudolikelihood = -5515.2646  
Iteration 13:  log pseudolikelihood = -5515.2559  
Iteration 14:  log pseudolikelihood = -5515.2505  
Iteration 15:  log pseudolikelihood = -5515.2501  

Displaying weighted survival model with M-estimation standard errors

Log pseudolikelihood = -5515.2501               Number of obs     =     59,757

---------------------------------------------------------------------------------------------
                            |            M-estimation
                            |     exp(b)   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------------------+----------------------------------------------------------------
xb                          |
motivodeegreso_mod_imp_rec2 |   1.611422   .0818826     9.39   0.000     1.458668    1.780173
                      _rcs1 |   1.086826    .036706     2.47   0.014     1.017213    1.161203
                      _rcs2 |   1.025681    .012305     2.11   0.035     1.001845    1.050084
                      _rcs3 |   1.002548   .0007403     3.45   0.001     1.001098       1.004
                      _cons |   1.176211   .4660035     0.41   0.682     .5410628    2.556955
---------------------------------------------------------------------------------------------
Note: Estimates are transformed only in the first equation.

. estimates store df3_stipw

. stipw (logit motivodeegreso_mod_imp_rec2 edad_al_ing_1 edad_ini_cons sex_enc esc_rec sus_prin_mod fr_sus_prin comp_biosoc ori
> gen_ingreso_mod numero_de_hijos_mod dg_cie_10_rec sud_severity_icd10 macrozone policonsumo n_off_vio n_off_acq n_off_sud), di
> stribution(rp) df(3) genw(rpdf3_m_stag_or_ing_num_hij) ipwtype(stabilised) vce(mestimation) eform
8361 observations have missing treatment and/or missing confounder values and/or _st = 0.
These observations are excluded from the analysis, see variable _stipw_flag

Fitting logistic regression to obtain denominator for weights

Iteration 0:   log likelihood = -36549.421  
Iteration 1:   log likelihood = -34737.642  
Iteration 2:   log likelihood = -34708.396  
Iteration 3:   log likelihood = -34708.373  
Iteration 4:   log likelihood = -34708.373  
Fitting second logistic regression with no confounders to obtain numerator for stabilised weights

Iteration 0:   log likelihood = -36549.421  
Iteration 1:   log likelihood = -36549.421  

Fitting weighted survival model to obtain point estimates
note: delayed entry models are being fitted

Iteration 0:   log pseudolikelihood = -5998.0505  
Iteration 1:   log pseudolikelihood = -5936.2125  
Iteration 2:   log pseudolikelihood = -5894.7933  
Iteration 3:   log pseudolikelihood = -5891.7206  
Iteration 4:   log pseudolikelihood = -5891.1581  
Iteration 5:   log pseudolikelihood = -5890.7076  
Iteration 6:   log pseudolikelihood = -5890.5856  
Iteration 7:   log pseudolikelihood = -5890.5416  
Iteration 8:   log pseudolikelihood = -5890.5181  
Iteration 9:   log pseudolikelihood = -5890.5176  
Iteration 10:  log pseudolikelihood = -5890.5149  
Iteration 11:  log pseudolikelihood = -5890.5148  

Displaying weighted survival model with M-estimation standard errors

Log pseudolikelihood = -5890.5148               Number of obs     =     62,502

---------------------------------------------------------------------------------------------
                            |            M-estimation
                            |     exp(b)   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------------------+----------------------------------------------------------------
xb                          |
motivodeegreso_mod_imp_rec2 |   1.579325   .0769329     9.38   0.000     1.435514    1.737543
                      _rcs1 |   1.118239   .0351403     3.56   0.000     1.051444    1.189278
                      _rcs2 |   1.035826   .0125568     2.90   0.004     1.011505    1.060732
                      _rcs3 |   1.002315   .0009006     2.57   0.010     1.000552    1.004082
                      _cons |   .9316145   .2545062    -0.26   0.795     .5453784    1.591383
---------------------------------------------------------------------------------------------
Note: Estimates are transformed only in the first equation.

. estimates store df3_stipw2

. qui count if _d == 1

.         // we count the amount of cases with the event in the strata
.         //we call the estimates stored, and the results...
. estimates stat df5_stipw gomp_stipw df3_stipw, n(`r(N)')

Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
   df5_stipw |      5,144          .  -5511.121       7   11036.24   11082.06
  gomp_stipw |      5,144  -5587.259  -5519.012       3   11044.02   11063.66
   df3_stipw |      5,144          .   -5515.25       5    11040.5   11073.23
-----------------------------------------------------------------------------

.         //we store in a matrix de survival
. matrix stats_stipw=r(S)

. 
. estwrite df5_stipw gomp_stipw df3_stipw df5_stipw2 gomp_stipw2 df3_stipw2 using "${pathdata2}parmodels_m2_stipw_22.sters", re
> place
(saving df5_stipw)
(saving gomp_stipw)
(saving df3_stipw)
(saving df5_stipw2)
(saving gomp_stipw2)
(saving df3_stipw2)
(file parmodels_m2_stipw_22.sters saved)

Saved at= 17:03:52 16 Feb 2023