Dear Statalist members,
I hope you are all doing well. I am working on a Stata project to analyze the evolution of the risk of having a child over four distinct periods defined in my dataset. However, I am encountering an error, particularly with the graphs, and I'm having trouble identifying the issue in my code.
The specific error message I am receiving is:
left and right boundary regions overlap;
specify smaller bandwidth(s) in width()
I would greatly appreciate any insights or suggestions on how to resolve this issue.
Thank you in advance for your help!
Here is the relevant portion of my programming:
generate byte TypeDeSortie=0 if AGEDC < 50
replace TypeDeSortie=1 if AGEDC >=50
label var TypeDeSortie "Type de sortie du groupe à risque"
label def TypeDeSortie 0 "Sans changement d'état" 1 "Par changement d'état"
label val TypeDeSortie TypeDeSortie
generate MomentDeLaSortie= min(50,AGEDC) if TypeDeSortie==1
replace MomentDeLaSortie= AGEDC if TypeDeSortie==0
label var MomentDeLaSortie "Fin de la portion de vie reproductive qui est analysée"
stset MomentDeLaSortie [pw=WGHT_PER], id(Matricule) failure(Naissance) origin(time 15) exit(time 50)
*********************** Segmentation by age group ***************************************
******************** Creation of the age class variable called 'T' **********************
gen age_max = min(49, AGEDC)
gen expander = age_max - 14
expand expander
by Matricule, sort: gen T = 14 + _n
forvalues age = 15/50 {
label define T `age' "`age'-`=`age'+1' ans", add
}
label values T T
drop age_max expander
order Matricule _t0 _t _st _d
gen Parite=0
forvalues i=1/3 {
replace Parite=`i' if floor(AGEparite`i') == T
}
*********************** Segmentation by births **********************************
************************************************** *******************************************
********* Fichier biographique selon les tranches d'âge d'une année avec l'avènement des naissances
forvalues i=1/3 {
stsplit bidon, at(0) after (AGEparite`i')
drop bidon
}
*********************** Segmentation by period ***************************************
************************************************** *******************************************
// Segmentation for the 1st period
stsplit bidon, at(0) after(agefinp0)
drop bidon
// Segmentation for the 3 other periods
forvalues i=1/3 {
stsplit bidon, at(0) after(agedebp`i')
drop bidon
stsplit bidon, at(0) after(agefinp`i')
drop bidon
}
gen byte periode = .
replace periode = 0 if float(_t)<=float(agefinp0-15)
forvalues i = 1/3 {
replace periode = `i' if float(_t0)>=float(agedebp`i'-15) & float(_t)<=float(agefinp`i'-15)
}
forvalues i = 0/2 {
replace periode = `i'+1 if float(_t0)>=float(agefinp`i'-15) & float(_t)<=float(agedebp`=`i' + 1'-15)
*** Regression
poisson _d ibn.T i.P_Servgard_vs_RQAP##i.Traitement, exposure(TempsÀRisque) irr vce(cluster Matricule) noconstant
estimates store DDQ_Servgard_vs_RQAP
poisson _d c.T c.T#c.T i.P_Servgard_vs_RQAP##i.Traitement, exposure(TempsÀRisque) irr vce(cluster Matricule)
estimates store DDC_Servgard_vs_RQAP
matrix b = get(_b)
matrix V = get(VCE)
matrix V = V*1.58
ereturn post b V
ereturn display, eform(IRR)
}
*** graph
sts graph if Traitement == 1, hazard by(P_Servgard_vs_RQAP) name(P_Servgard_vs_RQAP) ///
title(" XYXYXY ") ///
xtitle("Nombre d'années écoulées depuis le quinzième anniversaire") ///
legend(col(3) rowgap(*.25) symxsize(*.25) size(*.75)) ///
note(" ") ///
I hope you are all doing well. I am working on a Stata project to analyze the evolution of the risk of having a child over four distinct periods defined in my dataset. However, I am encountering an error, particularly with the graphs, and I'm having trouble identifying the issue in my code.
The specific error message I am receiving is:
left and right boundary regions overlap;
specify smaller bandwidth(s) in width()
I would greatly appreciate any insights or suggestions on how to resolve this issue.
Thank you in advance for your help!
Here is the relevant portion of my programming:
generate byte TypeDeSortie=0 if AGEDC < 50
replace TypeDeSortie=1 if AGEDC >=50
label var TypeDeSortie "Type de sortie du groupe à risque"
label def TypeDeSortie 0 "Sans changement d'état" 1 "Par changement d'état"
label val TypeDeSortie TypeDeSortie
generate MomentDeLaSortie= min(50,AGEDC) if TypeDeSortie==1
replace MomentDeLaSortie= AGEDC if TypeDeSortie==0
label var MomentDeLaSortie "Fin de la portion de vie reproductive qui est analysée"
stset MomentDeLaSortie [pw=WGHT_PER], id(Matricule) failure(Naissance) origin(time 15) exit(time 50)
*********************** Segmentation by age group ***************************************
******************** Creation of the age class variable called 'T' **********************
gen age_max = min(49, AGEDC)
gen expander = age_max - 14
expand expander
by Matricule, sort: gen T = 14 + _n
forvalues age = 15/50 {
label define T `age' "`age'-`=`age'+1' ans", add
}
label values T T
drop age_max expander
order Matricule _t0 _t _st _d
gen Parite=0
forvalues i=1/3 {
replace Parite=`i' if floor(AGEparite`i') == T
}
*********************** Segmentation by births **********************************
************************************************** *******************************************
********* Fichier biographique selon les tranches d'âge d'une année avec l'avènement des naissances
forvalues i=1/3 {
stsplit bidon, at(0) after (AGEparite`i')
drop bidon
}
*********************** Segmentation by period ***************************************
************************************************** *******************************************
// Segmentation for the 1st period
stsplit bidon, at(0) after(agefinp0)
drop bidon
// Segmentation for the 3 other periods
forvalues i=1/3 {
stsplit bidon, at(0) after(agedebp`i')
drop bidon
stsplit bidon, at(0) after(agefinp`i')
drop bidon
}
gen byte periode = .
replace periode = 0 if float(_t)<=float(agefinp0-15)
forvalues i = 1/3 {
replace periode = `i' if float(_t0)>=float(agedebp`i'-15) & float(_t)<=float(agefinp`i'-15)
}
forvalues i = 0/2 {
replace periode = `i'+1 if float(_t0)>=float(agefinp`i'-15) & float(_t)<=float(agedebp`=`i' + 1'-15)
*** Regression
poisson _d ibn.T i.P_Servgard_vs_RQAP##i.Traitement, exposure(TempsÀRisque) irr vce(cluster Matricule) noconstant
estimates store DDQ_Servgard_vs_RQAP
poisson _d c.T c.T#c.T i.P_Servgard_vs_RQAP##i.Traitement, exposure(TempsÀRisque) irr vce(cluster Matricule)
estimates store DDC_Servgard_vs_RQAP
matrix b = get(_b)
matrix V = get(VCE)
matrix V = V*1.58
ereturn post b V
ereturn display, eform(IRR)
}
*** graph
sts graph if Traitement == 1, hazard by(P_Servgard_vs_RQAP) name(P_Servgard_vs_RQAP) ///
title(" XYXYXY ") ///
xtitle("Nombre d'années écoulées depuis le quinzième anniversaire") ///
legend(col(3) rowgap(*.25) symxsize(*.25) size(*.75)) ///
note(" ") ///