data <- read.csv("https://raw.githubusercontent.com/PrisonRodeo/PLSC504-2023-git/main/Exercises/PLSC504-2023-ExerciseSix.csv")
survModel <- survival::survfit(data = data, survival::Surv(time = data$TenureStart, time2 = data$TenureEnd, event = data$LeftOffice) ~ Female + LatinAm)
plot(survModel,xlab="Time (in months)",
ylab="Survival Estimate",
lwd=c(3,1,1))
summary(survModel)
Call: survfit(formula = survival::Surv(time = data$TenureStart, time2 = data$TenureEnd,
event = data$LeftOffice) ~ Female + LatinAm, data = data)
Female=0, LatinAm=0
time n.risk n.event survival std.err lower 95% CI upper 95% CI
1 1653 507 0.69328 0.01134 0.671408 0.71587
2 2315 648 0.49923 0.01042 0.479217 0.52007
3 1531 258 0.41510 0.00989 0.396154 0.43495
4 1217 193 0.34927 0.00939 0.331340 0.36817
5 1004 211 0.27587 0.00867 0.259385 0.29339
6 770 135 0.22750 0.00809 0.212187 0.24392
7 596 98 0.19009 0.00759 0.175784 0.20557
8 468 45 0.17181 0.00733 0.158027 0.18680
9 412 35 0.15722 0.00711 0.143878 0.17180
10 365 35 0.14214 0.00687 0.129292 0.15627
11 333 37 0.12635 0.00658 0.114087 0.13993
12 274 26 0.11436 0.00636 0.102545 0.12754
13 244 18 0.10592 0.00620 0.094450 0.11879
14 223 14 0.09927 0.00606 0.088085 0.11188
15 211 26 0.08704 0.00577 0.076443 0.09911
16 174 11 0.08154 0.00564 0.071209 0.09337
17 163 14 0.07453 0.00545 0.064578 0.08603
18 145 10 0.06939 0.00531 0.059724 0.08063
19 134 14 0.06214 0.00510 0.052912 0.07299
20 118 6 0.05898 0.00500 0.049954 0.06965
21 107 4 0.05678 0.00493 0.047888 0.06732
22 101 7 0.05284 0.00481 0.044208 0.06317
23 95 4 0.05062 0.00474 0.042139 0.06081
24 88 5 0.04774 0.00464 0.039466 0.05776
25 81 5 0.04480 0.00453 0.036734 0.05463
26 80 7 0.04088 0.00437 0.033144 0.05041
27 69 8 0.03614 0.00417 0.028815 0.04532
28 56 4 0.03356 0.00407 0.026454 0.04256
29 53 4 0.03102 0.00396 0.024163 0.03983
30 52 4 0.02864 0.00383 0.022037 0.03721
31 48 6 0.02506 0.00362 0.018882 0.03325
32 40 4 0.02255 0.00347 0.016686 0.03048
33 35 2 0.02126 0.00339 0.015563 0.02905
34 33 4 0.01869 0.00321 0.013342 0.02617
35 27 2 0.01730 0.00312 0.012152 0.02463
36 25 2 0.01592 0.00302 0.010976 0.02308
37 21 2 0.01440 0.00292 0.009685 0.02142
38 19 1 0.01364 0.00286 0.009048 0.02057
39 18 2 0.01213 0.00273 0.007795 0.01887
40 13 1 0.01119 0.00268 0.007004 0.01789
41 13 1 0.01033 0.00261 0.006302 0.01694
43 11 1 0.00939 0.00253 0.005537 0.01594
45 11 1 0.00854 0.00244 0.004875 0.01496
47 10 2 0.00683 0.00223 0.003600 0.01297
48 7 1 0.00586 0.00212 0.002883 0.01189
49 7 2 0.00418 0.00181 0.001789 0.00978
50 4 1 0.00314 0.00163 0.001131 0.00870
51 4 1 0.00235 0.00140 0.000733 0.00756
57 3 1 0.00157 0.00113 0.000381 0.00646
69 1 1 0.00000 NaN NA NA
Female=0, LatinAm=1
time n.risk n.event survival std.err lower 95% CI upper 95% CI
1 216 71 0.67130 0.03196 0.61149 0.7370
2 336 68 0.53544 0.02943 0.48075 0.5964
3 254 30 0.47220 0.02813 0.42016 0.5307
4 220 22 0.42498 0.02706 0.37512 0.4815
5 236 83 0.27552 0.02196 0.23567 0.3221
6 112 27 0.20910 0.02004 0.17328 0.2523
7 70 23 0.14039 0.01786 0.10941 0.1801
8 45 7 0.11855 0.01688 0.08968 0.1567
9 40 7 0.09781 0.01564 0.07149 0.1338
10 31 5 0.08203 0.01462 0.05784 0.1163
11 24 3 0.07178 0.01394 0.04905 0.1050
12 19 1 0.06800 0.01371 0.04580 0.1010
13 21 4 0.05505 0.01254 0.03523 0.0860
14 15 3 0.04404 0.01153 0.02636 0.0736
15 10 1 0.03963 0.01118 0.02280 0.0689
16 10 1 0.03567 0.01075 0.01976 0.0644
17 9 2 0.02774 0.00971 0.01397 0.0551
20 6 1 0.02312 0.00913 0.01067 0.0501
23 6 1 0.01927 0.00838 0.00821 0.0452
25 4 1 0.01445 0.00754 0.00519 0.0402
32 3 1 0.00963 0.00638 0.00263 0.0353
35 3 1 0.00642 0.00500 0.00140 0.0295
Female=1, LatinAm=0
time n.risk n.event survival std.err lower 95% CI upper 95% CI
1 20 4 0.800 0.0894 0.6426 0.996
2 27 4 0.681 0.0938 0.5204 0.892
3 24 4 0.568 0.0938 0.4109 0.785
4 21 3 0.487 0.0913 0.3370 0.703
6 16 5 0.335 0.0844 0.2041 0.549
7 7 2 0.239 0.0831 0.1210 0.472
8 5 1 0.191 0.0790 0.0851 0.430
12 3 1 0.127 0.0741 0.0408 0.398
13 1 1 0.000 NaN NA NA
Female=1, LatinAm=1
time n.risk n.event survival std.err lower 95% CI upper 95% CI
2 4 1 0.750 0.217 0.4259 1
8 2 1 0.375 0.286 0.0839 1
For men not in Latin America, the chance a leader stays in office for a month is 69%. At 5 months this decreases to 27%, and at 10 months it decreases to 15%. For women outside Latin America, the chance a leader stays in office for a month is 80%; 48% for 4 months, and 12% for a year. For men in Latin America, the chance a leader stays in office for a month is 67%; 27% for 5 months; and 8% for 10 months. For women in Latin America, there is not enough data.
coxModel <- survival::coxph(data = data, survival::Surv(time = data$TenureStart, time2 = data$TenureEnd, event = data$LeftOffice) ~ Female + LatinAm)
summary(coxModel)
Call:
survival::coxph(formula = survival::Surv(time = data$TenureStart,
time2 = data$TenureEnd, event = data$LeftOffice) ~ Female +
LatinAm, data = data)
n= 15446, number of events= 2821
coef exp(coef) se(coef) z Pr(>|z|)
Female -0.23922 0.78724 0.19350 -1.236 0.216
LatinAm 0.05103 1.05236 0.05640 0.905 0.366
exp(coef) exp(-coef) lower .95 upper .95
Female 0.7872 1.2703 0.5388 1.150
LatinAm 1.0524 0.9502 0.9422 1.175
Concordance= 0.497 (se = 0.004 )
Likelihood ratio test= 2.49 on 2 df, p=0.3
Wald test = 2.37 on 2 df, p=0.3
Score (logrank) test = 2.38 on 2 df, p=0.3
The hazard model displays the risk of leaving office. In this case, the model shows that women are less likely to be removed from office, and Latin American leaders are more likely to be removed. Being female reduces the hazard by a factor of .78, or 22%. Likewise, Latin America increases the hazard by a factor of 1.05, or 5% (?).