Risk Analysis of Covid-19 Patient Mortality Using Extended Cox Model


Survival analysis is a collection of methods for evaluate data related to time from start to finish a special event (can be death/recovery) with given censorship status to be a comparison of endurance ability human life (Cread,2020).
Based on this definition, this study chose survival analysis to determine the cause of death of COVID-19 patients. This study used data on Covid-19 patients obtained from the Mexican Government, with response variables, namely time and status (censored or not) and predictor variables, namely patient laboratory results. in the form of a history of illness that has been suffered by a Covid-19 patient. The data to be analyzed is too large and heterogeneous, so clustering is carried out using the K-Means Clustering algorithm. certain clusters and clarify conclusions. After clustering the data on COVID-19 patients, it was continued by conducting a survival analysis on the two clusters that were formed, namely applying the extended cox model which was estimated using the Breslow partial likelihood method and finally the model suitability test was carried out.
This research on the risk analysis of the death of Covid-19 patients is expected to provide insight into the factors that influence the death of Covid-19 patients so as to assist medical personnel in providing appropriate treatment for patients who have these factors. The following is a flowchart of this research

1. Data Preparation

At this stage, it is done preparing the library used and importing data for this research

library(lubridate)
library(survival)
library(survminer)
library(ggplot2)
library(dplyr)
library(factoextra)
library(FactoMineR)
CovidData<-read.csv2("covid.csv")
head(CovidData)
        id sex patient_type entry_date date_symptoms  date_died intubed
1   1636bf   0            2 12/01/2020    09/01/2020 13/01/2020       1
2 7.98E+02   0            2 12/01/2020    12/01/2020 14/01/2020       2
3   1673d6   1            2 13/01/2020    10/01/2020 15/01/2020       2
4   1045fa   1            2 12/01/2020    12/01/2020 29/01/2020       2
5   1abb1c   1            2 12/01/2020    04/01/2020 30/01/2020       2
6   09ab8c   0            2 06/02/2020    05/02/2020 08/02/2020       2
  pneumonia age pregnancy diabetes copd asthma inmsupr hypertension
1         1  48         0        0    0      0       0            0
2         1  74         0        0    0      0       0            0
3         1  45         0       98    0     98      98            0
4         1  75         0        0    0      0       0            1
5         1  54         0        1    0      0       0            0
6         1  55         0        0    1      1       0            1
  other_disease cardiovascular obesity renal_chronic tobacco
1             2              0       0             0       0
2             2              1       0             0       1
3             2              0       0             0       0
4             1              0       1             0       0
5             2              0       1             0       0
6             2              1       1             0       0
  contact_other_covid covid_res icu
1                  99         2   2
2                  99         2   2
3                  99         2   1
4                  99         2   2
5                  99         2   1
6                  99         2   1

2. Data Identification

In this study, we did not use all the columns in the covid data, so we discarded unneeded variables by subsetting.

CovidData=CovidData[,-c(1,3,4,7,16,21,22,23)]

The following is a description of each column:
1. Sex: Identifies the sex of the patient (0: male & 1: female).
2. date_symptoms: Identifies the date on which the patient’s symptoms began.
3. data_died: Identifies the date the patient died.
4. pneumonia:Identifies if the patient was diagnosed with pneumonia (0: No & 1: yes).
5. age: Identifies the age of the patient.
6. pregnancy: Identifies if the patient is pregnant (0:No & 1:Yes).
7. diabetes: Identifies if the patient has a diagnosis of diabetes (0: No & 1: Yes).
8. copd: Identifies if the patient has a diagnosis of Chronic obstructive pulmonary disease (COPD) (0: No & 1:Yes).
9. asthma: Identifies if the patient has a diagnosis of asthma (0: No & 1: Yes).
10. inmsupr:Identifies if the patient has immunosuppression (0: No & 1: Yes) 11. hypertension:Identifies if the patient has a diagnosis of hypertension (0:No & 1:Yes).
12. cardiovascular: Identifies if the patient has a diagnosis of cardiovascular disease (0: No & 1: Yes).
13. obesity: Identifies if the patient is diagnosed with obesity (0: No & 1: Yes).
14. renal_chronic: Identifies if the patient has a diagnosis of chronic kidney failure (0: No & 1: Yes).
15. tobacco: Identifies if the patient is a tobacco user (0: No & 1: Yes).

3. Data Acquistion

Data acquistion is done so that the data format is in accordance with the objectives of the analysis.

3.1. Check Type Data

str(CovidData)
'data.frame':   125650 obs. of  15 variables:
 $ sex           : int  0 0 1 1 1 0 0 1 1 0 ...
 $ date_symptoms : chr  "09/01/2020" "12/01/2020" "10/01/2020" "12/01/2020" ...
 $ date_died     : chr  "13/01/2020" "14/01/2020" "15/01/2020" "29/01/2020" ...
 $ pneumonia     : int  1 1 1 1 1 1 1 1 1 1 ...
 $ age           : int  48 74 45 75 54 55 63 68 32 15 ...
 $ pregnancy     : int  0 0 0 0 0 0 0 0 0 0 ...
 $ diabetes      : int  0 0 98 0 1 0 0 0 0 0 ...
 $ copd          : int  0 0 0 0 0 1 0 0 0 0 ...
 $ asthma        : int  0 0 98 0 0 1 0 0 0 0 ...
 $ inmsupr       : int  0 0 98 0 0 0 0 0 1 0 ...
 $ hypertension  : int  0 0 0 1 0 1 1 1 1 0 ...
 $ cardiovascular: int  0 1 0 0 0 1 0 0 0 0 ...
 $ obesity       : int  0 0 0 1 1 1 0 1 0 0 ...
 $ renal_chronic : int  0 0 0 0 0 0 0 0 1 0 ...
 $ tobacco       : int  0 1 0 0 0 0 0 0 0 0 ...

Note the results of the type check above, date_symptoms and date_died are still in chr form, they should be in the form of date. the variables pneumonia, pregnancy, diabetes, copd, asthma, inmsupr, hypertension, cardiovascular, obesity, renal_chronic, tobaco should also be in factor form but because doing survival analysis can be directly identified so that no need be changed into the form of factor data type.

CovidData$date_died <- as.Date(CovidData$date_died, format = "%d/%m/%y")
CovidData$date_symptoms <- as.Date(CovidData$date_symptoms, format = "%d/%m/%y")
str(CovidData)
'data.frame':   125650 obs. of  15 variables:
 $ sex           : int  0 0 1 1 1 0 0 1 1 0 ...
 $ date_symptoms : Date, format: "2020-01-09" "2020-01-12" ...
 $ date_died     : Date, format: "2020-01-13" "2020-01-14" ...
 $ pneumonia     : int  1 1 1 1 1 1 1 1 1 1 ...
 $ age           : int  48 74 45 75 54 55 63 68 32 15 ...
 $ pregnancy     : int  0 0 0 0 0 0 0 0 0 0 ...
 $ diabetes      : int  0 0 98 0 1 0 0 0 0 0 ...
 $ copd          : int  0 0 0 0 0 1 0 0 0 0 ...
 $ asthma        : int  0 0 98 0 0 1 0 0 0 0 ...
 $ inmsupr       : int  0 0 98 0 0 0 0 0 1 0 ...
 $ hypertension  : int  0 0 0 1 0 1 1 1 1 0 ...
 $ cardiovascular: int  0 1 0 0 0 1 0 0 0 0 ...
 $ obesity       : int  0 0 0 1 1 1 0 1 0 0 ...
 $ renal_chronic : int  0 0 0 0 0 0 0 0 1 0 ...
 $ tobacco       : int  0 1 0 0 0 0 0 0 0 0 ...

3.2. Feature Engineering

building the column time as the response variable in this study, this variable is obtained from the date of death of the patient minus the date when he was first positive for Covid-19. mathematically written as follows:

\[ waktu = datedied - date symptoms \]

CovidData$waktu<-CovidData$date_died - CovidData$date_symptoms
#lalu diubah ketipe data integer
CovidData$waktu<-as.integer(CovidData$waktu)
head(CovidData)
  sex date_symptoms  date_died pneumonia age pregnancy diabetes copd asthma
1   0    2020-01-09 2020-01-13         1  48         0        0    0      0
2   0    2020-01-12 2020-01-14         1  74         0        0    0      0
3   1    2020-01-10 2020-01-15         1  45         0       98    0     98
4   1    2020-01-12 2020-01-29         1  75         0        0    0      0
5   1    2020-01-04 2020-01-30         1  54         0        1    0      0
6   0    2020-02-05 2020-02-08         1  55         0        0    1      1
  inmsupr hypertension cardiovascular obesity renal_chronic tobacco waktu
1       0            0              0       0             0       0     4
2       0            0              1       0             0       1     2
3      98            0              0       0             0       0     5
4       0            1              0       1             0       0    17
5       0            0              0       1             0       0    26
6       0            1              1       1             0       0     3

Then make the column status as the response variable in this study

CovidData = CovidData %>%
        mutate(status = ifelse(is.na(waktu), 0, 1))
head(CovidData)
  sex date_symptoms  date_died pneumonia age pregnancy diabetes copd asthma
1   0    2020-01-09 2020-01-13         1  48         0        0    0      0
2   0    2020-01-12 2020-01-14         1  74         0        0    0      0
3   1    2020-01-10 2020-01-15         1  45         0       98    0     98
4   1    2020-01-12 2020-01-29         1  75         0        0    0      0
5   1    2020-01-04 2020-01-30         1  54         0        1    0      0
6   0    2020-02-05 2020-02-08         1  55         0        0    1      1
  inmsupr hypertension cardiovascular obesity renal_chronic tobacco waktu
1       0            0              0       0             0       0     4
2       0            0              1       0             0       1     2
3      98            0              0       0             0       0     5
4       0            1              0       1             0       0    17
5       0            0              0       1             0       0    26
6       0            1              1       1             0       0     3
  status
1      1
2      1
3      1
4      1
5      1
6      1

4. Data Filtering

At the data filtering stage, checking for missing values ​​and outliers is carried out.

3.1 Check missing value

anyNA(CovidData)
[1] TRUE

3.2 Check Outlier

boxplot(CovidData)

5. Data Validation

The presence of a missing value in the time column then inputs the missing value by filling in the empty value of 95 because the maximum value of the ‘time’ variable is 93 days so it is rounded up to 95 days. So the time that is worth 95 is the patient who can survive.

CovidData$waktu[is.na(CovidData$waktu)] <- 95
head(CovidData)
  sex date_symptoms  date_died pneumonia age pregnancy diabetes copd asthma
1   0    2020-01-09 2020-01-13         1  48         0        0    0      0
2   0    2020-01-12 2020-01-14         1  74         0        0    0      0
3   1    2020-01-10 2020-01-15         1  45         0       98    0     98
4   1    2020-01-12 2020-01-29         1  75         0        0    0      0
5   1    2020-01-04 2020-01-30         1  54         0        1    0      0
6   0    2020-02-05 2020-02-08         1  55         0        0    1      1
  inmsupr hypertension cardiovascular obesity renal_chronic tobacco waktu
1       0            0              0       0             0       0     4
2       0            0              1       0             0       1     2
3      98            0              0       0             0       0     5
4       0            1              0       1             0       0    17
5       0            0              0       1             0       0    26
6       0            1              1       1             0       0     3
  status
1      1
2      1
3      1
4      1
5      1
6      1

The data on age is very diverse, so it is necessary to create a new column to group the age variable into old and young age. According to WHO, a person is said to be young when the age is less than or equal to 55 years and is said to be old when more than 55 years.

CovidData = CovidData %>%
        mutate(Age = ifelse(age <= 55, 0, 1))
CovidData = CovidData[,-c(2,3,5)]
head(CovidData)
  sex pneumonia pregnancy diabetes copd asthma inmsupr hypertension
1   0         1         0        0    0      0       0            0
2   0         1         0        0    0      0       0            0
3   1         1         0       98    0     98      98            0
4   1         1         0        0    0      0       0            1
5   1         1         0        1    0      0       0            0
6   0         1         0        0    1      1       0            1
  cardiovascular obesity renal_chronic tobacco waktu status Age
1              0       0             0       0     4      1   0
2              1       0             0       1     2      1   1
3              0       0             0       0     5      1   0
4              0       1             0       0    17      1   1
5              0       1             0       0    26      1   0
6              1       1             0       0     3      1   0

6. Data Cleaning

The next step is to delete outlier data in the columns pregnancy, copd, asthma, inmsupr, hypertension, cardiovascular, obesity, renal chronic, tobacco,pneumonia , diabetes and waktu.

CovidData <- subset(CovidData, pregnancy!= 98)
CovidData <- subset(CovidData, copd!= 98)
CovidData <- subset(CovidData, asthma!= 98)
CovidData <- subset(CovidData, inmsupr!= 98)
CovidData <- subset(CovidData, hypertension!= 98)
CovidData <- subset(CovidData, cardiovascular!= 98)
CovidData <- subset(CovidData, obesity!= 98)
CovidData <- subset(CovidData, renal_chronic!= 98)
CovidData <- subset(CovidData, tobacco!= 98)
CovidData <- subset(CovidData, pneumonia!= 99)
CovidData <- subset(CovidData, diabetes!= 98)
CovidData <- subset(CovidData, waktu > 0)
head(CovidData)
  sex pneumonia pregnancy diabetes copd asthma inmsupr hypertension
1   0         1         0        0    0      0       0            0
2   0         1         0        0    0      0       0            0
4   1         1         0        0    0      0       0            1
5   1         1         0        1    0      0       0            0
6   0         1         0        0    1      1       0            1
7   0         1         0        0    0      0       0            1
  cardiovascular obesity renal_chronic tobacco waktu status Age
1              0       0             0       0     4      1   0
2              1       0             0       1     2      1   1
4              0       1             0       0    17      1   1
5              0       1             0       0    26      1   0
6              1       1             0       0     3      1   0
7              0       0             0       0    14      1   1

7. Scaling

CovidDataScale = scale(CovidData)
head(CovidDataScale)
         sex pneumonia   pregnancy   diabetes       copd     asthma    inmsupr
1 -0.8752406  1.438927 -0.07518716 -0.5025649 -0.1616108 -0.1652522 -0.1387816
2 -0.8752406  1.438927 -0.07518716 -0.5025649 -0.1616108 -0.1652522 -0.1387816
4  1.1425337  1.438927 -0.07518716 -0.5025649 -0.1616108 -0.1652522 -0.1387816
5  1.1425337  1.438927 -0.07518716  1.9897767 -0.1616108 -0.1652522 -0.1387816
6 -0.8752406  1.438927 -0.07518716 -0.5025649  6.1876555  6.0513084 -0.1387816
7 -0.8752406  1.438927 -0.07518716 -0.5025649 -0.1616108 -0.1652522 -0.1387816
  hypertension cardiovascular    obesity renal_chronic    tobacco     waktu
1   -0.5659387     -0.1788443 -0.5017843    -0.1858564 -0.2973432 -1.764437
2   -0.5659387      5.5914099 -0.5017843    -0.1858564  3.3630899 -1.817003
4    1.7669615     -0.1788443  1.9928722    -0.1858564 -0.2973432 -1.422758
5   -0.5659387     -0.1788443  1.9928722    -0.1858564 -0.2973432 -1.186211
6    1.7669615      5.5914099  1.9928722    -0.1858564 -0.2973432 -1.790720
7    1.7669615     -0.1788443 -0.5017843    -0.1858564 -0.2973432 -1.501607
   status        Age
1 1.58511 -0.7196612
2 1.58511  1.3895316
4 1.58511  1.3895316
5 1.58511 -0.7196612
6 1.58511 -0.7196612
7 1.58511  1.3895316

8. Clustering Data

8.1 K-optimum Selection

The selection of optimum k is done objectively by using visualization elbow method.

kmeansTunning <- function(data, maxK) {
  withinall <- NULL
  total_k <- NULL
  for (i in 2:maxK) {
    set.seed(40)
    temp <- kmeans(data,i)$tot.withinss
    withinall <- append(withinall, temp)
    total_k <- append(total_k,i)
  }
  plot(x = total_k, y = withinall, type = "o", xlab = "Number of Cluster", ylab = "Total wss")
  abline(h = 1080, col  = "firebrick3", lty = 2)
}
kmeansTunning(CovidDataScale, maxK = 10)
Based on the existing output, the Elbow method with a K value that drops drastically and forms an elbow is found at \(K=3\) and \(K43\). The following is an application of the k-means algorithm with the optimum k equal to 3

8.2 K-means Algoritma

RNGkind(sample.kind = "Rounding")
set.seed(10000)
clusterDataCovid <- kmeans(x = CovidDataScale, centers = 3)
str(clusterDataCovid)
List of 9
 $ cluster     : Named int [1:123991] 3 2 3 3 3 3 3 3 3 3 ...
  ..- attr(*, "names")= chr [1:123991] "1" "2" "4" "5" ...
 $ centers     : num [1:3, 1:15] 0.0961 -0.3659 -0.1185 -0.3816 0.0789 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:3] "1" "2" "3"
  .. ..$ : chr [1:15] "sex" "pneumonia" "pregnancy" "diabetes" ...
 $ totss       : num 1859850
 $ withinss    : num [1:3] 696938 168998 564143
 $ tot.withinss: num 1430079
 $ betweenss   : num 429771
 $ size        : int [1:3] 80039 10054 33898
 $ iter        : int 2
 $ ifault      : int 0
 - attr(*, "class")= chr "kmeans"

8.3 Cluster profiling

CovidData$cluster <- as.factor(clusterDataCovid$cluster)
head(CovidData)
  sex pneumonia pregnancy diabetes copd asthma inmsupr hypertension
1   0         1         0        0    0      0       0            0
2   0         1         0        0    0      0       0            0
4   1         1         0        0    0      0       0            1
5   1         1         0        1    0      0       0            0
6   0         1         0        0    1      1       0            1
7   0         1         0        0    0      0       0            1
  cardiovascular obesity renal_chronic tobacco waktu status Age cluster
1              0       0             0       0     4      1   0       3
2              1       0             0       1     2      1   1       2
4              0       1             0       0    17      1   1       3
5              0       1             0       0    26      1   0       3
6              1       1             0       0     3      1   0       3
7              0       0             0       0    14      1   1       3
CovidProfile <- CovidData %>% 
  group_by(cluster) %>% 
  summarise_all(.funs = "mean")
CovidProfile
# A tibble: 3 x 16
  cluster   sex pneumonia pregnancy diabetes    copd asthma inmsupr hypertension
  <fct>   <dbl>     <dbl>     <dbl>    <dbl>   <dbl>  <dbl>   <dbl>        <dbl>
1 1       0.481     0.147   0.00800    0.117 0.00848 0.0292 0.00980        0.153
2 2       0.252     0.363   0.00149    0.226 0.0740  0.0278 0.0261         0.263
3 3       0.375     0.737   0.00124    0.395 0.0511  0.0201 0.0383         0.448
# ... with 7 more variables: cardiovascular <dbl>, obesity <dbl>,
#   renal_chronic <dbl>, tobacco <dbl>, waktu <dbl>, status <dbl>, Age <dbl>
CovidProfile %>% 
  tidyr::pivot_longer(-cluster) %>% 
  group_by(name) %>% 
  summarize(cluster_min_val = which.min(value),
            cluster_max_val = which.max(value))
# A tibble: 15 x 3
   name           cluster_min_val cluster_max_val
   <chr>                    <int>           <int>
 1 Age                          1               3
 2 asthma                       3               1
 3 cardiovascular               1               3
 4 copd                         1               2
 5 diabetes                     1               3
 6 hypertension                 1               3
 7 inmsupr                      1               3
 8 obesity                      1               2
 9 pneumonia                    1               3
10 pregnancy                    3               1
11 renal_chronic                1               3
12 sex                          2               1
13 status                       1               3
14 tobacco                      1               2
15 waktu                        3               1

8.3 Visualize clustering

library(factoextra)
fviz_cluster(object = clusterDataCovid,
             data = CovidDataScale,
             legend = "right",geom = "point")

9. Analisis Survival

Survival analysis will be applied to 3 clusters, namely cluster 2 and cluster 3. Cluster 1 is not included because in cluster 1 almost all patients survived while in this study the event was death.

9.1 Cluster 1

DataCluster1 <- CovidData%>% 
  filter(cluster == 1)

DataCluster1[,c("sex","pneumonia","pregnancy","diabetes","copd","asthma","inmsupr","hypertension","cardiovascular","obesity","renal_chronic","tobacco","status","Age")] <- lapply(DataCluster1[,c("sex","pneumonia","pregnancy","diabetes","copd","asthma","inmsupr","hypertension","cardiovascular","obesity","renal_chronic","tobacco","status","Age")],as.factor)

summary(DataCluster1)
 sex       pneumonia pregnancy diabetes  copd      asthma    inmsupr  
 0:41507   0:68285   0:79399   0:70689   0:79360   0:77704   0:79255  
 1:38532   1:11754   1:  640   1: 9350   1:  679   1: 2335   1:  784  
                                                                      
                                                                      
                                                                      
                                                                      
 hypertension cardiovascular obesity   renal_chronic tobacco       waktu      
 0:67796      0:78898        0:65841   0:79223       0:80039   Min.   :36.00  
 1:12243      1: 1141        1:14198   1:  816                 1st Qu.:95.00  
                                                               Median :95.00  
                                                               Mean   :94.99  
                                                               3rd Qu.:95.00  
                                                               Max.   :95.00  
 status    Age       cluster  
 0:80020   0:64128   1:80039  
 1:   19   1:15911   2:    0  
                     3:    0  
                              
                              
                              

9.2 Cluster 2

DataCluster2 <- CovidData%>% 
  filter(cluster == 2)

DataCluster2[,c("sex","pneumonia","pregnancy","diabetes","copd","asthma","inmsupr","hypertension","cardiovascular","obesity","renal_chronic","status","tobacco","Age")] <- lapply(DataCluster2[,c("sex","pneumonia","pregnancy","diabetes","copd","asthma","inmsupr","hypertension","cardiovascular","obesity","renal_chronic","status","tobacco","Age")],as.factor)

summary(DataCluster2)
 sex      pneumonia pregnancy diabetes copd     asthma   inmsupr  hypertension
 0:7516   0:6408    0:10039   0:7783   0:9310   0:9774   0:9792   0:7413      
 1:2538   1:3646    1:   15   1:2271   1: 744   1: 280   1: 262   1:2641      
                                                                              
                                                                              
                                                                              
                                                                              
 cardiovascular obesity  renal_chronic tobacco       waktu       status  
 0:9527         0:7119   0:9617        1:10054   Min.   : 1.00   0:6796  
 1: 527         1:2935   1: 437                  1st Qu.:15.00   1:3258  
                                                 Median :95.00           
                                                 Mean   :67.89           
                                                 3rd Qu.:95.00           
                                                 Max.   :95.00           
 Age      cluster  
 0:6412   1:    0  
 1:3642   2:10054  
          3:    0  
                   
                   
                   
DataCluster2<- CovidData %>% 
  filter(cluster == 2) 
head(DataCluster2)
  sex pneumonia pregnancy diabetes copd asthma inmsupr hypertension
1   0         1         0        0    0      0       0            0
2   1         1         0        0    0      0       0            1
3   0         1         0        0    0      1       1            1
4   0         0         0        0    0      0       0            1
5   0         1         0        1    0      0       0            1
6   0         1         0        0    0      0       0            1
  cardiovascular obesity renal_chronic tobacco waktu status Age cluster
1              1       0             0       1     2      1   1       2
2              0       1             0       1     9      1   1       2
3              0       0             0       1    22      1   0       2
4              0       0             0       1    11      1   1       2
5              0       0             0       1     4      1   1       2
6              0       1             0       1    10      1   1       2

Before applying the extended cox model, it is necessary to test whether all variables are independent of time. There are two approaches to the proportional hazard assumption test, namely the graphical approach and the GOF approach.

a. Pendekatan Grafik

Variabel sex
fit<-survfit(Surv(waktu,status)~ sex, data=DataCluster2)
ggsurvplot(fit, data = DataCluster2, fun = "cumhaz",
           legend = "top",
          legend.title = "Jenis Kelamin",
          legend.labs = c("Laki-Laki", "Perempuan")
          )

Variabel pneumonia
fit<-survfit(Surv(waktu,status)~ pneumonia, data=DataCluster2)
ggsurvplot(fit, data = DataCluster2, fun = "cumhaz",
           legend = "top",
          legend.title = "Pneumonia",
          legend.labs = c("no Pneumonia", "yes pneumonia")
          )

Variabel diabetes
fit<-survfit(Surv(waktu,status)~ diabetes, data=DataCluster2)
ggsurvplot(fit, data = DataCluster2, fun = "cumhaz",
           legend = "top",
          legend.title = "Diabetes",
          legend.labs = c("no Diabetes", "yes Diabetes")
          )

Variabel Hypertension
fit<-survfit(Surv(waktu,status)~ hypertension, data=DataCluster2)
ggsurvplot(fit, data = DataCluster2, fun = "cumhaz",
           legend = "top",
          legend.title = "Hyperetension",
          legend.labs = c("no hypertension", "yes hypertension")
          )

Variabel obesity
fit<-survfit(Surv(waktu,status)~ obesity, data=DataCluster2)
ggsurvplot(fit, data = DataCluster2, fun = "cumhaz",
           legend = "top",
          legend.title = "Obesity",
          legend.labs = c("no obesity", "yes obesity")
          )

Variabel renal chronic
fit<-survfit(Surv(waktu,status)~ renal_chronic, data=DataCluster2)
ggsurvplot(fit, data = DataCluster2, fun = "cumhaz",
           legend = "top",
          legend.title = "Renal Chronic",
          legend.labs = c("no renal chronic", "yes renal chronic")
          )

Variabel Age
fit<-survfit(Surv(waktu,status)~ Age, data=DataCluster2)
ggsurvplot(fit, data = DataCluster2, fun = "cumhaz",
           legend = "top",
          legend.title = "Age",
          legend.labs = c("young", "old")
          )

Variabel COPD
fit<-survfit(Surv(waktu,status)~ copd, data=DataCluster2)
ggsurvplot(fit, data = DataCluster2, fun = "cumhaz",
           legend = "top",
          legend.title = "copd"
          )

Variabel inmsupr
fit<-survfit(Surv(waktu,status)~ inmsupr, data=DataCluster2)
ggsurvplot(fit, data = DataCluster2, fun = "cumhaz",
           legend = "top",
          legend.title = "inmsupr",
          legend.labs = c("no inmsupr", "yes inmsupr")
          )

Variabel asthma
fit<-survfit(Surv(waktu,status)~ asthma, data=DataCluster2)
ggsurvplot(fit, data = DataCluster2, fun = "cumhaz",
           legend = "top",
          legend.title = "asthma",
          legend.labs = c("no asthma", "yes asthma")
          )

Variabel cardiovascular
fit<-survfit(Surv(waktu,status)~ cardiovascular, data=DataCluster2)
ggsurvplot(fit, data = DataCluster2, fun = "cumhaz",
           legend = "top",
          legend.title = "Cardiovascular",
          legend.labs = c("No Cardivascular", "Yes Cardivascular")
          )

Variabel pregnancy
fit<-survfit(Surv(waktu,status)~ pregnancy, data=DataCluster2)
ggsurvplot(fit, data = DataCluster2, fun = "cumhaz",
           legend = "top",
          legend.title = "Prgenancy",
          legend.labs = c("No Pregnancy", "Yes Pregnancy")
          )

b. Pendekatan GOF

fit_cluster2<-coxph(Surv(waktu,status)~ sex+pneumonia+Age+hypertension+obesity+diabetes+renal_chronic+inmsupr+asthma+cardiovascular+copd+pregnancy, data = DataCluster2)

cek_fitt_all2<-cox.zph(fit_cluster2,  transform="km", global=TRUE)

print(cek_fitt_all2)
                  chisq df       p
sex            5.76e+00  1   0.016
pneumonia      7.42e+01  1 < 2e-16
Age            3.70e+01  1 1.2e-09
hypertension   1.44e+00  1   0.230
obesity        1.74e+00  1   0.188
diabetes       9.29e-01  1   0.335
renal_chronic  2.36e+00  1   0.124
inmsupr        8.66e-01  1   0.352
asthma         2.27e-02  1   0.880
cardiovascular 4.73e-01  1   0.491
copd           3.92e+00  1   0.048
pregnancy      4.31e-03  1   0.948
GLOBAL         1.21e+02 12 < 2e-16

There are 2 variables that do not meet the proportional hazard assumption, namely: pneumoniadan Age . then these two variables will be interacted with the time function, namely the heavside function for each variable. To be able to determine the heavside function is to look at the survival probability graph.

c. Identification of Covariate Non Proportional Hazard

Variabel Age
# VARIABEL Age
fit<-survfit(Surv(waktu,status)~ Age , data=DataCluster2)
summary(fit)
Call: survfit(formula = Surv(waktu, status) ~ Age, data = DataCluster2)

                Age=0 
 time n.risk n.event survival  std.err lower 95% CI upper 95% CI
    1   6412      19    0.997 0.000679        0.996        0.998
    2   6393      26    0.993 0.001043        0.991        0.995
    3   6367      47    0.986 0.001485        0.983        0.989
    4   6320      51    0.978 0.001844        0.974        0.981
    5   6269      61    0.968 0.002192        0.964        0.972
    6   6208      67    0.958 0.002513        0.953        0.963
    7   6141      73    0.946 0.002814        0.941        0.952
    8   6068      70    0.935 0.003069        0.929        0.941
    9   5998      57    0.927 0.003258        0.920        0.933
   10   5941      72    0.915 0.003477        0.909        0.922
   11   5869      55    0.907 0.003632        0.900        0.914
   12   5814      74    0.895 0.003825        0.888        0.903
   13   5740      33    0.890 0.003907        0.882        0.898
   14   5707      48    0.883 0.004020        0.875        0.890
   15   5659      33    0.877 0.004096        0.869        0.885
   16   5626      37    0.872 0.004177        0.863        0.880
   17   5589      32    0.867 0.004245        0.858        0.875
   18   5557      13    0.865 0.004272        0.856        0.873
   19   5544      24    0.861 0.004322        0.852        0.869
   20   5520      19    0.858 0.004360        0.849        0.867
   21   5501      12    0.856 0.004384        0.848        0.865
   22   5489      15    0.854 0.004413        0.845        0.862
   23   5474       8    0.852 0.004429        0.844        0.861
   24   5466       5    0.852 0.004438        0.843        0.860
   25   5461       7    0.851 0.004452        0.842        0.859
   26   5454      11    0.849 0.004473        0.840        0.858
   27   5443       3    0.848 0.004479        0.840        0.857
   28   5440       2    0.848 0.004482        0.839        0.857
   29   5438       5    0.847 0.004492        0.839        0.856
   30   5433       2    0.847 0.004496        0.838        0.856
   31   5431       6    0.846 0.004507        0.837        0.855
   32   5425       1    0.846 0.004509        0.837        0.855
   33   5424       3    0.845 0.004514        0.837        0.854
   34   5421       2    0.845 0.004518        0.836        0.854
   36   5419       2    0.845 0.004522        0.836        0.854
   37   5417       1    0.845 0.004524        0.836        0.854
   41   5416       1    0.845 0.004525        0.836        0.853
   42   5415       1    0.844 0.004527        0.836        0.853
   43   5414       1    0.844 0.004529        0.835        0.853
   44   5413       1    0.844 0.004531        0.835        0.853
   45   5412       1    0.844 0.004533        0.835        0.853
   46   5411       1    0.844 0.004535        0.835        0.853
   50   5410       1    0.844 0.004536        0.835        0.853
   59   5409       1    0.843 0.004538        0.835        0.852

                Age=1 
 time n.risk n.event survival std.err lower 95% CI upper 95% CI
    1   3642      50    0.986 0.00193        0.982        0.990
    2   3592      71    0.967 0.00297        0.961        0.973
    3   3521      99    0.940 0.00395        0.932        0.947
    4   3422     126    0.905 0.00486        0.896        0.915
    5   3296     154    0.863 0.00570        0.852        0.874
    6   3142     148    0.822 0.00634        0.810        0.835
    7   2994     153    0.780 0.00686        0.767        0.794
    8   2841     152    0.738 0.00728        0.724        0.753
    9   2689     135    0.701 0.00758        0.687        0.716
   10   2554     133    0.665 0.00782        0.650        0.680
   11   2421     128    0.630 0.00800        0.614        0.645
   12   2293     123    0.596 0.00813        0.580        0.612
   13   2170      90    0.571 0.00820        0.555        0.587
   14   2080      91    0.546 0.00825        0.530        0.563
   15   1989      92    0.521 0.00828        0.505        0.537
   16   1897      75    0.500 0.00829        0.484        0.517
   17   1822      53    0.486 0.00828        0.470        0.502
   18   1769      50    0.472 0.00827        0.456        0.488
   19   1719      56    0.457 0.00825        0.441        0.473
   20   1663      36    0.447 0.00824        0.431        0.463
   21   1627      39    0.436 0.00822        0.420        0.452
   22   1588      27    0.429 0.00820        0.413        0.445
   23   1561      17    0.424 0.00819        0.408        0.440
   24   1544      25    0.417 0.00817        0.401        0.433
   25   1519      17    0.412 0.00816        0.397        0.429
   26   1502      10    0.410 0.00815        0.394        0.426
   27   1492      11    0.407 0.00814        0.391        0.423
   28   1481      11    0.404 0.00813        0.388        0.420
   29   1470      13    0.400 0.00812        0.384        0.416
   30   1457      10    0.397 0.00811        0.382        0.414
   31   1447      11    0.394 0.00810        0.379        0.410
   32   1436       4    0.393 0.00809        0.378        0.409
   33   1432       3    0.392 0.00809        0.377        0.409
   34   1429       4    0.391 0.00809        0.376        0.407
   35   1425       5    0.390 0.00808        0.374        0.406
   36   1420       3    0.389 0.00808        0.374        0.405
   38   1417       4    0.388 0.00807        0.372        0.404
   39   1413       1    0.388 0.00807        0.372        0.404
   40   1412       3    0.387 0.00807        0.371        0.403
   41   1409       1    0.387 0.00807        0.371        0.403
   42   1408       1    0.386 0.00807        0.371        0.402
   43   1407       3    0.386 0.00806        0.370        0.402
   44   1404       1    0.385 0.00806        0.370        0.401
   46   1403       2    0.385 0.00806        0.369        0.401
   47   1401       1    0.384 0.00806        0.369        0.401
   48   1400       2    0.384 0.00806        0.368        0.400
   49   1398       1    0.384 0.00806        0.368        0.400
   50   1397       2    0.383 0.00806        0.368        0.399
   51   1395       1    0.383 0.00805        0.367        0.399
   53   1394       1    0.382 0.00805        0.367        0.399
   56   1393       1    0.382 0.00805        0.367        0.398
   58   1392       1    0.382 0.00805        0.366        0.398
   59   1391       1    0.382 0.00805        0.366        0.398
   60   1390       1    0.381 0.00805        0.366        0.397
   63   1389       1    0.381 0.00805        0.366        0.397
ggsurvplot(fit, data = DataCluster2, 
pval = TRUE, conf.int = TRUE,
 risk.table = TRUE, # Add risk table
 risk.table.col = "strata", # Change risk table color by groups
 linetype = "strata", # Change line type by groups
 surv.median.line = "hv", # Specify median survival
 ggtheme = theme_bw(), # Change ggplot2 theme
 palette = c("#E7B800", "#2E9FDF"))

Note the graph of the elderly patient’s speed drops drastically on day 30 but after day 30 it was constant until the end of the study. so the function of the upper side is

\[ g(t)= \begin{cases} 1, & \mbox{if}\ t\mbox{ < 30} \\ 0, & \mbox{if}\ t\mbox{ >= 30} \end{cases}\]

Variabel Pneumonia
# VARIABEL Pneumonia
fit<-survfit(Surv(waktu,status)~ pneumonia , data=DataCluster2)
summary(fit)
Call: survfit(formula = Surv(waktu, status) ~ pneumonia, data = DataCluster2)

                pneumonia=0 
 time n.risk n.event survival  std.err lower 95% CI upper 95% CI
    1   6408      16    0.998 0.000623        0.996        0.999
    2   6392      30    0.993 0.001055        0.991        0.995
    3   6362      37    0.987 0.001412        0.984        0.990
    4   6325      44    0.980 0.001741        0.977        0.984
    5   6281      51    0.972 0.002053        0.968        0.976
    6   6230      65    0.962 0.002386        0.957        0.967
    7   6165      69    0.951 0.002689        0.946        0.957
    8   6096      56    0.943 0.002906        0.937        0.948
    9   6040      51    0.935 0.003088        0.929        0.941
   10   5989      58    0.926 0.003279        0.919        0.932
   11   5931      45    0.919 0.003417        0.912        0.925
   12   5886      48    0.911 0.003556        0.904        0.918
   13   5838      29    0.907 0.003636        0.899        0.914
   14   5809      28    0.902 0.003712        0.895        0.909
   15   5781      32    0.897 0.003795        0.890        0.905
   16   5749      22    0.894 0.003850        0.886        0.901
   17   5727      23    0.890 0.003907        0.883        0.898
   18   5704      13    0.888 0.003938        0.880        0.896
   19   5691      22    0.885 0.003990        0.877        0.893
   20   5669      17    0.882 0.004030        0.874        0.890
   21   5652       9    0.881 0.004050        0.873        0.889
   22   5643      10    0.879 0.004073        0.871        0.887
   23   5633       6    0.878 0.004087        0.870        0.886
   24   5627       2    0.878 0.004091        0.870        0.886
   25   5625       5    0.877 0.004102        0.869        0.885
   26   5620       9    0.876 0.004123        0.868        0.884
   27   5611       4    0.875 0.004131        0.867        0.883
   28   5607       3    0.875 0.004138        0.866        0.883
   29   5604       5    0.874 0.004149        0.866        0.882
   30   5599       5    0.873 0.004160        0.865        0.881
   31   5594       4    0.872 0.004169        0.864        0.881
   32   5590       2    0.872 0.004173        0.864        0.880
   33   5588       2    0.872 0.004177        0.864        0.880
   34   5586       1    0.872 0.004180        0.863        0.880
   35   5585       1    0.871 0.004182        0.863        0.880
   36   5584       1    0.871 0.004184        0.863        0.879
   40   5583       1    0.871 0.004186        0.863        0.879
   41   5582       1    0.871 0.004188        0.863        0.879
   42   5581       1    0.871 0.004190        0.863        0.879
   43   5580       2    0.870 0.004195        0.862        0.879
   47   5578       1    0.870 0.004197        0.862        0.879
   49   5577       1    0.870 0.004199        0.862        0.878
   51   5576       1    0.870 0.004201        0.862        0.878
   58   5575       1    0.870 0.004203        0.862        0.878

                pneumonia=1 
 time n.risk n.event survival std.err lower 95% CI upper 95% CI
    1   3646      53    0.985 0.00198        0.982        0.989
    2   3593      67    0.967 0.00295        0.961        0.973
    3   3526     109    0.937 0.00402        0.929        0.945
    4   3417     133    0.901 0.00495        0.891        0.910
    5   3284     164    0.856 0.00582        0.844        0.867
    6   3120     150    0.815 0.00644        0.802        0.827
    7   2970     157    0.772 0.00695        0.758        0.785
    8   2813     166    0.726 0.00739        0.712        0.741
    9   2647     141    0.687 0.00768        0.672        0.703
   10   2506     147    0.647 0.00791        0.632        0.663
   11   2359     138    0.609 0.00808        0.594        0.625
   12   2221     149    0.568 0.00820        0.552        0.585
   13   2072      94    0.543 0.00825        0.527        0.559
   14   1978     111    0.512 0.00828        0.496        0.529
   15   1867      93    0.487 0.00828        0.471        0.503
   16   1774      90    0.462 0.00826        0.446        0.478
   17   1684      62    0.445 0.00823        0.429        0.461
   18   1622      50    0.431 0.00820        0.415        0.448
   19   1572      58    0.415 0.00816        0.400        0.432
   20   1514      38    0.405 0.00813        0.389        0.421
   21   1476      42    0.393 0.00809        0.378        0.409
   22   1434      32    0.385 0.00806        0.369        0.401
   23   1402      19    0.379 0.00804        0.364        0.395
   24   1383      28    0.372 0.00800        0.356        0.388
   25   1355      19    0.366 0.00798        0.351        0.382
   26   1336      12    0.363 0.00796        0.348        0.379
   27   1324      10    0.360 0.00795        0.345        0.376
   28   1314      10    0.358 0.00794        0.342        0.374
   29   1304      13    0.354 0.00792        0.339        0.370
   30   1291       7    0.352 0.00791        0.337        0.368
   31   1284      13    0.349 0.00789        0.333        0.364
   32   1271       3    0.348 0.00789        0.333        0.364
   33   1268       4    0.347 0.00788        0.332        0.362
   34   1264       5    0.345 0.00787        0.330        0.361
   35   1259       4    0.344 0.00787        0.329        0.360
   36   1255       4    0.343 0.00786        0.328        0.359
   37   1251       1    0.343 0.00786        0.328        0.359
   38   1250       4    0.342 0.00785        0.327        0.357
   39   1246       1    0.341 0.00785        0.326        0.357
   40   1245       2    0.341 0.00785        0.326        0.357
   41   1243       1    0.341 0.00785        0.326        0.356
   42   1242       1    0.340 0.00785        0.325        0.356
   43   1241       2    0.340 0.00784        0.325        0.356
   44   1239       2    0.339 0.00784        0.324        0.355
   45   1237       1    0.339 0.00784        0.324        0.355
   46   1236       3    0.338 0.00783        0.323        0.354
   48   1233       2    0.338 0.00783        0.323        0.353
   50   1231       3    0.337 0.00783        0.322        0.353
   53   1228       1    0.337 0.00783        0.322        0.352
   56   1227       1    0.336 0.00782        0.321        0.352
   59   1226       2    0.336 0.00782        0.321        0.351
   60   1224       1    0.335 0.00782        0.320        0.351
   63   1223       1    0.335 0.00782        0.320        0.351
ggsurvplot(fit, data = DataCluster2, 
pval = TRUE, conf.int = TRUE,
 risk.table = TRUE, # Add risk table
 risk.table.col = "strata", # Change risk table color by groups
 linetype = "strata", # Change line type by groups
 surv.median.line = "hv", # Specify median survival
 ggtheme = theme_bw(), # Change ggplot2 theme
 palette = c("#E7B800", "#2E9FDF"))

Notice the graph speed of pneumonia patients dropped rapidly on day 31 but after day 31 it was constant until the end of the study. so the heavside function is

\[ g(t)= \begin{cases} 1, & \mbox{if}\ t\mbox{ < 31} \\ 0, & \mbox{if}\ t\mbox{ >= 31} \end{cases}\]

d. Build Time Function

DataCluster2= DataCluster2 %>%
        mutate(interval1 = ifelse(waktu<= 30, 0, 30),
               interval2 = ifelse(waktu<= 31, 0, 31))
head(DataCluster2)
  sex pneumonia pregnancy diabetes copd asthma inmsupr hypertension
1   0         1         0        0    0      0       0            0
2   1         1         0        0    0      0       0            1
3   0         1         0        0    0      1       1            1
4   0         0         0        0    0      0       0            1
5   0         1         0        1    0      0       0            1
6   0         1         0        0    0      0       0            1
  cardiovascular obesity renal_chronic tobacco waktu status Age cluster
1              1       0             0       1     2      1   1       2
2              0       1             0       1     9      1   1       2
3              0       0             0       1    22      1   0       2
4              0       0             0       1    11      1   1       2
5              0       0             0       1     4      1   1       2
6              0       1             0       1    10      1   1       2
  interval1 interval2
1         0         0
2         0         0
3         0         0
4         0         0
5         0         0
6         0         0
t.Age_1 = t(DataCluster2$Age)*(1-(DataCluster2$interval1)/30) 
t.Age_2 = t(DataCluster2$Age)*(DataCluster2$interval1/30) 
Age_t1 = t(t.Age_1 )
Age_t2 = t(t.Age_2)
t.pneumonia_1 = t(DataCluster2$pneumonia)*(1-(DataCluster2$interval2)/31) 
t.pneumonia_2 = t(DataCluster2$pneumonia)*(DataCluster2$interval2/31) 
pneumonia_t1 = t(t.pneumonia_1 )
pneumonia_t2 = t(t.pneumonia_2)
DataCluster2=cbind(DataCluster2,pneumonia_t1,pneumonia_t2,Age_t1,Age_t2)
head(DataCluster2)
  sex pneumonia pregnancy diabetes copd asthma inmsupr hypertension
1   0         1         0        0    0      0       0            0
2   1         1         0        0    0      0       0            1
3   0         1         0        0    0      1       1            1
4   0         0         0        0    0      0       0            1
5   0         1         0        1    0      0       0            1
6   0         1         0        0    0      0       0            1
  cardiovascular obesity renal_chronic tobacco waktu status Age cluster
1              1       0             0       1     2      1   1       2
2              0       1             0       1     9      1   1       2
3              0       0             0       1    22      1   0       2
4              0       0             0       1    11      1   1       2
5              0       0             0       1     4      1   1       2
6              0       1             0       1    10      1   1       2
  interval1 interval2 pneumonia_t1 pneumonia_t2 Age_t1 Age_t2
1         0         0            1            0      1      0
2         0         0            1            0      1      0
3         0         0            1            0      0      0
4         0         0            0            0      1      0
5         0         0            1            0      1      0
6         0         0            1            0      1      0

e. Model Extended Cox

Fit_Model_Cluster2<-coxph(Surv(waktu,status)~ sex+hypertension+obesity+pregnancy+diabetes+renal_chronic+cardiovascular+copd+Age_t1+Age_t2+pneumonia_t1+pneumonia_t2+asthma+inmsupr, data = DataCluster2, method = "breslow")

summary(Fit_Model_Cluster2)
Call:
coxph(formula = Surv(waktu, status) ~ sex + hypertension + obesity + 
    pregnancy + diabetes + renal_chronic + cardiovascular + copd + 
    Age_t1 + Age_t2 + pneumonia_t1 + pneumonia_t2 + asthma + 
    inmsupr, data = DataCluster2, method = "breslow")

  n= 10054, number of events= 3258 

                   coef exp(coef) se(coef)      z Pr(>|z|)    
sex            -0.19410   0.82358  0.04741 -4.094 4.23e-05 ***
hypertension    0.17217   1.18788  0.04038  4.264 2.01e-05 ***
obesity         0.07216   1.07483  0.03839  1.880 0.060173 .  
pregnancy      -0.23207   0.79289  0.70956 -0.327 0.743616    
diabetes        0.20050   1.22202  0.03929  5.103 3.34e-07 ***
renal_chronic   0.33003   1.39101  0.06551  5.038 4.71e-07 ***
cardiovascular  0.13308   1.14235  0.06372  2.088 0.036754 *  
copd            0.19493   1.21522  0.05206  3.745 0.000181 ***
Age_t1          1.16687   3.21192  0.05712 20.429  < 2e-16 ***
Age_t2         -1.22458   0.29388  0.13660 -8.964  < 2e-16 ***
pneumonia_t1    1.96898   7.16339  0.06120 32.171  < 2e-16 ***
pneumonia_t2   -1.08519   0.33784  0.14840 -7.313 2.62e-13 ***
asthma         -0.25033   0.77854  0.12031 -2.081 0.037463 *  
inmsupr         0.18399   1.20201  0.08393  2.192 0.028358 *  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

               exp(coef) exp(-coef) lower .95 upper .95
sex               0.8236     1.2142    0.7505    0.9038
hypertension      1.1879     0.8418    1.0975    1.2857
obesity           1.0748     0.9304    0.9969    1.1588
pregnancy         0.7929     1.2612    0.1974    3.1856
diabetes          1.2220     0.8183    1.1314    1.3198
renal_chronic     1.3910     0.7189    1.2234    1.5816
cardiovascular    1.1423     0.8754    1.0082    1.2943
copd              1.2152     0.8229    1.0973    1.3458
Age_t1            3.2119     0.3113    2.8718    3.5924
Age_t2            0.2939     3.4027    0.2249    0.3841
pneumonia_t1      7.1634     0.1396    6.3536    8.0763
pneumonia_t2      0.3378     2.9600    0.2526    0.4519
asthma            0.7785     1.2844    0.6150    0.9856
inmsupr           1.2020     0.8319    1.0197    1.4169

Concordance= 0.887  (se = 0.002 )
Likelihood ratio test= 7541  on 14 df,   p=<2e-16
Wald test            = 5979  on 14 df,   p=<2e-16
Score (logrank) test = 11944  on 14 df,   p=<2e-16

d. Hazard Ratio

ggforest(Fit_Model_Cluster2, main = "Hazard Ratio")

f. Pengujian Signifikansi

Uji Partial Likelihood
Fit_Model_Cluster2$loglik
[1] -29457.50 -25687.17
Uji Wald Test
Variabel Sex
## Variabel sex
Fit_Model_Sex<-coxph(Surv(waktu,status)~ sex, data = DataCluster2, method = "breslow")
summary(Fit_Model_Sex)
Call:
coxph(formula = Surv(waktu, status) ~ sex, data = DataCluster2, 
    method = "breslow")

  n= 10054, number of events= 3258 

        coef exp(coef) se(coef)      z Pr(>|z|)    
sex -0.57546   0.56245  0.04658 -12.35   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

    exp(coef) exp(-coef) lower .95 upper .95
sex    0.5624      1.778    0.5134    0.6162

Concordance= 0.548  (se = 0.004 )
Likelihood ratio test= 172.3  on 1 df,   p=<2e-16
Wald test            = 152.6  on 1 df,   p=<2e-16
Score (logrank) test = 156.9  on 1 df,   p=<2e-16
Variabel peneumonia
## Variabel Pneumonia
Fit_Model_Pneumonia1<-coxph(Surv(waktu,status)~ pneumonia_t1, data = DataCluster2, method = "breslow")
summary(Fit_Model_Pneumonia1)
Call:
coxph(formula = Surv(waktu, status) ~ pneumonia_t1, data = DataCluster2, 
    method = "breslow")

  n= 10054, number of events= 3258 

                 coef exp(coef) se(coef)     z Pr(>|z|)    
pneumonia_t1  3.22421  25.13362  0.04442 72.58   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

             exp(coef) exp(-coef) lower .95 upper .95
pneumonia_t1     25.13    0.03979     23.04     27.42

Concordance= 0.798  (se = 0.003 )
Likelihood ratio test= 6494  on 1 df,   p=<2e-16
Wald test            = 5268  on 1 df,   p=<2e-16
Score (logrank) test = 10081  on 1 df,   p=<2e-16
Fit_Model_Pneumonia2<-coxph(Surv(waktu,status)~ pneumonia_t2, data = DataCluster2, method = "breslow")
summary(Fit_Model_Pneumonia2)
Call:
coxph(formula = Surv(waktu, status) ~ pneumonia_t2, data = DataCluster2, 
    method = "breslow")

  n= 10054, number of events= 3258 

                 coef exp(coef) se(coef)      z Pr(>|z|)    
pneumonia_t2 -2.46067   0.08538  0.14396 -17.09   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

             exp(coef) exp(-coef) lower .95 upper .95
pneumonia_t2   0.08538      11.71   0.06439    0.1132

Concordance= 0.57  (se = 0.002 )
Likelihood ratio test= 731.1  on 1 df,   p=<2e-16
Wald test            = 292.1  on 1 df,   p=<2e-16
Score (logrank) test = 472.6  on 1 df,   p=<2e-16
Variabel Diabetes
## Variabel Diabetes
Fit_Model_Diabetes<-coxph(Surv(waktu,status)~ diabetes, data = DataCluster2, method = "breslow")
summary(Fit_Model_Diabetes)
Call:
coxph(formula = Surv(waktu, status) ~ diabetes, data = DataCluster2, 
    method = "breslow")

  n= 10054, number of events= 3258 

            coef exp(coef) se(coef)     z Pr(>|z|)    
diabetes 0.98345   2.67365  0.03605 27.28   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

         exp(coef) exp(-coef) lower .95 upper .95
diabetes     2.674      0.374     2.491     2.869

Concordance= 0.599  (se = 0.004 )
Likelihood ratio test= 670.4  on 1 df,   p=<2e-16
Wald test            = 744.2  on 1 df,   p=<2e-16
Score (logrank) test = 805.5  on 1 df,   p=<2e-16
Variabel Hypertension
## Variabel hypertension
Fit_Model_Hypertension<-coxph(Surv(waktu,status)~ hypertension, data = DataCluster2, method = "breslow")
summary(Fit_Model_Hypertension)
Call:
coxph(formula = Surv(waktu, status) ~ hypertension, data = DataCluster2, 
    method = "breslow")

  n= 10054, number of events= 3258 

                coef exp(coef) se(coef)     z Pr(>|z|)    
hypertension 1.02681   2.79216  0.03536 29.04   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

             exp(coef) exp(-coef) lower .95 upper .95
hypertension     2.792     0.3581     2.605     2.993

Concordance= 0.613  (se = 0.004 )
Likelihood ratio test= 780.9  on 1 df,   p=<2e-16
Wald test            = 843.3  on 1 df,   p=<2e-16
Score (logrank) test = 919.1  on 1 df,   p=<2e-16
Variabel Obesity
## Variabel Obesity
Fit_Model_obesity<-coxph(Surv(waktu,status)~ obesity, data = DataCluster2, method = "breslow")
summary(Fit_Model_obesity)
Call:
coxph(formula = Surv(waktu, status) ~ obesity, data = DataCluster2, 
    method = "breslow")

  n= 10054, number of events= 3258 

           coef exp(coef) se(coef)     z Pr(>|z|)   
obesity 0.11730   1.12446  0.03777 3.106   0.0019 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

        exp(coef) exp(-coef) lower .95 upper .95
obesity     1.124     0.8893     1.044     1.211

Concordance= 0.512  (se = 0.004 )
Likelihood ratio test= 9.5  on 1 df,   p=0.002
Wald test            = 9.65  on 1 df,   p=0.002
Score (logrank) test = 9.66  on 1 df,   p=0.002
Variabel Renal Chronic
### variabel renal_chronic
Fit_Model_RenalChronic<-coxph(Surv(waktu,status)~ renal_chronic, data = DataCluster2, method = "breslow")
summary(Fit_Model_RenalChronic)
Call:
coxph(formula = Surv(waktu, status) ~ renal_chronic, data = DataCluster2, 
    method = "breslow")

  n= 10054, number of events= 3258 

                 coef exp(coef) se(coef)     z Pr(>|z|)    
renal_chronic 1.06039   2.88750  0.06171 17.18   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

              exp(coef) exp(-coef) lower .95 upper .95
renal_chronic     2.887     0.3463     2.559     3.259

Concordance= 0.529  (se = 0.002 )
Likelihood ratio test= 223.3  on 1 df,   p=<2e-16
Wald test            = 295.2  on 1 df,   p=<2e-16
Score (logrank) test = 323.9  on 1 df,   p=<2e-16
Variabel Age
## Variabel Age
Fit_Model_Age1<-coxph(Surv(waktu,status)~ Age_t1, data = DataCluster2, method = "breslow")
summary(Fit_Model_Age1)
Call:
coxph(formula = Surv(waktu, status) ~ Age_t1, data = DataCluster2, 
    method = "breslow")

  n= 10054, number of events= 3258 

           coef exp(coef) se(coef)     z Pr(>|z|)    
Age_t1  3.01112  20.31005  0.04172 72.17   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

       exp(coef) exp(-coef) lower .95 upper .95
Age_t1     20.31    0.04924     18.72     22.04

Concordance= 0.778  (se = 0.004 )
Likelihood ratio test= 5805  on 1 df,   p=<2e-16
Wald test            = 5209  on 1 df,   p=<2e-16
Score (logrank) test = 9377  on 1 df,   p=<2e-16
## Variabel Age
Fit_Model_Age2<-coxph(Surv(waktu,status)~ Age_t2, data = DataCluster2, method = "breslow")
summary(Fit_Model_Age2)
Call:
coxph(formula = Surv(waktu, status) ~ Age_t2, data = DataCluster2, 
    method = "breslow")

  n= 10054, number of events= 3258 

           coef exp(coef) se(coef)      z Pr(>|z|)    
Age_t2 -2.42686   0.08831  0.13141 -18.47   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

       exp(coef) exp(-coef) lower .95 upper .95
Age_t2   0.08831      11.32   0.06826    0.1143

Concordance= 0.579  (se = 0.002 )
Likelihood ratio test= 828.9  on 1 df,   p=<2e-16
Wald test            = 341.1  on 1 df,   p=<2e-16
Score (logrank) test = 544.8  on 1 df,   p=<2e-16
Variabel COPD
## Variabel COPD
Fit_Model_copd<-coxph(Surv(waktu,status)~ copd, data = DataCluster2, method = "breslow")
summary(Fit_Model_copd)
Call:
coxph(formula = Surv(waktu, status) ~ copd, data = DataCluster2, 
    method = "breslow")

  n= 10054, number of events= 3258 

        coef exp(coef) se(coef)     z Pr(>|z|)    
copd 1.08107   2.94784  0.04933 21.91   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

     exp(coef) exp(-coef) lower .95 upper .95
copd     2.948     0.3392     2.676     3.247

Concordance= 0.548  (se = 0.003 )
Likelihood ratio test= 372.9  on 1 df,   p=<2e-16
Wald test            = 480.2  on 1 df,   p=<2e-16
Score (logrank) test = 528.6  on 1 df,   p=<2e-16
Variabel Inmsupr
## Variabel inmsupr
Fit_Model_inmsupr<-coxph(Surv(waktu,status)~ inmsupr, data = DataCluster2, method = "breslow")
summary(Fit_Model_inmsupr)
Call:
coxph(formula = Surv(waktu, status) ~ inmsupr, data = DataCluster2, 
    method = "breslow")

  n= 10054, number of events= 3258 

           coef exp(coef) se(coef)     z Pr(>|z|)    
inmsupr 0.95039   2.58673  0.07994 11.89   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

        exp(coef) exp(-coef) lower .95 upper .95
inmsupr     2.587     0.3866     2.212     3.025

Concordance= 0.516  (se = 0.002 )
Likelihood ratio test= 107.9  on 1 df,   p=<2e-16
Wald test            = 141.3  on 1 df,   p=<2e-16
Score (logrank) test = 152.3  on 1 df,   p=<2e-16
Variabel Asthma
## Variabel Asthma
Fit_Model_Asthma<-coxph(Surv(waktu,status)~ asthma, data = DataCluster2, method = "breslow")
summary(Fit_Model_Asthma)
Call:
coxph(formula = Surv(waktu, status) ~ asthma, data = DataCluster2, 
    method = "breslow")

  n= 10054, number of events= 3258 

          coef exp(coef) se(coef)      z Pr(>|z|)  
asthma -0.2655    0.7668   0.1184 -2.243   0.0249 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

       exp(coef) exp(-coef) lower .95 upper .95
asthma    0.7668      1.304     0.608    0.9671

Concordance= 0.503  (se = 0.001 )
Likelihood ratio test= 5.48  on 1 df,   p=0.02
Wald test            = 5.03  on 1 df,   p=0.02
Score (logrank) test = 5.06  on 1 df,   p=0.02
Variabel Cardivascular
## Variabel Cardiovascular
Fit_Model_Cardivascular<-coxph(Surv(waktu,status)~ cardiovascular, data = DataCluster2, method = "breslow")
summary(Fit_Model_Cardivascular)
Call:
coxph(formula = Surv(waktu, status) ~ cardiovascular, data = DataCluster2, 
    method = "breslow")

  n= 10054, number of events= 3258 

                  coef exp(coef) se(coef)     z Pr(>|z|)    
cardiovascular 0.89826   2.45532  0.05917 15.18   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

               exp(coef) exp(-coef) lower .95 upper .95
cardiovascular     2.455     0.4073     2.186     2.757

Concordance= 0.529  (se = 0.002 )
Likelihood ratio test= 182.2  on 1 df,   p=<2e-16
Wald test            = 230.4  on 1 df,   p=<2e-16
Score (logrank) test = 246.3  on 1 df,   p=<2e-16
Variabel Pregnancy
## Variabel Pregnancy
Fit_Model_Pregnancy<-coxph(Surv(waktu,status)~ pregnancy, data = DataCluster2, method = "breslow")
summary(Fit_Model_Pregnancy)
Call:
coxph(formula = Surv(waktu, status) ~ pregnancy, data = DataCluster2, 
    method = "breslow")

  n= 10054, number of events= 3258 

             coef exp(coef) se(coef)      z Pr(>|z|)
pregnancy -1.0061    0.3656   0.7073 -1.422    0.155

          exp(coef) exp(-coef) lower .95 upper .95
pregnancy    0.3656      2.735   0.09141     1.463

Concordance= 0.501  (se = 0 )
Likelihood ratio test= 2.91  on 1 df,   p=0.09
Wald test            = 2.02  on 1 df,   p=0.2
Score (logrank) test = 2.2  on 1 df,   p=0.1

9.3 Cluster 3

DataCluster3<- CovidData %>% 
  filter(cluster == 3)

DataCluster3[,c("sex","pneumonia","pregnancy","diabetes","copd","asthma","inmsupr","hypertension","cardiovascular","obesity","renal_chronic","tobacco","status","Age")] <- lapply(DataCluster3[,c("sex","pneumonia","pregnancy","diabetes","copd","asthma","inmsupr","hypertension","cardiovascular","obesity","renal_chronic","tobacco","status","Age")],as.factor)

summary(DataCluster3)
 sex       pneumonia pregnancy diabetes  copd      asthma    inmsupr  
 0:21185   0: 8917   0:33856   0:20517   0:32165   0:33217   0:32601  
 1:12713   1:24981   1:   42   1:13381   1: 1733   1:  681   1: 1297  
                                                                      
                                                                      
                                                                      
                                                                      
 hypertension cardiovascular obesity   renal_chronic tobacco       waktu      
 0:18703      0:31723        0:26091   0:31011       0:33880   Min.   : 1.00  
 1:15195      1: 2175        1: 7807   1: 2887       1:   18   1st Qu.: 6.00  
                                                               Median :10.00  
                                                               Mean   :15.76  
                                                               3rd Qu.:16.00  
                                                               Max.   :95.00  
 status    Age       cluster  
 0: 1876   0:11145   1:    0  
 1:32022   1:22753   2:    0  
                     3:33898  
                              
                              
                              
DataCluster3<- CovidData %>% 
  filter(cluster == 3)
head(DataCluster3)
  sex pneumonia pregnancy diabetes copd asthma inmsupr hypertension
1   0         1         0        0    0      0       0            0
2   1         1         0        0    0      0       0            1
3   1         1         0        1    0      0       0            0
4   0         1         0        0    1      1       0            1
5   0         1         0        0    0      0       0            1
6   1         1         0        0    0      0       0            1
  cardiovascular obesity renal_chronic tobacco waktu status Age cluster
1              0       0             0       0     4      1   0       3
2              0       1             0       0    17      1   1       3
3              0       1             0       0    26      1   0       3
4              1       1             0       0     3      1   0       3
5              0       0             0       0    14      1   1       3
6              0       1             0       0     2      1   1       3

Before applying the extended cox model, it is necessary to test whether all variables are independent of time. There are two approaches to the proportional hazard assumption test, namely the graphical approach and the GOF approach.

a. Pendekatan Grafik

Variabel sex
fit<-survfit(Surv(waktu,status)~ sex, data=DataCluster3)
ggsurvplot(fit, data = DataCluster3, fun = "cumhaz",
           legend = "top",
          legend.title = "Jenis Kelamin",
          legend.labs = c("Laki-Laki", "Perempuan")
          )

Variabel pneumonia
fit<-survfit(Surv(waktu,status)~ pneumonia, data=DataCluster3)
ggsurvplot(fit, data = DataCluster3, fun = "cumhaz",
           legend = "top",
          legend.title = "Pneumonia",
          legend.labs = c("no Pneumonia", "yes pneumonia")
          )

Variabel Pregnancy
fit<-survfit(Surv(waktu,status)~ pregnancy, data=DataCluster3)
ggsurvplot(fit, data = DataCluster3, fun = "cumhaz",
           legend = "top",
          legend.title = "Pregnancy",
          legend.labs = c("no pregnancy", "yes pregnancy")
          )

Variabel diabetes
fit<-survfit(Surv(waktu,status)~ diabetes, data=DataCluster3)
ggsurvplot(fit, data = DataCluster3, fun = "cumhaz",
           legend = "top",
          legend.title = "Diabetes",
          legend.labs = c("no Diabetes", "yes Diabetes")
          )

Variabel Hypertension
fit<-survfit(Surv(waktu,status)~ hypertension, data=DataCluster3)
ggsurvplot(fit, data = DataCluster3, fun = "cumhaz",
           legend = "top",
          legend.title = "Hyperetension",
          legend.labs = c("no hypertension", "yes hypertension")
          )

Variabel obesity
fit<-survfit(Surv(waktu,status)~ obesity, data=DataCluster3)
ggsurvplot(fit, data = DataCluster3, fun = "cumhaz",
           legend = "top",
          legend.title = "Obesity",
          legend.labs = c("no obesity", "yes obesity")
          )

Variabel renal chronic
fit<-survfit(Surv(waktu,status)~ renal_chronic, data=DataCluster3)
ggsurvplot(fit, data = DataCluster3, fun = "cumhaz",
           legend = "top",
          legend.title = "Renal Chronic",
          legend.labs = c("no renal chronic", "yes renal chronic")
          )

Variabel tobacco
fit<-survfit(Surv(waktu,status)~ tobacco, data=DataCluster3)
ggsurvplot(fit, data = DataCluster3, fun = "cumhaz",
           legend = "top",
          legend.title = "Tobacco",
          legend.labs = c("no tobacco", "yes tobacco")
          )

Variabel Age
fit<-survfit(Surv(waktu,status)~ Age, data=DataCluster3)
ggsurvplot(fit, data = DataCluster3, fun = "cumhaz",
           legend = "top",
          legend.title = "Age",
          legend.labs = c("Young", "Old")
          )

Variabel COPD
fit<-survfit(Surv(waktu,status)~ copd, data=DataCluster3)
ggsurvplot(fit, data = DataCluster3, fun = "cumhaz",
           legend = "top",
          legend.title = "COPD",
          legend.labs = c("no COPD", "yes COPD")
          )

Variabel inmsupr
fit<-survfit(Surv(waktu,status)~ inmsupr, data=DataCluster3)
ggsurvplot(fit, data = DataCluster3, fun = "cumhaz",
           legend = "top",
          legend.title = "inmsupr",
          legend.labs = c("no inmsupr", "yes inmsupr")
          )

Variabel asthma
fit<-survfit(Surv(waktu,status)~ asthma, data=DataCluster3)
ggsurvplot(fit, data = DataCluster3, fun = "cumhaz",
           legend = "top",
          legend.title = "asthma",
          legend.labs = c("no asthma", "yes asthma")
          )

Variabel cardiovascular
fit<-survfit(Surv(waktu,status)~ cardiovascular, data=DataCluster3)
ggsurvplot(fit, data = DataCluster3, fun = "cumhaz",
           legend = "top",
          legend.title = "Cardiovascular",
          legend.labs = c("No Cardiovascular", "Yes Cardiovascular")
          )

b. Pendekatan GOF

fit_cluster3<-coxph(Surv(waktu,status)~ sex+pneumonia+Age+pregnancy+hypertension+obesity+tobacco+diabetes+renal_chronic+inmsupr+asthma+cardiovascular+copd, data = DataCluster3)

cek_fitt_all3<-cox.zph(fit_cluster3,  transform="km", global=TRUE)

print(cek_fitt_all3)
                  chisq df      p
sex            1.42e+02  1 <2e-16
pneumonia      4.36e-01  1   0.51
Age            2.27e+02  1 <2e-16
pregnancy      1.11e-02  1   0.92
hypertension   7.44e+02  1 <2e-16
obesity        6.49e-01  1   0.42
tobacco        1.33e-02  1   0.91
diabetes       9.48e+02  1 <2e-16
renal_chronic  5.78e+02  1 <2e-16
inmsupr        1.23e+02  1 <2e-16
asthma         1.39e+00  1   0.24
cardiovascular 2.84e+02  1 <2e-16
copd           1.67e+02  1 <2e-16
GLOBAL         1.93e+03 13 <2e-16

There are 8 variables that do not meet the proportional hazard assumption, namely: Sex, Age, hypertension, diabetes,renal_chronic, inmsupr, cardiovascular, copd with a significance level of 10%. then these eight variables will be interacted with the time function, namely the heavside function on each variable. To be able to determine the heavside function is to look at the survival probability graph.

c. Identification of Covariate Non Proportional Hazard

Variabel Sex
# VARIABEL Sex
fit<-survfit(Surv(waktu,status)~ sex , data=DataCluster3)
summary(fit)
Call: survfit(formula = Surv(waktu, status) ~ sex, data = DataCluster3)

                sex=0 
 time n.risk n.event survival std.err lower 95% CI upper 95% CI
    1  21185     495   0.9766 0.00104       0.9746       0.9787
    2  20690     658   0.9456 0.00156       0.9425       0.9486
    3  20032     839   0.9060 0.00201       0.9020       0.9099
    4  19193    1072   0.8554 0.00242       0.8506       0.8601
    5  18121    1243   0.7967 0.00277       0.7913       0.8021
    6  16878    1291   0.7358 0.00303       0.7298       0.7417
    7  15587    1376   0.6708 0.00323       0.6645       0.6772
    8  14211    1398   0.6048 0.00336       0.5983       0.6114
    9  12813    1332   0.5419 0.00342       0.5353       0.5487
   10  11481    1247   0.4831 0.00343       0.4764       0.4899
   11  10234    1062   0.4329 0.00340       0.4263       0.4397
   12   9172    1060   0.3829 0.00334       0.3764       0.3895
   13   8112     914   0.3398 0.00325       0.3335       0.3462
   14   7198     811   0.3015 0.00315       0.2954       0.3077
   15   6387     775   0.2649 0.00303       0.2590       0.2709
   16   5612     672   0.2332 0.00291       0.2276       0.2389
   17   4940     604   0.2047 0.00277       0.1993       0.2102
   18   4336     514   0.1804 0.00264       0.1753       0.1857
   19   3822     445   0.1594 0.00251       0.1546       0.1644
   20   3377     358   0.1425 0.00240       0.1379       0.1473
   21   3019     275   0.1295 0.00231       0.1251       0.1341
   22   2744     259   0.1173 0.00221       0.1130       0.1217
   23   2485     218   0.1070 0.00212       0.1029       0.1113
   24   2267     193   0.0979 0.00204       0.0940       0.1020
   25   2074     176   0.0896 0.00196       0.0858       0.0935
   26   1898     125   0.0837 0.00190       0.0800       0.0875
   27   1773     103   0.0788 0.00185       0.0753       0.0825
   28   1670     113   0.0735 0.00179       0.0701       0.0771
   29   1557      69   0.0702 0.00176       0.0669       0.0738
   30   1488      86   0.0662 0.00171       0.0629       0.0696
   31   1402      49   0.0639 0.00168       0.0607       0.0672
   32   1353      44   0.0618 0.00165       0.0586       0.0651
   33   1309      42   0.0598 0.00163       0.0567       0.0631
   34   1267      33   0.0582 0.00161       0.0552       0.0615
   35   1234      35   0.0566 0.00159       0.0536       0.0598
   36   1199      30   0.0552 0.00157       0.0522       0.0583
   37   1169      21   0.0542 0.00156       0.0512       0.0573
   38   1148      18   0.0533 0.00154       0.0504       0.0565
   39   1130      17   0.0525 0.00153       0.0496       0.0556
   40   1113      15   0.0518 0.00152       0.0489       0.0549
   41   1098      13   0.0512 0.00151       0.0483       0.0543
   42   1085      13   0.0506 0.00151       0.0477       0.0536
   43   1072       9   0.0502 0.00150       0.0473       0.0532
   44   1063       8   0.0498 0.00149       0.0470       0.0528
   45   1055      11   0.0493 0.00149       0.0464       0.0523
   46   1044       7   0.0489 0.00148       0.0461       0.0519
   47   1037       6   0.0487 0.00148       0.0459       0.0517
   48   1031       7   0.0483 0.00147       0.0455       0.0513
   49   1024       6   0.0481 0.00147       0.0453       0.0510
   50   1018       3   0.0479 0.00147       0.0451       0.0509
   51   1015       7   0.0476 0.00146       0.0448       0.0505
   52   1008       4   0.0474 0.00146       0.0446       0.0503
   53   1004       3   0.0473 0.00146       0.0445       0.0502
   54   1001       3   0.0471 0.00146       0.0443       0.0500
   55    998       2   0.0470 0.00145       0.0442       0.0500
   56    996       4   0.0468 0.00145       0.0441       0.0498
   57    992       1   0.0468 0.00145       0.0440       0.0497
   58    991       2   0.0467 0.00145       0.0439       0.0496
   59    989       4   0.0465 0.00145       0.0437       0.0494
   60    985       1   0.0464 0.00145       0.0437       0.0494
   61    984       1   0.0464 0.00145       0.0437       0.0493
   62    983       1   0.0464 0.00144       0.0436       0.0493
   63    982       1   0.0463 0.00144       0.0436       0.0492
   65    981       1   0.0463 0.00144       0.0435       0.0492
   73    980       1   0.0462 0.00144       0.0435       0.0491
   74    979       2   0.0461 0.00144       0.0434       0.0490
   76    977       1   0.0461 0.00144       0.0433       0.0490
   78    976       1   0.0460 0.00144       0.0433       0.0489

                sex=1 
 time n.risk n.event survival std.err lower 95% CI upper 95% CI
    1  12713     325   0.9744 0.00140       0.9717       0.9772
    2  12388     468   0.9376 0.00214       0.9334       0.9418
    3  11920     598   0.8906 0.00277       0.8852       0.8960
    4  11322     733   0.8329 0.00331       0.8265       0.8394
    5  10589     804   0.7697 0.00373       0.7624       0.7770
    6   9785     815   0.7056 0.00404       0.6977       0.7135
    7   8970     881   0.6363 0.00427       0.6280       0.6447
    8   8089     780   0.5749 0.00438       0.5664       0.5836
    9   7309     779   0.5136 0.00443       0.5050       0.5224
   10   6530     721   0.4569 0.00442       0.4484       0.4657
   11   5809     577   0.4115 0.00436       0.4031       0.4202
   12   5232     573   0.3665 0.00427       0.3582       0.3749
   13   4659     486   0.3282 0.00416       0.3202       0.3365
   14   4173     441   0.2936 0.00404       0.2857       0.3016
   15   3732     423   0.2603 0.00389       0.2528       0.2680
   16   3309     362   0.2318 0.00374       0.2246       0.2393
   17   2947     283   0.2095 0.00361       0.2026       0.2167
   18   2664     254   0.1896 0.00348       0.1829       0.1965
   19   2410     202   0.1737 0.00336       0.1672       0.1804
   20   2208     170   0.1603 0.00325       0.1541       0.1668
   21   2038     170   0.1469 0.00314       0.1409       0.1532
   22   1868     126   0.1370 0.00305       0.1312       0.1431
   23   1742     109   0.1285 0.00297       0.1228       0.1344
   24   1633      97   0.1208 0.00289       0.1153       0.1266
   25   1536      90   0.1137 0.00282       0.1084       0.1194
   26   1446      70   0.1082 0.00276       0.1030       0.1138
   27   1376      67   0.1030 0.00270       0.0978       0.1084
   28   1309      45   0.0994 0.00265       0.0944       0.1048
   29   1264      55   0.0951 0.00260       0.0901       0.1003
   30   1209      38   0.0921 0.00256       0.0872       0.0973
   31   1171      43   0.0887 0.00252       0.0839       0.0938
   32   1128      28   0.0865 0.00249       0.0818       0.0916
   33   1100      23   0.0847 0.00247       0.0800       0.0897
   34   1077      26   0.0827 0.00244       0.0780       0.0876
   35   1051      16   0.0814 0.00243       0.0768       0.0863
   36   1035      19   0.0799 0.00240       0.0753       0.0848
   37   1016      17   0.0786 0.00239       0.0740       0.0834
   38    999      14   0.0775 0.00237       0.0730       0.0823
   39    985       8   0.0769 0.00236       0.0724       0.0816
   40    977      11   0.0760 0.00235       0.0715       0.0807
   41    966      11   0.0751 0.00234       0.0707       0.0798
   42    955       6   0.0746 0.00233       0.0702       0.0794
   43    949       5   0.0743 0.00233       0.0698       0.0790
   44    944       3   0.0740 0.00232       0.0696       0.0787
   45    941       4   0.0737 0.00232       0.0693       0.0784
   46    937       2   0.0735 0.00232       0.0691       0.0782
   47    935       2   0.0734 0.00231       0.0690       0.0781
   48    933       4   0.0731 0.00231       0.0687       0.0777
   49    929       4   0.0728 0.00230       0.0684       0.0774
   50    925       1   0.0727 0.00230       0.0683       0.0773
   51    924       4   0.0724 0.00230       0.0680       0.0770
   52    920       4   0.0721 0.00229       0.0677       0.0767
   53    916       3   0.0718 0.00229       0.0675       0.0764
   54    913       3   0.0716 0.00229       0.0672       0.0762
   56    910       2   0.0714 0.00228       0.0671       0.0760
   57    908       2   0.0713 0.00228       0.0669       0.0759
   66    906       1   0.0712 0.00228       0.0669       0.0758
   70    905       1   0.0711 0.00228       0.0668       0.0757
   72    904       1   0.0710 0.00228       0.0667       0.0756
   77    903       1   0.0710 0.00228       0.0666       0.0756
   93    902       1   0.0709 0.00228       0.0665       0.0755
ggsurvplot(fit, data = DataCluster3, 
pval = TRUE, conf.int = TRUE,
 risk.table = TRUE, # Add risk table
 risk.table.col = "strata", # Change risk table color by groups
 linetype = "strata", # Change line type by groups
 surv.median.line = "hv", # Specify median survival
 ggtheme = theme_bw(), # Change ggplot2 theme
 palette = c("#E7B800", "#2E9FDF"))

Fungsi waktu dalam variabel ini menggunakan fungsi waktu \(t\) karena variabel sex memiliki nevent pada variabel ini tidak konstan pada selang waktu tertentu

Variabel Age
# VARIABEL Age
fit<-survfit(Surv(waktu,status)~ Age , data=DataCluster3)
summary(fit)
Call: survfit(formula = Surv(waktu, status) ~ Age, data = DataCluster3)

                Age=0 
 time n.risk n.event survival  std.err lower 95% CI upper 95% CI
    1  11145     312   0.9720 0.001563      0.96895       0.9751
    2  10833     393   0.9367 0.002306      0.93223       0.9413
    3  10440     484   0.8933 0.002924      0.88760       0.8991
    4   9956     609   0.8387 0.003484      0.83187       0.8455
    5   9347     673   0.7783 0.003935      0.77061       0.7860
    6   8674     689   0.7165 0.004269      0.70815       0.7249
    7   7985     733   0.6507 0.004516      0.64190       0.6596
    8   7252     728   0.5854 0.004667      0.57630       0.5946
    9   6524     706   0.5220 0.004732      0.51284       0.5314
   10   5818     660   0.4628 0.004723      0.45364       0.4722
   11   5158     573   0.4114 0.004661      0.40236       0.4206
   12   4585     587   0.3587 0.004543      0.34993       0.3677
   13   3998     494   0.3144 0.004398      0.30590       0.3231
   14   3504     445   0.2745 0.004227      0.26631       0.2829
   15   3059     435   0.2354 0.004019      0.22770       0.2435
   16   2624     348   0.2042 0.003819      0.19687       0.2118
   17   2276     314   0.1760 0.003608      0.16911       0.1833
   18   1962     281   0.1508 0.003390      0.14433       0.1576
   19   1681     240   0.1293 0.003178      0.12321       0.1357
   20   1441     184   0.1128 0.002996      0.10706       0.1188
   21   1257     165   0.0980 0.002816      0.09261       0.1037
   22   1092     136   0.0858 0.002653      0.08073       0.0911
   23    956     122   0.0748 0.002492      0.07010       0.0799
   24    834      99   0.0659 0.002351      0.06150       0.0707
   25    735      94   0.0575 0.002205      0.05335       0.0620
   26    641      60   0.0521 0.002106      0.04816       0.0564
   27    581      63   0.0465 0.001994      0.04273       0.0506
   28    518      57   0.0414 0.001886      0.03783       0.0452
   29    461      47   0.0371 0.001791      0.03380       0.0408
   30    414      45   0.0331 0.001695      0.02995       0.0366
   31    369      28   0.0306 0.001631      0.02756       0.0340
   32    341      29   0.0280 0.001563      0.02509       0.0312
   33    312      26   0.0257 0.001498      0.02289       0.0288
   34    286      24   0.0235 0.001435      0.02086       0.0265
   35    262       8   0.0228 0.001414      0.02018       0.0257
   36    254      20   0.0210 0.001358      0.01850       0.0238
   37    234      20   0.0192 0.001300      0.01682       0.0219
   38    214      12   0.0181 0.001264      0.01581       0.0208
   39    202      10   0.0172 0.001233      0.01497       0.0198
   40    192       8   0.0165 0.001207      0.01431       0.0191
   41    184       9   0.0157 0.001178      0.01356       0.0182
   42    175       5   0.0153 0.001161      0.01314       0.0177
   43    170       4   0.0149 0.001147      0.01281       0.0173
   44    166       4   0.0145 0.001134      0.01248       0.0169
   45    162       8   0.0138 0.001106      0.01181       0.0162
   46    154       3   0.0135 0.001095      0.01156       0.0159
   47    151       2   0.0134 0.001088      0.01140       0.0157
   48    149       4   0.0130 0.001073      0.01107       0.0153
   49    145       2   0.0128 0.001066      0.01090       0.0151
   50    143       3   0.0126 0.001055      0.01066       0.0148
   51    140       4   0.0122 0.001040      0.01033       0.0144
   52    136       1   0.0121 0.001036      0.01024       0.0143
   53    135       3   0.0118 0.001025      0.01000       0.0140
   54    132       2   0.0117 0.001017      0.00983       0.0138
   56    130       2   0.0115 0.001009      0.00967       0.0136
   57    128       2   0.0113 0.001001      0.00950       0.0134
   59    126       1   0.0112 0.000998      0.00942       0.0134
   60    125       1   0.0111 0.000994      0.00934       0.0133
   62    124       1   0.0110 0.000990      0.00926       0.0132
   66    123       1   0.0109 0.000986      0.00918       0.0131
   76    122       1   0.0109 0.000982      0.00909       0.0130

                Age=1 
 time n.risk n.event survival  std.err lower 95% CI upper 95% CI
    1  22753     508   0.9777 0.000979       0.9758       0.9796
    2  22245     733   0.9455 0.001505       0.9425       0.9484
    3  21512     953   0.9036 0.001957       0.8997       0.9074
    4  20559    1196   0.8510 0.002361       0.8464       0.8556
    5  19363    1374   0.7906 0.002697       0.7854       0.7959
    6  17989    1417   0.7283 0.002949       0.7226       0.7341
    7  16572    1524   0.6614 0.003137       0.6552       0.6675
    8  15048    1450   0.5976 0.003251       0.5913       0.6040
    9  13598    1405   0.5359 0.003306       0.5294       0.5424
   10  12193    1308   0.4784 0.003312       0.4720       0.4849
   11  10885    1066   0.4315 0.003284       0.4252       0.4380
   12   9819    1046   0.3856 0.003227       0.3793       0.3920
   13   8773     906   0.3458 0.003153       0.3396       0.3520
   14   7867     807   0.3103 0.003067       0.3043       0.3164
   15   7060     763   0.2768 0.002966       0.2710       0.2826
   16   6297     686   0.2466 0.002858       0.2411       0.2523
   17   5611     573   0.2214 0.002753       0.2161       0.2269
   18   5038     487   0.2000 0.002652       0.1949       0.2053
   19   4551     407   0.1821 0.002559       0.1772       0.1872
   20   4144     344   0.1670 0.002473       0.1622       0.1719
   21   3800     280   0.1547 0.002397       0.1501       0.1595
   22   3520     249   0.1438 0.002326       0.1393       0.1484
   23   3271     205   0.1348 0.002264       0.1304       0.1393
   24   3066     191   0.1264 0.002203       0.1221       0.1307
   25   2875     172   0.1188 0.002145       0.1147       0.1231
   26   2703     135   0.1129 0.002098       0.1088       0.1171
   27   2568     107   0.1082 0.002059       0.1042       0.1123
   28   2461     101   0.1037 0.002021       0.0998       0.1078
   29   2360      77   0.1003 0.001992       0.0965       0.1043
   30   2283      79   0.0969 0.001961       0.0931       0.1008
   31   2204      64   0.0941 0.001935       0.0903       0.0979
   32   2140      43   0.0922 0.001918       0.0885       0.0960
   33   2097      39   0.0904 0.001902       0.0868       0.0943
   34   2058      35   0.0889 0.001887       0.0853       0.0927
   35   2023      43   0.0870 0.001869       0.0834       0.0908
   36   1980      29   0.0857 0.001856       0.0822       0.0895
   37   1951      18   0.0850 0.001848       0.0814       0.0887
   38   1933      20   0.0841 0.001840       0.0805       0.0878
   39   1913      15   0.0834 0.001833       0.0799       0.0871
   40   1898      18   0.0826 0.001825       0.0791       0.0863
   41   1880      15   0.0820 0.001819       0.0785       0.0856
   42   1865      14   0.0814 0.001812       0.0779       0.0850
   43   1851      10   0.0809 0.001808       0.0774       0.0845
   44   1841       7   0.0806 0.001805       0.0771       0.0842
   45   1834       7   0.0803 0.001802       0.0768       0.0839
   46   1827       6   0.0800 0.001799       0.0766       0.0836
   47   1821       6   0.0798 0.001796       0.0763       0.0834
   48   1815       7   0.0795 0.001793       0.0760       0.0831
   49   1808       8   0.0791 0.001789       0.0757       0.0827
   50   1800       1   0.0791 0.001789       0.0756       0.0827
   51   1799       7   0.0788 0.001786       0.0753       0.0823
   52   1792       7   0.0785 0.001783       0.0750       0.0820
   53   1785       3   0.0783 0.001781       0.0749       0.0819
   54   1782       4   0.0781 0.001779       0.0747       0.0817
   55   1778       2   0.0781 0.001778       0.0746       0.0816
   56   1776       4   0.0779 0.001777       0.0745       0.0814
   57   1772       1   0.0778 0.001776       0.0744       0.0814
   58   1771       2   0.0777 0.001775       0.0743       0.0813
   59   1769       3   0.0776 0.001774       0.0742       0.0812
   61   1766       1   0.0776 0.001773       0.0742       0.0811
   63   1765       1   0.0775 0.001773       0.0741       0.0811
   65   1764       1   0.0775 0.001772       0.0741       0.0810
   70   1763       1   0.0774 0.001772       0.0740       0.0810
   72   1762       1   0.0774 0.001772       0.0740       0.0809
   73   1761       1   0.0774 0.001771       0.0740       0.0809
   74   1760       2   0.0773 0.001770       0.0739       0.0808
   77   1758       1   0.0772 0.001770       0.0738       0.0808
   78   1757       1   0.0772 0.001769       0.0738       0.0807
   93   1756       1   0.0771 0.001769       0.0737       0.0807
ggsurvplot(fit, data = DataCluster3, 
pval = TRUE, conf.int = TRUE,
 risk.table = TRUE, # Add risk table
 risk.table.col = "strata", # Change risk table color by groups
 linetype = "strata", # Change line type by groups
 surv.median.line = "hv", # Specify median survival
 ggtheme = theme_bw(), # Change ggplot2 theme
 palette = c("#E7B800", "#2E9FDF"))

Note the graph of the elderly patient’s speed drops drastically on day 27 but after day 27 it was constant until the end of the study. so the function is

\[ g(t)= \begin{cases} 1, & \mbox{jika}\ t\mbox{ < 27} \\ 0, & \mbox{jika}\ t\mbox{ >= 27} \end{cases}\]

Variabel Hypertension
# VARIABEL hypertension
fit<-survfit(Surv(waktu,status)~ hypertension , data=DataCluster3)
summary(fit)
Call: survfit(formula = Surv(waktu, status) ~ hypertension, data = DataCluster3)

                hypertension=0 
 time n.risk n.event survival  std.err lower 95% CI upper 95% CI
    1  18703     478  0.97444 0.001154      0.97218      0.97671
    2  18225     624  0.94108 0.001722      0.93771      0.94446
    3  17601     819  0.89729 0.002220      0.89295      0.90165
    4  16782    1022  0.84265 0.002663      0.83744      0.84788
    5  15760    1138  0.78180 0.003020      0.77590      0.78774
    6  14622    1160  0.71978 0.003284      0.71337      0.72624
    7  13462    1254  0.65273 0.003481      0.64594      0.65959
    8  12208    1233  0.58680 0.003601      0.57979      0.59390
    9  10975    1242  0.52040 0.003653      0.51329      0.52761
   10   9733    1139  0.45950 0.003644      0.45241      0.46670
   11   8594     943  0.40908 0.003595      0.40209      0.41619
   12   7651     943  0.35866 0.003507      0.35185      0.36560
   13   6708     846  0.31343 0.003392      0.30685      0.32014
   14   5862     752  0.27322 0.003258      0.26691      0.27968
   15   5110     687  0.23649 0.003107      0.23047      0.24266
   16   4423     600  0.20441 0.002949      0.19871      0.21027
   17   3823     526  0.17628 0.002786      0.17090      0.18183
   18   3297     465  0.15142 0.002621      0.14637      0.15664
   19   2832     403  0.12987 0.002458      0.12514      0.13478
   20   2429     307  0.11346 0.002319      0.10900      0.11810
   21   2122     293  0.09779 0.002172      0.09363      0.10214
   22   1829     242  0.08485 0.002038      0.08095      0.08894
   23   1587     221  0.07304 0.001903      0.06940      0.07686
   24   1366     174  0.06373 0.001786      0.06033      0.06733
   25   1192     163  0.05502 0.001667      0.05185      0.05838
   26   1029     122  0.04849 0.001571      0.04551      0.05167
   27    907     105  0.04288 0.001481      0.04007      0.04588
   28    802     109  0.03705 0.001381      0.03444      0.03986
   29    693      75  0.03304 0.001307      0.03058      0.03571
   30    618      70  0.02930 0.001233      0.02698      0.03182
   31    548      58  0.02620 0.001168      0.02401      0.02859
   32    490      38  0.02417 0.001123      0.02206      0.02647
   33    452      36  0.02224 0.001078      0.02023      0.02446
   34    416      30  0.02064 0.001040      0.01870      0.02278
   35    386      32  0.01893 0.000996      0.01707      0.02098
   36    354      32  0.01722 0.000951      0.01545      0.01919
   37    322      26  0.01583 0.000913      0.01414      0.01772
   38    296      20  0.01476 0.000882      0.01313      0.01659
   39    276      17  0.01385 0.000854      0.01227      0.01563
   40    259      15  0.01305 0.000830      0.01152      0.01478
   41    244      15  0.01224 0.000804      0.01077      0.01393
   42    229      13  0.01155 0.000781      0.01011      0.01319
   43    216       6  0.01123 0.000770      0.00982      0.01284
   44    210       7  0.01085 0.000758      0.00947      0.01245
   45    203      11  0.01027 0.000737      0.00892      0.01182
   46    192       6  0.00994 0.000726      0.00862      0.01147
   47    186       6  0.00962 0.000714      0.00832      0.01113
   48    180       7  0.00925 0.000700      0.00797      0.01073
   49    173       6  0.00893 0.000688      0.00768      0.01038
   50    167       2  0.00882 0.000684      0.00758      0.01027
   51    165       8  0.00839 0.000667      0.00718      0.00981
   52    157       5  0.00813 0.000657      0.00694      0.00952
   53    152       3  0.00797 0.000650      0.00679      0.00935
   54    149       3  0.00781 0.000644      0.00664      0.00918
   55    146       2  0.00770 0.000639      0.00654      0.00906
   56    144       3  0.00754 0.000632      0.00640      0.00889
   58    141       1  0.00749 0.000630      0.00635      0.00883
   59    140       3  0.00733 0.000624      0.00620      0.00865
   60    137       1  0.00727 0.000621      0.00615      0.00860
   61    136       1  0.00722 0.000619      0.00610      0.00854
   63    135       1  0.00716 0.000617      0.00605      0.00848
   65    134       1  0.00711 0.000614      0.00600      0.00842
   66    133       1  0.00706 0.000612      0.00595      0.00837
   72    132       1  0.00700 0.000610      0.00591      0.00831
   73    131       1  0.00695 0.000607      0.00586      0.00825
   74    130       1  0.00690 0.000605      0.00581      0.00819
   78    129       1  0.00684 0.000603      0.00576      0.00813

                hypertension=1 
 time n.risk n.event survival std.err lower 95% CI upper 95% CI
    1  15195     342    0.977 0.00120        0.975        0.980
    2  14853     502    0.944 0.00186        0.941        0.948
    3  14351     618    0.904 0.00239        0.899        0.908
    4  13733     783    0.852 0.00288        0.847        0.858
    5  12950     909    0.792 0.00329        0.786        0.799
    6  12041     946    0.730 0.00360        0.723        0.737
    7  11095    1003    0.664 0.00383        0.657        0.672
    8  10092     945    0.602 0.00397        0.594        0.610
    9   9147     869    0.545 0.00404        0.537        0.553
   10   8278     829    0.490 0.00406        0.482        0.498
   11   7449     696    0.444 0.00403        0.437        0.452
   12   6753     690    0.399 0.00397        0.391        0.407
   13   6063     554    0.363 0.00390        0.355        0.370
   14   5509     500    0.330 0.00381        0.322        0.337
   15   5009     511    0.296 0.00370        0.289        0.303
   16   4498     434    0.267 0.00359        0.261        0.275
   17   4064     361    0.244 0.00348        0.237        0.251
   18   3703     303    0.224 0.00338        0.217        0.230
   19   3400     244    0.208 0.00329        0.201        0.214
   20   3156     221    0.193 0.00320        0.187        0.200
   21   2935     152    0.183 0.00314        0.177        0.189
   22   2783     143    0.174 0.00307        0.168        0.180
   23   2640     106    0.167 0.00302        0.161        0.173
   24   2534     116    0.159 0.00297        0.153        0.165
   25   2418     103    0.152 0.00292        0.147        0.158
   26   2315      73    0.148 0.00288        0.142        0.153
   27   2242      65    0.143 0.00284        0.138        0.149
   28   2177      49    0.140 0.00282        0.135        0.146
   29   2128      49    0.137 0.00279        0.131        0.142
   30   2079      54    0.133 0.00276        0.128        0.139
   31   2025      34    0.131 0.00274        0.126        0.137
   32   1991      34    0.129 0.00272        0.124        0.134
   33   1957      29    0.127 0.00270        0.122        0.132
   34   1928      29    0.125 0.00268        0.120        0.130
   35   1899      19    0.124 0.00267        0.119        0.129
   36   1880      17    0.123 0.00266        0.118        0.128
   37   1863      12    0.122 0.00265        0.117        0.127
   38   1851      12    0.121 0.00265        0.116        0.126
   39   1839       8    0.121 0.00264        0.115        0.126
   40   1831      11    0.120 0.00263        0.115        0.125
   41   1820       9    0.119 0.00263        0.114        0.124
   42   1811       6    0.119 0.00262        0.114        0.124
   43   1805       8    0.118 0.00262        0.113        0.124
   44   1797       4    0.118 0.00262        0.113        0.123
   45   1793       4    0.118 0.00261        0.113        0.123
   46   1789       3    0.118 0.00261        0.113        0.123
   47   1786       2    0.117 0.00261        0.112        0.123
   48   1784       4    0.117 0.00261        0.112        0.122
   49   1780       4    0.117 0.00261        0.112        0.122
   50   1776       2    0.117 0.00261        0.112        0.122
   51   1774       3    0.117 0.00260        0.112        0.122
   52   1771       3    0.116 0.00260        0.111        0.122
   53   1768       3    0.116 0.00260        0.111        0.121
   54   1765       3    0.116 0.00260        0.111        0.121
   56   1762       3    0.116 0.00260        0.111        0.121
   57   1759       3    0.116 0.00259        0.111        0.121
   58   1756       1    0.115 0.00259        0.111        0.121
   59   1755       1    0.115 0.00259        0.110        0.121
   62   1754       1    0.115 0.00259        0.110        0.121
   70   1753       1    0.115 0.00259        0.110        0.120
   74   1752       1    0.115 0.00259        0.110        0.120
   76   1751       1    0.115 0.00259        0.110        0.120
   77   1750       1    0.115 0.00259        0.110        0.120
   93   1749       1    0.115 0.00259        0.110        0.120
ggsurvplot(fit, data = DataCluster3, 
pval = TRUE, conf.int = TRUE,
 risk.table = "abs_pct", # Add risk table
 risk.table.col = "strata", # Change risk table color by groups
 linetype  = "strata", # Change line type by groups
 surv.median.line = "hv", # Specify median survival
 ggtheme = theme_bw(), # Change ggplot2 theme
 palette = c("#E7B800", "#2E9FDF"))

Pay attention to the graph of the speed of the hypertension patient dropping rapidly on the 31st day but after the 31st day it was constant until the end of the study. so the function of the upper side is

\[ g(t)= \begin{cases} 1, & \mbox{jika}\ t\mbox{ < 31} \\ 0, & \mbox{jika}\ t\mbox{ >= 31} \end{cases}\] ##### Variabel Diabetes

# VARIABEL diabetes
fit<-survfit(Surv(waktu,status)~ diabetes, data=DataCluster3)
summary(fit)
Call: survfit(formula = Surv(waktu, status) ~ diabetes, data = DataCluster3)

                diabetes=0 
 time n.risk n.event survival  std.err lower 95% CI upper 95% CI
    1  20517     500   0.9756 0.001076       0.9735       0.9777
    2  20017     659   0.9435 0.001612       0.9404       0.9467
    3  19358     851   0.9020 0.002075       0.8980       0.9061
    4  18507    1063   0.8502 0.002491       0.8454       0.8551
    5  17444    1256   0.7890 0.002849       0.7834       0.7946
    6  16188    1271   0.7271 0.003110       0.7210       0.7332
    7  14917    1368   0.6604 0.003306       0.6539       0.6669
    8  13549    1347   0.5947 0.003427       0.5880       0.6015
    9  12202    1318   0.5305 0.003484       0.5237       0.5374
   10  10884    1273   0.4684 0.003484       0.4617       0.4753
   11   9611    1042   0.4177 0.003443       0.4110       0.4245
   12   8569    1030   0.3675 0.003366       0.3609       0.3741
   13   7539     922   0.3225 0.003263       0.3162       0.3290
   14   6617     822   0.2824 0.003143       0.2764       0.2887
   15   5795     774   0.2447 0.003001       0.2389       0.2507
   16   5021     684   0.2114 0.002850       0.2059       0.2170
   17   4337     597   0.1823 0.002695       0.1771       0.1876
   18   3740     526   0.1567 0.002538       0.1518       0.1617
   19   3214     444   0.1350 0.002386       0.1304       0.1398
   20   2770     355   0.1177 0.002250       0.1134       0.1222
   21   2415     289   0.1036 0.002128       0.0995       0.1079
   22   2126     281   0.0899 0.001997       0.0861       0.0939
   23   1845     236   0.0784 0.001877       0.0748       0.0822
   24   1609     197   0.0688 0.001767       0.0654       0.0724
   25   1412     177   0.0602 0.001660       0.0570       0.0635
   26   1235     125   0.0541 0.001579       0.0511       0.0573
   27   1110     113   0.0486 0.001501       0.0457       0.0516
   28    997     107   0.0434 0.001422       0.0407       0.0463
   29    890      87   0.0391 0.001354       0.0366       0.0419
   30    803      87   0.0349 0.001281       0.0325       0.0375
   31    716      67   0.0316 0.001222       0.0293       0.0341
   32    649      46   0.0294 0.001179       0.0272       0.0318
   33    603      43   0.0273 0.001138       0.0252       0.0296
   34    560      37   0.0255 0.001100       0.0234       0.0277
   35    523      39   0.0236 0.001060       0.0216       0.0258
   36    484      38   0.0217 0.001018       0.0198       0.0238
   37    446      31   0.0202 0.000983       0.0184       0.0222
   38    415      20   0.0193 0.000959       0.0175       0.0212
   39    395      13   0.0186 0.000944       0.0169       0.0206
   40    382      19   0.0177 0.000920       0.0160       0.0196
   41    363      19   0.0168 0.000896       0.0151       0.0186
   42    344      13   0.0161 0.000880       0.0145       0.0180
   43    331       8   0.0157 0.000869       0.0141       0.0175
   44    323       6   0.0155 0.000861       0.0139       0.0172
   45    317      10   0.0150 0.000848       0.0134       0.0167
   46    307       5   0.0147 0.000841       0.0132       0.0165
   47    302       7   0.0144 0.000831       0.0128       0.0161
   48    295       8   0.0140 0.000820       0.0125       0.0157
   49    287       7   0.0136 0.000810       0.0121       0.0153
   50    280       3   0.0135 0.000806       0.0120       0.0152
   51    277       7   0.0132 0.000796       0.0117       0.0148
   52    270       6   0.0129 0.000787       0.0114       0.0145
   53    264       2   0.0128 0.000784       0.0113       0.0144
   54    262       2   0.0127 0.000781       0.0112       0.0143
   55    260       1   0.0126 0.000779       0.0112       0.0142
   56    259       5   0.0124 0.000772       0.0110       0.0140
   57    254       2   0.0123 0.000769       0.0109       0.0139
   58    252       1   0.0122 0.000767       0.0108       0.0138
   59    251       3   0.0121 0.000763       0.0107       0.0137
   60    248       1   0.0120 0.000761       0.0106       0.0136
   61    247       1   0.0120 0.000760       0.0106       0.0136
   62    246       1   0.0119 0.000758       0.0105       0.0135
   65    245       1   0.0119 0.000757       0.0105       0.0135
   66    244       1   0.0118 0.000755       0.0105       0.0134
   70    243       1   0.0118 0.000754       0.0104       0.0134
   72    242       1   0.0117 0.000752       0.0104       0.0133
   73    241       1   0.0117 0.000751       0.0103       0.0133
   74    240       1   0.0116 0.000749       0.0103       0.0132
   78    239       1   0.0116 0.000748       0.0102       0.0132
   93    238       1   0.0116 0.000746       0.0102       0.0131

                diabetes=1 
 time n.risk n.event survival std.err lower 95% CI upper 95% CI
    1  13381     320    0.976 0.00132        0.974        0.979
    2  13061     467    0.941 0.00203        0.937        0.945
    3  12594     586    0.897 0.00262        0.892        0.903
    4  12008     742    0.842 0.00315        0.836        0.848
    5  11266     791    0.783 0.00356        0.776        0.790
    6  10475     835    0.720 0.00388        0.713        0.728
    7   9640     889    0.654 0.00411        0.646        0.662
    8   8751     831    0.592 0.00425        0.584        0.600
    9   7920     793    0.533 0.00431        0.524        0.541
   10   7127     695    0.481 0.00432        0.472        0.489
   11   6432     597    0.436 0.00429        0.428        0.445
   12   5835     603    0.391 0.00422        0.383        0.399
   13   5232     478    0.355 0.00414        0.347        0.363
   14   4754     430    0.323 0.00404        0.315        0.331
   15   4324     424    0.291 0.00393        0.284        0.299
   16   3900     350    0.265 0.00382        0.258        0.273
   17   3550     290    0.244 0.00371        0.236        0.251
   18   3260     242    0.226 0.00361        0.219        0.233
   19   3018     203    0.210 0.00352        0.204        0.217
   20   2815     173    0.197 0.00344        0.191        0.204
   21   2642     156    0.186 0.00336        0.179        0.192
   22   2486     104    0.178 0.00331        0.172        0.185
   23   2382      91    0.171 0.00326        0.165        0.178
   24   2291      93    0.164 0.00320        0.158        0.171
   25   2198      89    0.158 0.00315        0.152        0.164
   26   2109      70    0.152 0.00311        0.146        0.159
   27   2039      57    0.148 0.00307        0.142        0.154
   28   1982      51    0.144 0.00304        0.138        0.150
   29   1931      37    0.142 0.00301        0.136        0.148
   30   1894      37    0.139 0.00299        0.133        0.145
   31   1857      25    0.137 0.00297        0.131        0.143
   32   1832      26    0.135 0.00295        0.129        0.141
   33   1806      22    0.133 0.00294        0.128        0.139
   34   1784      22    0.132 0.00292        0.126        0.138
   35   1762      12    0.131 0.00291        0.125        0.137
   36   1750      11    0.130 0.00291        0.124        0.136
   37   1739       7    0.129 0.00290        0.124        0.135
   38   1732      12    0.129 0.00289        0.123        0.134
   39   1720      12    0.128 0.00288        0.122        0.133
   40   1708       7    0.127 0.00288        0.122        0.133
   41   1701       5    0.127 0.00288        0.121        0.133
   42   1696       6    0.126 0.00287        0.121        0.132
   43   1690       6    0.126 0.00287        0.120        0.132
   44   1684       5    0.125 0.00286        0.120        0.131
   45   1679       5    0.125 0.00286        0.120        0.131
   46   1674       4    0.125 0.00286        0.119        0.131
   47   1670       1    0.125 0.00286        0.119        0.130
   48   1669       3    0.125 0.00285        0.119        0.130
   49   1666       3    0.124 0.00285        0.119        0.130
   50   1663       1    0.124 0.00285        0.119        0.130
   51   1662       4    0.124 0.00285        0.118        0.130
   52   1658       2    0.124 0.00285        0.118        0.129
   53   1656       4    0.123 0.00284        0.118        0.129
   54   1652       4    0.123 0.00284        0.118        0.129
   55   1648       1    0.123 0.00284        0.118        0.129
   56   1647       1    0.123 0.00284        0.118        0.129
   57   1646       1    0.123 0.00284        0.117        0.129
   58   1645       1    0.123 0.00284        0.117        0.129
   59   1644       1    0.123 0.00284        0.117        0.128
   63   1643       1    0.123 0.00284        0.117        0.128
   74   1642       1    0.123 0.00284        0.117        0.128
   76   1641       1    0.123 0.00283        0.117        0.128
   77   1640       1    0.122 0.00283        0.117        0.128
ggsurvplot(fit, data = DataCluster3, 
pval = TRUE, conf.int = TRUE,
 risk.table = "nrisk_cumcensor", # Add risk table
 risk.table.col = "strata", # Change risk table color by groups
 linetype = "strata", # Change line type by groups
 surv.median.line = "hv", # Specify median survival
 ggtheme = theme_bw(), # Change ggplot2 theme
 palette = c("#E7B800", "#2E9FDF"))

Notice the graph speed of the diabetes patient drops rapidly on day 31st but after the 31st day constant until the end of the study. so the heavside function is

\[ g(t)= \begin{cases} 1, & \mbox{jika}\ t\mbox{ < 30} \\ 0, & \mbox{jika}\ t\mbox{ >= 30} \end{cases}\]

Variabel Renal Chronic
# VARIABEL Renal Chronic
fit<-survfit(Surv(waktu,status)~ renal_chronic, data=DataCluster3)
summary(fit)
Call: survfit(formula = Surv(waktu, status) ~ renal_chronic, data = DataCluster3)

                renal_chronic=0 
 time n.risk n.event survival  std.err lower 95% CI upper 95% CI
    1  31011     721   0.9768 0.000856       0.9751       0.9784
    2  30290    1015   0.9440 0.001305       0.9415       0.9466
    3  29275    1254   0.9036 0.001676       0.9003       0.9069
    4  28021    1604   0.8519 0.002017       0.8479       0.8558
    5  26417    1847   0.7923 0.002304       0.7878       0.7968
    6  24570    1898   0.7311 0.002518       0.7262       0.7360
    7  22672    2066   0.6645 0.002681       0.6592       0.6697
    8  20606    1997   0.6001 0.002782       0.5946       0.6056
    9  18609    1938   0.5376 0.002831       0.5321       0.5432
   10  16671    1856   0.4777 0.002836       0.4722       0.4833
   11  14815    1542   0.4280 0.002810       0.4225       0.4336
   12  13273    1532   0.3786 0.002754       0.3732       0.3840
   13  11741    1316   0.3362 0.002683       0.3310       0.3415
   14  10425    1187   0.2979 0.002597       0.2928       0.3030
   15   9238    1129   0.2615 0.002495       0.2566       0.2664
   16   8109     986   0.2297 0.002389       0.2251       0.2344
   17   7123     851   0.2023 0.002281       0.1978       0.2068
   18   6272     719   0.1791 0.002177       0.1748       0.1834
   19   5553     622   0.1590 0.002077       0.1550       0.1631
   20   4931     493   0.1431 0.001989       0.1393       0.1471
   21   4438     414   0.1298 0.001908       0.1261       0.1336
   22   4024     368   0.1179 0.001831       0.1144       0.1215
   23   3656     312   0.1078 0.001761       0.1044       0.1113
   24   3344     281   0.0988 0.001694       0.0955       0.1021
   25   3063     245   0.0909 0.001632       0.0877       0.0941
   26   2818     182   0.0850 0.001584       0.0820       0.0882
   27   2636     164   0.0797 0.001538       0.0768       0.0828
   28   2472     152   0.0748 0.001494       0.0719       0.0778
   29   2320     116   0.0711 0.001459       0.0683       0.0740
   30   2204     116   0.0673 0.001423       0.0646       0.0702
   31   2088      86   0.0646 0.001395       0.0619       0.0674
   32   2002      68   0.0624 0.001373       0.0597       0.0651
   33   1934      61   0.0604 0.001353       0.0578       0.0631
   34   1873      56   0.0586 0.001334       0.0560       0.0613
   35   1817      50   0.0570 0.001316       0.0545       0.0596
   36   1767      47   0.0555 0.001300       0.0530       0.0581
   37   1720      34   0.0544 0.001288       0.0519       0.0570
   38   1686      29   0.0534 0.001277       0.0510       0.0560
   39   1657      22   0.0527 0.001269       0.0503       0.0553
   40   1635      23   0.0520 0.001261       0.0496       0.0545
   41   1612      22   0.0513 0.001252       0.0489       0.0538
   42   1590      18   0.0507 0.001246       0.0483       0.0532
   43   1572      14   0.0502 0.001240       0.0479       0.0527
   44   1558      11   0.0499 0.001236       0.0475       0.0524
   45   1547      14   0.0494 0.001231       0.0471       0.0519
   46   1533       9   0.0491 0.001228       0.0468       0.0516
   47   1524       8   0.0489 0.001224       0.0465       0.0513
   48   1516      11   0.0485 0.001220       0.0462       0.0510
   49   1505       9   0.0482 0.001217       0.0459       0.0507
   50   1496       3   0.0481 0.001216       0.0458       0.0506
   51   1493      10   0.0478 0.001212       0.0455       0.0503
   52   1483       8   0.0476 0.001209       0.0453       0.0500
   53   1475       4   0.0474 0.001207       0.0451       0.0499
   54   1471       5   0.0473 0.001205       0.0450       0.0497
   55   1466       2   0.0472 0.001204       0.0449       0.0496
   56   1464       5   0.0470 0.001202       0.0447       0.0495
   57   1459       1   0.0470 0.001202       0.0447       0.0494
   58   1458       2   0.0470 0.001201       0.0447       0.0494
   59   1456       4   0.0468 0.001200       0.0445       0.0492
   60   1452       1   0.0468 0.001199       0.0445       0.0492
   61   1451       1   0.0468 0.001199       0.0445       0.0492
   62   1450       1   0.0467 0.001198       0.0444       0.0491
   63   1449       1   0.0467 0.001198       0.0444       0.0491
   65   1448       1   0.0467 0.001198       0.0444       0.0491
   66   1447       1   0.0466 0.001197       0.0443       0.0490
   70   1446       1   0.0466 0.001197       0.0443       0.0490
   72   1445       1   0.0466 0.001197       0.0443       0.0490
   73   1444       1   0.0465 0.001196       0.0442       0.0489
   74   1443       2   0.0465 0.001195       0.0442       0.0489
   76   1441       1   0.0464 0.001195       0.0442       0.0488
   77   1440       1   0.0464 0.001195       0.0441       0.0488
   78   1439       1   0.0464 0.001194       0.0441       0.0488

                renal_chronic=1 
 time n.risk n.event survival std.err lower 95% CI upper 95% CI
    1   2887      99    0.966 0.00339        0.959        0.972
    2   2788     111    0.927 0.00483        0.918        0.937
    3   2677     183    0.864 0.00638        0.851        0.876
    4   2494     201    0.794 0.00752        0.780        0.809
    5   2293     200    0.725 0.00831        0.709        0.741
    6   2093     208    0.653 0.00886        0.636        0.671
    7   1885     191    0.587 0.00916        0.569        0.605
    8   1694     181    0.524 0.00929        0.506        0.543
    9   1513     173    0.464 0.00928        0.446        0.483
   10   1340     112    0.425 0.00920        0.408        0.444
   11   1228      97    0.392 0.00908        0.374        0.410
   12   1131     101    0.357 0.00892        0.340        0.375
   13   1030      84    0.328 0.00874        0.311        0.345
   14    946      65    0.305 0.00857        0.289        0.322
   15    881      69    0.281 0.00837        0.265        0.298
   16    812      48    0.265 0.00821        0.249        0.281
   17    764      36    0.252 0.00808        0.237        0.269
   18    728      49    0.235 0.00789        0.220        0.251
   19    679      25    0.227 0.00779        0.212        0.242
   20    654      35    0.214 0.00764        0.200        0.230
   21    619      31    0.204 0.00750        0.189        0.219
   22    588      17    0.198 0.00741        0.184        0.213
   23    571      15    0.193 0.00734        0.179        0.208
   24    556       9    0.189 0.00729        0.176        0.204
   25    547      21    0.182 0.00718        0.169        0.197
   26    526      13    0.178 0.00711        0.164        0.192
   27    513       6    0.176 0.00708        0.162        0.190
   28    507       6    0.174 0.00705        0.160        0.188
   29    501       8    0.171 0.00700        0.158        0.185
   30    493       8    0.168 0.00696        0.155        0.182
   31    485       6    0.166 0.00692        0.153        0.180
   32    479       4    0.165 0.00690        0.152        0.179
   33    475       4    0.163 0.00688        0.150        0.177
   34    471       3    0.162 0.00686        0.149        0.176
   35    468       1    0.162 0.00685        0.149        0.176
   36    467       2    0.161 0.00684        0.148        0.175
   37    465       4    0.160 0.00682        0.147        0.174
   38    461       3    0.159 0.00680        0.146        0.173
   39    458       3    0.158 0.00678        0.145        0.171
   40    455       3    0.157 0.00676        0.144        0.170
   41    452       2    0.156 0.00675        0.143        0.170
   42    450       1    0.156 0.00674        0.143        0.169
   45    449       1    0.155 0.00674        0.143        0.169
   49    448       1    0.155 0.00673        0.142        0.169
   50    447       1    0.154 0.00673        0.142        0.168
   51    446       1    0.154 0.00672        0.142        0.168
   53    445       2    0.153 0.00671        0.141        0.167
   54    443       1    0.153 0.00670        0.141        0.167
   56    442       1    0.153 0.00670        0.140        0.166
   57    441       2    0.152 0.00668        0.140        0.166
   93    439       1    0.152 0.00668        0.139        0.165
ggsurvplot(fit, data = DataCluster3, 
pval = TRUE, conf.int = TRUE,
 risk.table = TRUE, # Add risk table
 risk.table.col = "strata", # Change risk table color by groups
 linetype = "strata", # Change line type by groups
 surv.median.line = "hv", # Specify median survival
 ggtheme = theme_bw(), # Change ggplot2 theme
 palette = c("#E7B800", "#2E9FDF"))

Notice the graph speed of the renal chronic patient drops rapidly on day 31st but after the 31st day constant until the end of the study. so the heavside function is

\[ g(t)= \begin{cases} 1, & \mbox{if}\ t\mbox{ < 31} \\ 0, & \mbox{if}\ t\mbox{ >= 31} \end{cases}\] ##### Varaibel inmsupr

# VARIABEL inmsupr
fit<-survfit(Surv(waktu,status)~ inmsupr, data=DataCluster3)
summary(fit)
Call: survfit(formula = Surv(waktu, status) ~ inmsupr, data = DataCluster3)

                inmsupr=0 
 time n.risk n.event survival  std.err lower 95% CI upper 95% CI
    1  32601     766   0.9765 0.000839       0.9749       0.9781
    2  31835    1058   0.9441 0.001273       0.9416       0.9465
    3  30777    1355   0.9025 0.001643       0.8993       0.9057
    4  29422    1720   0.8497 0.001979       0.8459       0.8536
    5  27702    1964   0.7895 0.002258       0.7851       0.7939
    6  25738    2031   0.7272 0.002467       0.7224       0.7320
    7  23707    2173   0.6605 0.002623       0.6554       0.6657
    8  21534    2087   0.5965 0.002717       0.5912       0.6019
    9  19447    2057   0.5334 0.002763       0.5280       0.5389
   10  17390    1910   0.4748 0.002766       0.4694       0.4803
   11  15480    1581   0.4263 0.002739       0.4210       0.4317
   12  13899    1576   0.3780 0.002685       0.3728       0.3833
   13  12323    1367   0.3361 0.002616       0.3310       0.3412
   14  10956    1220   0.2986 0.002535       0.2937       0.3037
   15   9736    1155   0.2632 0.002439       0.2585       0.2680
   16   8581    1007   0.2323 0.002339       0.2278       0.2370
   17   7574     861   0.2059 0.002240       0.2016       0.2104
   18   6713     742   0.1832 0.002142       0.1790       0.1874
   19   5971     633   0.1637 0.002049       0.1598       0.1678
   20   5338     516   0.1479 0.001966       0.1441       0.1518
   21   4822     433   0.1346 0.001890       0.1310       0.1384
   22   4389     368   0.1233 0.001821       0.1198       0.1270
   23   4021     320   0.1135 0.001757       0.1101       0.1170
   24   3701     282   0.1049 0.001697       0.1016       0.1083
   25   3419     256   0.0970 0.001639       0.0939       0.1003
   26   3163     190   0.0912 0.001594       0.0881       0.0944
   27   2973     166   0.0861 0.001554       0.0831       0.0892
   28   2807     157   0.0813 0.001513       0.0784       0.0843
   29   2650     119   0.0776 0.001482       0.0748       0.0806
   30   2531     120   0.0740 0.001449       0.0712       0.0769
   31   2411      90   0.0712 0.001424       0.0685       0.0740
   32   2321      69   0.0691 0.001404       0.0664       0.0719
   33   2252      63   0.0671 0.001386       0.0645       0.0699
   34   2189      58   0.0654 0.001369       0.0627       0.0681
   35   2131      49   0.0639 0.001354       0.0613       0.0666
   36   2082      46   0.0625 0.001340       0.0599       0.0651
   37   2036      37   0.0613 0.001329       0.0588       0.0640
   38   1999      32   0.0603 0.001319       0.0578       0.0630
   39   1967      25   0.0596 0.001311       0.0571       0.0622
   40   1942      25   0.0588 0.001303       0.0563       0.0614
   41   1917      24   0.0581 0.001295       0.0556       0.0607
   42   1893      19   0.0575 0.001289       0.0550       0.0601
   43   1874      12   0.0571 0.001285       0.0547       0.0597
   44   1862      11   0.0568 0.001282       0.0543       0.0593
   45   1851      15   0.0563 0.001277       0.0539       0.0589
   46   1836       9   0.0560 0.001274       0.0536       0.0586
   47   1827       8   0.0558 0.001271       0.0534       0.0583
   48   1819      11   0.0555 0.001268       0.0530       0.0580
   49   1808       9   0.0552 0.001265       0.0528       0.0577
   50   1799       3   0.0551 0.001264       0.0527       0.0576
   51   1796      10   0.0548 0.001260       0.0524       0.0573
   52   1786       8   0.0545 0.001258       0.0521       0.0571
   53   1778       6   0.0544 0.001256       0.0519       0.0569
   54   1772       6   0.0542 0.001254       0.0518       0.0567
   55   1766       2   0.0541 0.001253       0.0517       0.0566
   56   1764       5   0.0540 0.001251       0.0516       0.0565
   57   1759       2   0.0539 0.001251       0.0515       0.0564
   58   1757       2   0.0538 0.001250       0.0514       0.0563
   59   1755       3   0.0537 0.001249       0.0513       0.0562
   60   1752       1   0.0537 0.001249       0.0513       0.0562
   61   1751       1   0.0537 0.001248       0.0513       0.0562
   62   1750       1   0.0536 0.001248       0.0513       0.0562
   63   1749       1   0.0536 0.001248       0.0512       0.0561
   65   1748       1   0.0536 0.001247       0.0512       0.0561
   66   1747       1   0.0536 0.001247       0.0512       0.0561
   70   1746       1   0.0535 0.001247       0.0511       0.0560
   72   1745       1   0.0535 0.001246       0.0511       0.0560
   73   1744       1   0.0535 0.001246       0.0511       0.0560
   74   1743       2   0.0534 0.001245       0.0510       0.0559
   76   1741       1   0.0534 0.001245       0.0510       0.0559
   77   1740       1   0.0533 0.001245       0.0510       0.0558
   78   1739       1   0.0533 0.001244       0.0509       0.0558
   93   1738       1   0.0533 0.001244       0.0509       0.0558

                inmsupr=1 
 time n.risk n.event survival std.err lower 95% CI upper 95% CI
    1   1297      54    0.958 0.00555       0.9476        0.969
    2   1243      68    0.906 0.00811       0.8902        0.922
    3   1175      82    0.843 0.01011       0.8231        0.863
    4   1093      85    0.777 0.01155       0.7549        0.800
    5   1008      83    0.713 0.01256       0.6890        0.738
    6    925      75    0.655 0.01320       0.6300        0.682
    7    850      84    0.591 0.01365       0.5644        0.618
    8    766      91    0.520 0.01387       0.4939        0.548
    9    675      54    0.479 0.01387       0.4524        0.507
   10    621      58    0.434 0.01376       0.4079        0.462
   11    563      58    0.389 0.01354       0.3637        0.417
   12    505      57    0.345 0.01320       0.3205        0.372
   13    448      33    0.320 0.01295       0.2956        0.346
   14    415      32    0.295 0.01267       0.2715        0.321
   15    383      43    0.262 0.01221       0.2393        0.287
   16    340      27    0.241 0.01188       0.2191        0.266
   17    313      26    0.221 0.01153       0.1998        0.245
   18    287      26    0.201 0.01113       0.1806        0.224
   19    261      14    0.190 0.01090       0.1702        0.213
   20    247      12    0.181 0.01070       0.1614        0.203
   21    235      12    0.172 0.01048       0.1526        0.194
   22    223      17    0.159 0.01015       0.1401        0.180
   23    206       7    0.153 0.01001       0.1350        0.174
   24    199       8    0.147 0.00984       0.1292        0.168
   25    191      10    0.140 0.00962       0.1219        0.160
   26    181       5    0.136 0.00951       0.1183        0.156
   27    176       4    0.133 0.00942       0.1154        0.152
   28    172       1    0.132 0.00939       0.1147        0.152
   29    171       5    0.128 0.00928       0.1110        0.148
   30    166       4    0.125 0.00918       0.1081        0.144
   31    162       2    0.123 0.00913       0.1067        0.143
   32    160       3    0.121 0.00906       0.1045        0.140
   33    157       2    0.120 0.00901       0.1031        0.139
   34    155       1    0.119 0.00898       0.1024        0.138
   35    154       2    0.117 0.00893       0.1009        0.136
   36    152       3    0.115 0.00885       0.0988        0.134
   37    149       1    0.114 0.00883       0.0981        0.133
   40    148       1    0.113 0.00880       0.0973        0.132
   43    147       2    0.112 0.00875       0.0959        0.130
   49    145       1    0.111 0.00872       0.0952        0.130
   50    144       1    0.110 0.00870       0.0945        0.129
   51    143       1    0.109 0.00867       0.0937        0.128
   56    142       1    0.109 0.00864       0.0930        0.127
   57    141       1    0.108 0.00862       0.0923        0.126
   59    140       1    0.107 0.00859       0.0916        0.125
ggsurvplot(fit, data = DataCluster3, 
pval = TRUE, conf.int = TRUE,
 risk.table = TRUE, # Add risk table
 risk.table.col = "strata", # Change risk table color by groups
 linetype = "strata", # Change line type by groups
 surv.median.line = "hv", # Specify median survival
 ggtheme = theme_bw(), # Change ggplot2 theme
 palette = c("#E7B800", "#2E9FDF"))

Notice the graph speed of the inmsupr patient drops rapidly on day 17 but after the 17th day constant until the end of the study. so the heavside function is

\[ g(t)= \begin{cases} 1, & \mbox{jika}\ t\mbox{ < 17} \\ 0, & \mbox{jika}\ t\mbox{ >= 17} \end{cases}\]

Variabel Cardivascular
# VARIABEL Cardiovascular
fit<-survfit(Surv(waktu,status)~ cardiovascular, data=DataCluster3)
summary(fit)
Call: survfit(formula = Surv(waktu, status) ~ cardiovascular, data = DataCluster3)

                cardiovascular=0 
 time n.risk n.event survival  std.err lower 95% CI upper 95% CI
    1  31723     728   0.9771 0.000841       0.9754       0.9787
    2  30995    1040   0.9443 0.001288       0.9417       0.9468
    3  29955    1310   0.9030 0.001662       0.8997       0.9062
    4  28645    1681   0.8500 0.002005       0.8461       0.8539
    5  26964    1913   0.7897 0.002288       0.7852       0.7942
    6  25051    1988   0.7270 0.002501       0.7221       0.7319
    7  23063    2109   0.6605 0.002659       0.6553       0.6658
    8  20954    2060   0.5956 0.002755       0.5902       0.6010
    9  18894    2018   0.5320 0.002802       0.5265       0.5375
   10  16876    1859   0.4734 0.002803       0.4679       0.4789
   11  15017    1543   0.4247 0.002775       0.4193       0.4302
   12  13474    1551   0.3758 0.002719       0.3706       0.3812
   13  11923    1332   0.3339 0.002648       0.3287       0.3391
   14  10591    1191   0.2963 0.002564       0.2913       0.3014
   15   9400    1141   0.2603 0.002464       0.2556       0.2652
   16   8259     979   0.2295 0.002361       0.2249       0.2342
   17   7280     850   0.2027 0.002257       0.1983       0.2072
   18   6430     735   0.1795 0.002155       0.1753       0.1838
   19   5695     612   0.1602 0.002060       0.1562       0.1643
   20   5083     503   0.1444 0.001973       0.1406       0.1483
   21   4580     429   0.1309 0.001893       0.1272       0.1346
   22   4151     370   0.1192 0.001819       0.1157       0.1228
   23   3781     312   0.1094 0.001752       0.1060       0.1128
   24   3469     277   0.1006 0.001689       0.0974       0.1040
   25   3192     254   0.0926 0.001628       0.0895       0.0959
   26   2938     181   0.0869 0.001582       0.0839       0.0901
   27   2757     159   0.0819 0.001540       0.0789       0.0850
   28   2598     155   0.0770 0.001497       0.0741       0.0800
   29   2443     114   0.0734 0.001464       0.0706       0.0763
   30   2329     119   0.0697 0.001429       0.0669       0.0725
   31   2210      87   0.0669 0.001403       0.0642       0.0697
   32   2123      69   0.0647 0.001382       0.0621       0.0675
   33   2054      59   0.0629 0.001363       0.0603       0.0656
   34   1995      56   0.0611 0.001345       0.0585       0.0638
   35   1939      49   0.0596 0.001329       0.0570       0.0622
   36   1890      47   0.0581 0.001313       0.0556       0.0607
   37   1843      37   0.0569 0.001301       0.0544       0.0595
   38   1806      31   0.0560 0.001290       0.0535       0.0585
   39   1775      24   0.0552 0.001282       0.0527       0.0578
   40   1751      25   0.0544 0.001273       0.0520       0.0570
   41   1726      23   0.0537 0.001265       0.0513       0.0562
   42   1703      18   0.0531 0.001259       0.0507       0.0556
   43   1685      13   0.0527 0.001255       0.0503       0.0552
   44   1672      11   0.0524 0.001251       0.0500       0.0549
   45   1661      14   0.0519 0.001246       0.0495       0.0544
   46   1647       8   0.0517 0.001243       0.0493       0.0542
   47   1639       8   0.0514 0.001240       0.0490       0.0539
   48   1631      10   0.0511 0.001236       0.0487       0.0536
   49   1621       9   0.0508 0.001233       0.0485       0.0533
   50   1612       4   0.0507 0.001232       0.0483       0.0532
   51   1608      11   0.0503 0.001228       0.0480       0.0528
   52   1597       7   0.0501 0.001225       0.0478       0.0526
   53   1590       6   0.0499 0.001223       0.0476       0.0524
   54   1584       6   0.0497 0.001221       0.0474       0.0522
   55   1578       1   0.0497 0.001220       0.0474       0.0522
   56   1577       4   0.0496 0.001219       0.0473       0.0520
   57   1573       3   0.0495 0.001218       0.0472       0.0519
   58   1570       2   0.0494 0.001217       0.0471       0.0519
   59   1568       4   0.0493 0.001216       0.0470       0.0517
   60   1564       1   0.0493 0.001215       0.0469       0.0517
   61   1563       1   0.0492 0.001215       0.0469       0.0517
   62   1562       1   0.0492 0.001214       0.0469       0.0516
   63   1561       1   0.0492 0.001214       0.0469       0.0516
   65   1560       1   0.0491 0.001214       0.0468       0.0516
   66   1559       1   0.0491 0.001213       0.0468       0.0515
   70   1558       1   0.0491 0.001213       0.0468       0.0515
   72   1557       1   0.0490 0.001213       0.0467       0.0515
   73   1556       1   0.0490 0.001212       0.0467       0.0515
   74   1555       2   0.0490 0.001211       0.0466       0.0514
   76   1553       1   0.0489 0.001211       0.0466       0.0514
   77   1552       1   0.0489 0.001211       0.0466       0.0513
   78   1551       1   0.0489 0.001210       0.0465       0.0513
   93   1550       1   0.0488 0.001210       0.0465       0.0513

                cardiovascular=1 
 time n.risk n.event survival std.err lower 95% CI upper 95% CI
    1   2175      92    0.958 0.00432        0.949        0.966
    2   2083      86    0.918 0.00588        0.907        0.930
    3   1997     127    0.860 0.00745        0.845        0.874
    4   1870     124    0.803 0.00853        0.786        0.820
    5   1746     134    0.741 0.00939        0.723        0.760
    6   1612     118    0.687 0.00994        0.668        0.707
    7   1494     148    0.619 0.01041        0.599        0.640
    8   1346     118    0.565 0.01063        0.544        0.586
    9   1228      93    0.522 0.01071        0.501        0.543
   10   1135     109    0.472 0.01070        0.451        0.493
   11   1026      96    0.428 0.01061        0.407        0.449
   12    930      82    0.390 0.01046        0.370        0.411
   13    848      68    0.359 0.01028        0.339        0.379
   14    780      61    0.331 0.01009        0.311        0.351
   15    719      57    0.304 0.00987        0.286        0.324
   16    662      55    0.279 0.00962        0.261        0.299
   17    607      37    0.262 0.00943        0.244        0.281
   18    570      33    0.247 0.00925        0.229        0.266
   19    537      35    0.231 0.00903        0.214        0.249
   20    502      25    0.219 0.00887        0.203        0.237
   21    477      16    0.212 0.00876        0.195        0.230
   22    461      15    0.205 0.00866        0.189        0.223
   23    446      15    0.198 0.00855        0.182        0.216
   24    431      13    0.192 0.00845        0.176        0.209
   25    418      12    0.187 0.00835        0.171        0.204
   26    406      14    0.180 0.00824        0.165        0.197
   27    392      11    0.175 0.00815        0.160        0.192
   28    381       3    0.174 0.00813        0.159        0.190
   29    378      10    0.169 0.00804        0.154        0.186
   30    368       5    0.167 0.00800        0.152        0.183
   31    363       5    0.165 0.00795        0.150        0.181
   32    358       3    0.163 0.00792        0.148        0.180
   33    355       6    0.160 0.00787        0.146        0.177
   34    349       3    0.159 0.00784        0.144        0.175
   35    346       2    0.158 0.00782        0.144        0.174
   36    344       2    0.157 0.00781        0.143        0.173
   37    342       1    0.157 0.00780        0.142        0.173
   38    341       1    0.156 0.00779        0.142        0.172
   39    340       1    0.156 0.00778        0.141        0.172
   40    339       1    0.155 0.00777        0.141        0.171
   41    338       1    0.155 0.00776        0.140        0.171
   42    337       1    0.154 0.00775        0.140        0.170
   43    336       1    0.154 0.00774        0.140        0.170
   45    335       1    0.154 0.00773        0.139        0.169
   46    334       1    0.153 0.00772        0.139        0.169
   48    333       1    0.153 0.00771        0.138        0.169
   49    332       1    0.152 0.00770        0.138        0.168
   52    331       1    0.152 0.00769        0.137        0.168
   55    330       1    0.151 0.00768        0.137        0.167
   56    329       2    0.150 0.00766        0.136        0.166
ggsurvplot(fit, data = DataCluster3, 
pval = TRUE, conf.int = TRUE,
 risk.table = TRUE, # Add risk table
 risk.table.col = "strata", # Change risk table color by groups
 linetype = "strata", # Change line type by groups
 surv.median.line = "hv", # Specify median survival
 ggtheme = theme_bw(), # Change ggplot2 theme
 palette = c("#E7B800", "#2E9FDF"))

Notice the graph speed of the cardivascular patient drops rapidly on day 21st but after the 21st day constant until the end of the study. so the heavside function is

\[ g(t)= \begin{cases} 1, & \mbox{jika}\ t\mbox{ < 21} \\ 0, & \mbox{jika}\ t\mbox{ >= 21} \end{cases}\]

Variabel copd
fit<-survfit(Surv(waktu,status)~ copd , data=DataCluster3)
summary(fit)
Call: survfit(formula = Surv(waktu, status) ~ copd, data = DataCluster3)

                copd=0 
 time n.risk n.event survival std.err lower 95% CI upper 95% CI
    1  32165     766   0.9762 0.00085       0.9745       0.9779
    2  31399    1060   0.9432 0.00129       0.9407       0.9458
    3  30339    1356   0.9011 0.00166       0.8978       0.9043
    4  28983    1714   0.8478 0.00200       0.8439       0.8517
    5  27269    1927   0.7879 0.00228       0.7834       0.7924
    6  25342    1972   0.7266 0.00249       0.7217       0.7315
    7  23370    2132   0.6603 0.00264       0.6551       0.6655
    8  21238    2066   0.5961 0.00274       0.5907       0.6014
    9  19172    2011   0.5335 0.00278       0.5281       0.5390
   10  17161    1889   0.4748 0.00278       0.4694       0.4803
   11  15272    1564   0.4262 0.00276       0.4208       0.4316
   12  13708    1572   0.3773 0.00270       0.3720       0.3826
   13  12136    1346   0.3355 0.00263       0.3303       0.3407
   14  10790    1201   0.2981 0.00255       0.2932       0.3032
   15   9589    1149   0.2624 0.00245       0.2576       0.2672
   16   8440     993   0.2315 0.00235       0.2270       0.2362
   17   7447     854   0.2050 0.00225       0.2006       0.2094
   18   6593     745   0.1818 0.00215       0.1776       0.1861
   19   5848     630   0.1622 0.00206       0.1582       0.1663
   20   5218     510   0.1464 0.00197       0.1426       0.1503
   21   4708     430   0.1330 0.00189       0.1293       0.1368
   22   4278     377   0.1213 0.00182       0.1178       0.1249
   23   3901     311   0.1116 0.00176       0.1082       0.1151
   24   3590     282   0.1028 0.00169       0.0996       0.1062
   25   3308     258   0.0948 0.00163       0.0917       0.0981
   26   3050     182   0.0892 0.00159       0.0861       0.0923
   27   2868     166   0.0840 0.00155       0.0810       0.0871
   28   2702     154   0.0792 0.00151       0.0763       0.0822
   29   2548     119   0.0755 0.00147       0.0727       0.0785
   30   2429     122   0.0717 0.00144       0.0690       0.0746
   31   2307      88   0.0690 0.00141       0.0663       0.0718
   32   2219      66   0.0669 0.00139       0.0643       0.0697
   33   2153      60   0.0651 0.00138       0.0624       0.0678
   34   2093      58   0.0633 0.00136       0.0607       0.0660
   35   2035      51   0.0617 0.00134       0.0591       0.0644
   36   1984      48   0.0602 0.00133       0.0576       0.0628
   37   1936      37   0.0590 0.00131       0.0565       0.0617
   38   1899      30   0.0581 0.00130       0.0556       0.0607
   39   1869      25   0.0573 0.00130       0.0548       0.0599
   40   1844      25   0.0566 0.00129       0.0541       0.0591
   41   1819      24   0.0558 0.00128       0.0534       0.0584
   42   1795      17   0.0553 0.00127       0.0528       0.0578
   43   1778      13   0.0549 0.00127       0.0524       0.0574
   44   1765       9   0.0546 0.00127       0.0522       0.0571
   45   1756      14   0.0542 0.00126       0.0517       0.0567
   46   1742       9   0.0539 0.00126       0.0515       0.0564
   47   1733       7   0.0537 0.00126       0.0513       0.0562
   48   1726      11   0.0533 0.00125       0.0509       0.0558
   49   1715       9   0.0530 0.00125       0.0506       0.0555
   50   1706       4   0.0529 0.00125       0.0505       0.0554
   51   1702      10   0.0526 0.00124       0.0502       0.0551
   52   1692       8   0.0524 0.00124       0.0500       0.0548
   53   1684       6   0.0522 0.00124       0.0498       0.0547
   54   1678       6   0.0520 0.00124       0.0496       0.0545
   55   1672       1   0.0520 0.00124       0.0496       0.0544
   56   1671       5   0.0518 0.00124       0.0494       0.0543
   57   1666       3   0.0517 0.00123       0.0493       0.0542
   58   1663       2   0.0516 0.00123       0.0493       0.0541
   59   1661       4   0.0515 0.00123       0.0492       0.0540
   60   1657       1   0.0515 0.00123       0.0491       0.0540
   61   1656       1   0.0515 0.00123       0.0491       0.0539
   62   1655       1   0.0514 0.00123       0.0491       0.0539
   63   1654       1   0.0514 0.00123       0.0490       0.0539
   65   1653       1   0.0514 0.00123       0.0490       0.0538
   70   1652       1   0.0513 0.00123       0.0490       0.0538
   72   1651       1   0.0513 0.00123       0.0489       0.0538
   73   1650       1   0.0513 0.00123       0.0489       0.0537
   74   1649       2   0.0512 0.00123       0.0489       0.0537
   76   1647       1   0.0512 0.00123       0.0488       0.0536
   78   1646       1   0.0511 0.00123       0.0488       0.0536

                copd=1 
 time n.risk n.event survival std.err lower 95% CI upper 95% CI
    1   1733      54    0.969 0.00417        0.961        0.977
    2   1679      66    0.931 0.00610        0.919        0.943
    3   1613      81    0.884 0.00769        0.869        0.899
    4   1532      91    0.832 0.00899        0.814        0.849
    5   1441     120    0.762 0.01023        0.742        0.783
    6   1321     134    0.685 0.01116        0.663        0.707
    7   1187     125    0.613 0.01170        0.590        0.636
    8   1062     112    0.548 0.01195        0.525        0.572
    9    950     100    0.490 0.01201        0.467        0.515
   10    850      79    0.445 0.01194        0.422        0.469
   11    771      75    0.402 0.01178        0.379        0.425
   12    696      61    0.366 0.01157        0.344        0.390
   13    635      54    0.335 0.01134        0.314        0.358
   14    581      51    0.306 0.01107        0.285        0.328
   15    530      49    0.278 0.01076        0.257        0.299
   16    481      41    0.254 0.01046        0.234        0.275
   17    440      33    0.235 0.01018        0.216        0.256
   18    407      23    0.222 0.00998        0.203        0.242
   19    384      17    0.212 0.00981        0.193        0.232
   20    367      18    0.201 0.00963        0.183        0.221
   21    349      15    0.193 0.00948        0.175        0.212
   22    334       8    0.188 0.00939        0.171        0.207
   23    326      16    0.179 0.00921        0.162        0.198
   24    310       8    0.174 0.00911        0.157        0.193
   25    302       8    0.170 0.00902        0.153        0.188
   26    294      13    0.162 0.00885        0.146        0.180
   27    281       4    0.160 0.00880        0.143        0.178
   28    277       4    0.158 0.00875        0.141        0.176
   29    273       5    0.155 0.00869        0.139        0.173
   30    268       2    0.153 0.00866        0.137        0.171
   31    266       4    0.151 0.00861        0.135        0.169
   32    262       6    0.148 0.00852        0.132        0.165
   33    256       5    0.145 0.00845        0.129        0.162
   34    251       1    0.144 0.00844        0.129        0.162
   36    250       1    0.144 0.00843        0.128        0.161
   37    249       1    0.143 0.00841        0.128        0.161
   38    248       2    0.142 0.00838        0.126        0.159
   40    246       1    0.141 0.00837        0.126        0.159
   42    245       2    0.140 0.00834        0.125        0.158
   43    243       1    0.140 0.00833        0.124        0.157
   44    242       2    0.138 0.00830        0.123        0.156
   45    240       1    0.138 0.00828        0.123        0.155
   47    239       1    0.137 0.00827        0.122        0.155
   49    238       1    0.137 0.00825        0.122        0.154
   51    237       1    0.136 0.00824        0.121        0.153
   55    236       1    0.136 0.00822        0.120        0.153
   56    235       1    0.135 0.00821        0.120        0.152
   66    234       1    0.134 0.00819        0.119        0.152
   77    233       1    0.134 0.00818        0.119        0.151
   93    232       1    0.133 0.00816        0.118        0.150
ggsurvplot(fit, data = DataCluster3, 
pval = TRUE, conf.int = TRUE,
 risk.table = TRUE, # Add risk table
 risk.table.col = "strata", # Change risk table color by groups
 linetype = "strata", # Change line type by groups
 surv.median.line = "hv", # Specify median survival
 ggtheme = theme_bw(), # Change ggplot2 theme
 palette = c("#E7B800", "#2E9FDF"))

Notice the graph speed of the copd patient drops rapidly on day 21st but after the 21st day constant until the end of the study. so the heavside function is

\[ g(t)= \begin{cases} 1, & \mbox{jika}\ t\mbox{ < 26} \\ 0, & \mbox{jika}\ t\mbox{ >= 26} \end{cases}\] #### d. Build Time Function

sehingga ke-empat tersebut diinterkasikan dengan fungsi waktu masing-masing. namun sebelumnya membuat kolom interval yaitu jika t lebih besar atau sama dengan 25 maka nilanya 25 tapi kalau tidak nilainya 0

DataCluster3= DataCluster3 %>%
        mutate(interval0 = ifelse(waktu<= 17, 0, 17),
               interval1 = ifelse(waktu<= 21, 0, 21),
               interval2 = ifelse(waktu<= 26, 0, 26),
               interval3 = ifelse(waktu<= 27, 0, 27),
               interval4 = ifelse(waktu<= 30, 0, 30),
               interval5 = ifelse(waktu<= 31, 0, 31))
head(DataCluster3)
  sex pneumonia pregnancy diabetes copd asthma inmsupr hypertension
1   0         1         0        0    0      0       0            0
2   1         1         0        0    0      0       0            1
3   1         1         0        1    0      0       0            0
4   0         1         0        0    1      1       0            1
5   0         1         0        0    0      0       0            1
6   1         1         0        0    0      0       0            1
  cardiovascular obesity renal_chronic tobacco waktu status Age cluster
1              0       0             0       0     4      1   0       3
2              0       1             0       0    17      1   1       3
3              0       1             0       0    26      1   0       3
4              1       1             0       0     3      1   0       3
5              0       0             0       0    14      1   1       3
6              0       1             0       0     2      1   1       3
  interval0 interval1 interval2 interval3 interval4 interval5
1         0         0         0         0         0         0
2         0         0         0         0         0         0
3        17        21         0         0         0         0
4         0         0         0         0         0         0
5         0         0         0         0         0         0
6         0         0         0         0         0         0
t.Age_1 = t(DataCluster3$Age)*(1-(DataCluster3$interval3)/27) 
t.Age_2 = t(DataCluster3$Age)*(DataCluster3$interval3/27) 
Age_t1 = t(t.Age_1 )
Age_t2 = t(t.Age_2)
t.hypertension_1 = t(DataCluster3$hypertension)*(1-(DataCluster3$interval5)/31) 
t.hypertension_2 = t(DataCluster3$hypertension)*(DataCluster3$interval5/31) 
hypertension_t1 = t(t.hypertension_1 )
hypertension_t2 = t(t.hypertension_2)
t.diabetes_1 = t(DataCluster3$diabetes)*(1-(DataCluster3$interval4)/30) 
t.diabetes_2 = t(DataCluster3$diabetes)*(DataCluster3$interval4/30) 
diabetes_t1 = t(t.diabetes_1 )
diabetes_t2 = t(t.diabetes_2)
t.renal_chronic_1 = t(DataCluster3$renal_chronic)*(1-(DataCluster3$interval5)/31) 
t.renal_chronic_2 = t(DataCluster3$renal_chronic)*(DataCluster3$interval5/31) 
renal_chronic_t1 = t(t.renal_chronic_1 )
renal_chronic_t2 = t(t.renal_chronic_2)
t.inmsupr_1 = t(DataCluster3$inmsupr)*(1-(DataCluster3$interval0)/17) 
t.inmsupr_2 = t(DataCluster3$inmsupr)*(DataCluster3$interval0/17) 
inmsupr_t1 = t(t.inmsupr_1 )
inmsupr_t2 = t(t.inmsupr_2)
t.cardiovascular_1 = t(DataCluster3$cardiovascular)*(1-(DataCluster3$interval1)/21) 
t.cardiovascular_2 = t(DataCluster3$cardiovascular)*(DataCluster3$interval1/21) 
cardiovascular_t1 = t(t.cardiovascular_1)
cardiovascular_t2 = t(t.cardiovascular_2)
t.copd_1 = t(DataCluster3$copd)*(1-(DataCluster3$interval2)/26) 
t.copd_2 = t(DataCluster3$copd)*(DataCluster3$interval2/26) 
copd_t1 = t(t.copd_1)
copd_t2 = t(t.copd_2)
DataCluster3=cbind(DataCluster3,diabetes_t1,diabetes_t2,hypertension_t1,hypertension_t2,inmsupr_t2,inmsupr_t1,Age_t1,Age_t2,renal_chronic_t1,renal_chronic_t2, cardiovascular_t1, cardiovascular_t2,copd_t1,copd_t2 )
head(DataCluster3)
  sex pneumonia pregnancy diabetes copd asthma inmsupr hypertension
1   0         1         0        0    0      0       0            0
2   1         1         0        0    0      0       0            1
3   1         1         0        1    0      0       0            0
4   0         1         0        0    1      1       0            1
5   0         1         0        0    0      0       0            1
6   1         1         0        0    0      0       0            1
  cardiovascular obesity renal_chronic tobacco waktu status Age cluster
1              0       0             0       0     4      1   0       3
2              0       1             0       0    17      1   1       3
3              0       1             0       0    26      1   0       3
4              1       1             0       0     3      1   0       3
5              0       0             0       0    14      1   1       3
6              0       1             0       0     2      1   1       3
  interval0 interval1 interval2 interval3 interval4 interval5 diabetes_t1
1         0         0         0         0         0         0           0
2         0         0         0         0         0         0           0
3        17        21         0         0         0         0           1
4         0         0         0         0         0         0           0
5         0         0         0         0         0         0           0
6         0         0         0         0         0         0           0
  diabetes_t2 hypertension_t1 hypertension_t2 inmsupr_t2 inmsupr_t1 Age_t1
1           0               0               0          0          0      0
2           0               1               0          0          0      1
3           0               0               0          0          0      0
4           0               1               0          0          0      0
5           0               1               0          0          0      1
6           0               1               0          0          0      1
  Age_t2 renal_chronic_t1 renal_chronic_t2 cardiovascular_t1 cardiovascular_t2
1      0                0                0                 0                 0
2      0                0                0                 0                 0
3      0                0                0                 0                 0
4      0                0                0                 1                 0
5      0                0                0                 0                 0
6      0                0                0                 0                 0
  copd_t1 copd_t2
1       0       0
2       0       0
3       0       0
4       1       0
5       0       0
6       0       0

e. Model Extended Cox with Breslow Method

Fit_Model_Cluster3<-coxph(Surv(waktu,status)~   sex:waktu+ pregnancy + hypertension_t1 + hypertension_t2 + obesity +tobacco + diabetes_t1 + diabetes_t1+ diabetes_t2+ renal_chronic_t1+ renal_chronic_t2+cardiovascular_t1 + cardiovascular_t2 + copd_t1+copd_t2 +inmsupr_t1+inmsupr_t2+asthma+ pneumonia+Age_t1+Age_t2, data = DataCluster3, method = "breslow")

summary(Fit_Model_Cluster3)
Call:
coxph(formula = Surv(waktu, status) ~ sex:waktu + pregnancy + 
    hypertension_t1 + hypertension_t2 + obesity + tobacco + diabetes_t1 + 
    diabetes_t1 + diabetes_t2 + renal_chronic_t1 + renal_chronic_t2 + 
    cardiovascular_t1 + cardiovascular_t2 + copd_t1 + copd_t2 + 
    inmsupr_t1 + inmsupr_t2 + asthma + pneumonia + Age_t1 + Age_t2, 
    data = DataCluster3, method = "breslow")

  n= 33898, number of events= 32022 

                       coef exp(coef)  se(coef)       z Pr(>|z|)    
pregnancy          0.478162  1.613107  0.155086   3.083  0.00205 ** 
hypertension_t1    0.070258  1.072785  0.012601   5.576 2.47e-08 ***
hypertension_t2   -1.458452  0.232596  0.084676 -17.224  < 2e-16 ***
obesity            0.031958  1.032474  0.013579   2.354  0.01859 *  
tobacco            0.070656  1.073212  0.237981   0.297  0.76654    
diabetes_t1        0.131178  1.140170  0.012500  10.494  < 2e-16 ***
diabetes_t2       -1.590603  0.203803  0.085284 -18.651  < 2e-16 ***
renal_chronic_t1   0.186827  1.205419  0.022211   8.411  < 2e-16 ***
renal_chronic_t2  -1.361185  0.256357  0.163891  -8.305  < 2e-16 ***
cardiovascular_t1  0.227788  1.255819  0.025519   8.926  < 2e-16 ***
cardiovascular_t2 -1.089287  0.336456  0.088060 -12.370  < 2e-16 ***
copd_t1            0.180774  1.198144  0.027211   6.643 3.07e-11 ***
copd_t2           -0.792847  0.452555  0.145433  -5.452 4.99e-08 ***
inmsupr_t1         0.475481  1.608788  0.032635  14.570  < 2e-16 ***
inmsupr_t2        -1.062567  0.345568  0.083057 -12.793  < 2e-16 ***
asthma            -0.007220  0.992806  0.040200  -0.180  0.85747    
pneumonia         -0.108917  0.896805  0.012572  -8.664  < 2e-16 ***
Age_t1             0.153747  1.166196  0.012645  12.159  < 2e-16 ***
Age_t2            -1.574002  0.207214  0.044965 -35.005  < 2e-16 ***
sex:waktu         -0.026835  0.973522  0.000738 -36.360  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

                  exp(coef) exp(-coef) lower .95 upper .95
pregnancy            1.6131     0.6199    1.1903    2.1861
hypertension_t1      1.0728     0.9322    1.0466    1.0996
hypertension_t2      0.2326     4.2993    0.1970    0.2746
obesity              1.0325     0.9685    1.0054    1.0603
tobacco              1.0732     0.9318    0.6732    1.7110
diabetes_t1          1.1402     0.8771    1.1126    1.1684
diabetes_t2          0.2038     4.9067    0.1724    0.2409
renal_chronic_t1     1.2054     0.8296    1.1541    1.2591
renal_chronic_t2     0.2564     3.9008    0.1859    0.3535
cardiovascular_t1    1.2558     0.7963    1.1946    1.3202
cardiovascular_t2    0.3365     2.9722    0.2831    0.3998
copd_t1              1.1981     0.8346    1.1359    1.2638
copd_t2              0.4526     2.2097    0.3403    0.6018
inmsupr_t1           1.6088     0.6216    1.5091    1.7151
inmsupr_t2           0.3456     2.8938    0.2937    0.4067
asthma               0.9928     1.0072    0.9176    1.0742
pneumonia            0.8968     1.1151    0.8750    0.9192
Age_t1               1.1662     0.8575    1.1376    1.1955
Age_t2               0.2072     4.8259    0.1897    0.2263
sex:waktu            0.9735     1.0272    0.9721    0.9749

Concordance= 0.665  (se = 0.002 )
Likelihood ratio test= 19749  on 20 df,   p=<2e-16
Wald test            = 6897  on 20 df,   p=<2e-16
Score (logrank) test = 10949  on 20 df,   p=<2e-16

Biasanya Anda dapat mengabaikan pesan tersebut, sebagian besar untuk informasi Anda. Itu hal utama yang perlu diperhatikan adalah Sebuah. Ketika salah satu koefisien menuju tak terhingga dalam model Cox, Wald uji signifikansi beta/se(beta) rusak, dan tidak lagi dapat diandalkan. Namun tes LR masih valid. Karenanya rutinitas seperti step AIC baik-baik saja. Begitu juga nilai prediksi, residu, dll. Sebenarnya itu hanya Uji Wald yang perlu diabaikan: didasarkan pada deret Taylor yang hanya tidak bekerja sejauh itu dari nol maka dari itu perlu membuang variabel yang menghasilkan infinity

d. Hazard Ratio

ggforest(Fit_Model_Cluster3, main = "Hazard Ratio")

e.Significance Test

Partial likelihood test
Fit_Model_Cluster3$loglik
[1] -308877.9 -299003.5
Wald test
Variabel Sex
## Variabel sex
Fit_Model_Sex<-coxph(Surv(waktu,status)~ waktu:sex, data = DataCluster3, method = "breslow")
summary(Fit_Model_Sex)
Call:
coxph(formula = Surv(waktu, status) ~ waktu:sex, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

                coef  exp(coef)   se(coef)      z Pr(>|z|)    
waktu:sex -0.0295498  0.9708825  0.0005443 -54.29   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

          exp(coef) exp(-coef) lower .95 upper .95
waktu:sex    0.9709       1.03    0.9698    0.9719

Concordance= 0.564  (se = 0.002 )
Likelihood ratio test= 5707  on 1 df,   p=<2e-16
Wald test            = 2947  on 1 df,   p=<2e-16
Score (logrank) test = 3749  on 1 df,   p=<2e-16
Variabel peneumonia
## Variabel Pneumonia
Fit_Model_Pneumonia1<-coxph(Surv(waktu,status)~ pneumonia, data = DataCluster3, method = "breslow")
summary(Fit_Model_Pneumonia1)
Call:
coxph(formula = Surv(waktu, status) ~ pneumonia, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

              coef exp(coef) se(coef)      z Pr(>|z|)    
pneumonia -0.25575   0.77433  0.01258 -20.34   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

          exp(coef) exp(-coef) lower .95 upper .95
pneumonia    0.7743      1.291    0.7555    0.7937

Concordance= 0.526  (se = 0.001 )
Likelihood ratio test= 397.4  on 1 df,   p=<2e-16
Wald test            = 413.5  on 1 df,   p=<2e-16
Score (logrank) test = 415.8  on 1 df,   p=<2e-16
Variabel Diabetes
## Variabel Diabetes
Fit_Model_Diabetes1<-coxph(Surv(waktu,status)~ diabetes_t1, data = DataCluster3, method = "breslow")
summary(Fit_Model_Diabetes1)
Call:
coxph(formula = Surv(waktu, status) ~ diabetes_t1, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

               coef exp(coef) se(coef)     z Pr(>|z|)    
diabetes_t1 0.43468   1.54447  0.01189 36.55   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

            exp(coef) exp(-coef) lower .95 upper .95
diabetes_t1     1.544     0.6475     1.509     1.581

Concordance= 0.542  (se = 0.001 )
Likelihood ratio test= 1282  on 1 df,   p=<2e-16
Wald test            = 1336  on 1 df,   p=<2e-16
Score (logrank) test = 1356  on 1 df,   p=<2e-16
Fit_Model_Diabetes2<-coxph(Surv(waktu,status)~ diabetes_t2, data = DataCluster3, method = "breslow")
summary(Fit_Model_Diabetes2)
Call:
coxph(formula = Surv(waktu, status) ~ diabetes_t2, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

                coef exp(coef) se(coef)      z Pr(>|z|)    
diabetes_t2 -3.71769   0.02429  0.06898 -53.89   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

            exp(coef) exp(-coef) lower .95 upper .95
diabetes_t2   0.02429      41.17   0.02122   0.02781

Concordance= 0.554  (se = 0.001 )
Likelihood ratio test= 10857  on 1 df,   p=<2e-16
Wald test            = 2905  on 1 df,   p=<2e-16
Score (logrank) test = 6756  on 1 df,   p=<2e-16
Variabel Hypertension
## Variabel hypertension
Fit_Model_Hypertension1<-coxph(Surv(waktu,status)~ hypertension_t1, data = DataCluster3, method = "breslow")
summary(Fit_Model_Hypertension1)
Call:
coxph(formula = Surv(waktu, status) ~ hypertension_t1, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

                   coef exp(coef) se(coef)     z Pr(>|z|)    
hypertension_t1 0.41874   1.52004  0.01162 36.03   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

                exp(coef) exp(-coef) lower .95 upper .95
hypertension_t1      1.52     0.6579     1.486     1.555

Concordance= 0.539  (se = 0.002 )
Likelihood ratio test= 1265  on 1 df,   p=<2e-16
Wald test            = 1298  on 1 df,   p=<2e-16
Score (logrank) test = 1316  on 1 df,   p=<2e-16
## Variabel hypertension
Fit_Model_Hypertension2<-coxph(Surv(waktu,status)~ hypertension_t2, data = DataCluster3, method = "breslow")
summary(Fit_Model_Hypertension2)
Call:
coxph(formula = Surv(waktu, status) ~ hypertension_t2, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

                    coef exp(coef) se(coef)      z Pr(>|z|)    
hypertension_t2 -3.81281   0.02209  0.06600 -57.77   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

                exp(coef) exp(-coef) lower .95 upper .95
hypertension_t2   0.02209      45.28   0.01941   0.02514

Concordance= 0.558  (se = 0.001 )
Likelihood ratio test= 12022  on 1 df,   p=<2e-16
Wald test            = 3337  on 1 df,   p=<2e-16
Score (logrank) test = 7461  on 1 df,   p=<2e-16
Variabel Obesity
## Variabel Obesity
Fit_Model_obesity<-coxph(Surv(waktu,status)~ obesity, data = DataCluster3, method = "breslow")
summary(Fit_Model_obesity)
Call:
coxph(formula = Surv(waktu, status) ~ obesity, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

            coef exp(coef) se(coef)      z Pr(>|z|)    
obesity -0.05728   0.94433  0.01335 -4.291 1.78e-05 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

        exp(coef) exp(-coef) lower .95 upper .95
obesity    0.9443      1.059    0.9199    0.9694

Concordance= 0.505  (se = 0.001 )
Likelihood ratio test= 18.6  on 1 df,   p=2e-05
Wald test            = 18.41  on 1 df,   p=2e-05
Score (logrank) test = 18.42  on 1 df,   p=2e-05
Variabel Renal Chronic
### variabel renal_chronic
Fit_Model_RenalChronic1<-coxph(Surv(waktu,status)~ renal_chronic_t1, data = DataCluster3, method = "breslow")
summary(Fit_Model_RenalChronic1)
Call:
coxph(formula = Surv(waktu, status) ~ renal_chronic_t1, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

                    coef exp(coef) se(coef)     z Pr(>|z|)    
renal_chronic_t1 0.46925   1.59880  0.02128 22.05   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

                 exp(coef) exp(-coef) lower .95 upper .95
renal_chronic_t1     1.599     0.6255     1.533     1.667

Concordance= 0.517  (se = 0.001 )
Likelihood ratio test= 427.6  on 1 df,   p=<2e-16
Wald test            = 486.3  on 1 df,   p=<2e-16
Score (logrank) test = 495.3  on 1 df,   p=<2e-16
### variabel renal_chronic
Fit_Model_RenalChronic2<-coxph(Surv(waktu,status)~ renal_chronic_t2, data = DataCluster3, method = "breslow")
summary(Fit_Model_RenalChronic2)
Call:
coxph(formula = Surv(waktu, status) ~ renal_chronic_t2, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

                     coef exp(coef) se(coef)      z Pr(>|z|)    
renal_chronic_t2 -3.55943   0.02845  0.15639 -22.76   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

                 exp(coef) exp(-coef) lower .95 upper .95
renal_chronic_t2   0.02845      35.14   0.02094   0.03866

Concordance= 0.514  (se = 0.001 )
Likelihood ratio test= 2388  on 1 df,   p=<2e-16
Wald test            = 518  on 1 df,   p=<2e-16
Score (logrank) test = 1350  on 1 df,   p=<2e-16
Variabel Age
## Variabel Age
Fit_Model_Age1<-coxph(Surv(waktu,status)~ Age_t1, data = DataCluster3, method = "breslow")
summary(Fit_Model_Age1)
Call:
coxph(formula = Surv(waktu, status) ~ Age_t1, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

          coef exp(coef) se(coef)     z Pr(>|z|)    
Age_t1 0.66469   1.94389  0.01239 53.63   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

       exp(coef) exp(-coef) lower .95 upper .95
Age_t1     1.944     0.5144     1.897     1.992

Concordance= 0.559  (se = 0.002 )
Likelihood ratio test= 3039  on 1 df,   p=<2e-16
Wald test            = 2876  on 1 df,   p=<2e-16
Score (logrank) test = 2970  on 1 df,   p=<2e-16
## Variabel Age
Fit_Model_Age2<-coxph(Surv(waktu,status)~ Age_t2, data = DataCluster3, method = "breslow")
summary(Fit_Model_Age2)
Call:
coxph(formula = Surv(waktu, status) ~ Age_t2, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

           coef exp(coef) se(coef)      z Pr(>|z|)    
Age_t2 -3.03541   0.04805  0.04040 -75.14   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

       exp(coef) exp(-coef) lower .95 upper .95
Age_t2   0.04805      20.81    0.0444   0.05201

Concordance= 0.57  (se = 0.001 )
Likelihood ratio test= 12761  on 1 df,   p=<2e-16
Wald test            = 5646  on 1 df,   p=<2e-16
Score (logrank) test = 8567  on 1 df,   p=<2e-16
Variabel COPD
## Variabel COPD
Fit_Model_copd<-coxph(Surv(waktu,status)~ copd_t1, data = DataCluster3, method = "breslow")
summary(Fit_Model_copd)
Call:
coxph(formula = Surv(waktu, status) ~ copd_t1, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

           coef exp(coef) se(coef)     z Pr(>|z|)    
copd_t1 0.42774   1.53379  0.02694 15.88   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

        exp(coef) exp(-coef) lower .95 upper .95
copd_t1     1.534      0.652     1.455     1.617

Concordance= 0.509  (se = 0.001 )
Likelihood ratio test= 222.4  on 1 df,   p=<2e-16
Wald test            = 252.1  on 1 df,   p=<2e-16
Score (logrank) test = 255.9  on 1 df,   p=<2e-16
## Variabel COPD
Fit_Model_copd<-coxph(Surv(waktu,status)~ copd_t2, data = DataCluster3, method = "breslow")
summary(Fit_Model_copd)
Call:
coxph(formula = Surv(waktu, status) ~ copd_t2, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

            coef exp(coef) se(coef)     z Pr(>|z|)    
copd_t2 -2.77589   0.06229  0.14164 -19.6   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

        exp(coef) exp(-coef) lower .95 upper .95
copd_t2   0.06229      16.05   0.04719   0.08223

Concordance= 0.508  (se = 0 )
Likelihood ratio test= 1194  on 1 df,   p=<2e-16
Wald test            = 384.1  on 1 df,   p=<2e-16
Score (logrank) test = 702.8  on 1 df,   p=<2e-16
Variabel Inmsupr
## Variabel inmsupr
Fit_Model_inmsupr1<-coxph(Surv(waktu,status)~ inmsupr_t1, data = DataCluster3, method = "breslow")
summary(Fit_Model_inmsupr1)
Call:
coxph(formula = Surv(waktu, status) ~ inmsupr_t1, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

              coef exp(coef) se(coef)     z Pr(>|z|)    
inmsupr_t1 0.67088   1.95595  0.03215 20.87   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

           exp(coef) exp(-coef) lower .95 upper .95
inmsupr_t1     1.956     0.5113     1.837     2.083

Concordance= 0.51  (se = 0.001 )
Likelihood ratio test= 357.6  on 1 df,   p=<2e-16
Wald test            = 435.5  on 1 df,   p=<2e-16
Score (logrank) test = 452.1  on 1 df,   p=<2e-16
## Variabel inmsupr
Fit_Model_inmsupr2<-coxph(Surv(waktu,status)~ inmsupr_t2, data = DataCluster3, method = "breslow")
summary(Fit_Model_inmsupr2)
Call:
coxph(formula = Surv(waktu, status) ~ inmsupr_t2, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

               coef exp(coef) se(coef)      z Pr(>|z|)    
inmsupr_t2 -1.56192   0.20973  0.08249 -18.94   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

           exp(coef) exp(-coef) lower .95 upper .95
inmsupr_t2    0.2097      4.768    0.1784    0.2465

Concordance= 0.507  (se = 0 )
Likelihood ratio test= 638.8  on 1 df,   p=<2e-16
Wald test            = 358.6  on 1 df,   p=<2e-16
Score (logrank) test = 437.6  on 1 df,   p=<2e-16
Variabel Asthma
## Variabel Asthma
Fit_Model_Asthma<-coxph(Surv(waktu,status)~ asthma, data = DataCluster3, method = "breslow")
summary(Fit_Model_Asthma)
Call:
coxph(formula = Surv(waktu, status) ~ asthma, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

           coef exp(coef) se(coef)      z Pr(>|z|)  
asthma -0.07176   0.93075  0.04002 -1.793    0.073 .
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

       exp(coef) exp(-coef) lower .95 upper .95
asthma    0.9308      1.074    0.8605     1.007

Concordance= 0.501  (se = 0 )
Likelihood ratio test= 3.29  on 1 df,   p=0.07
Wald test            = 3.22  on 1 df,   p=0.07
Score (logrank) test = 3.22  on 1 df,   p=0.07
Variabel Cardivascular
## Variabel Cardiovascular
Fit_Model_Cardivascular1<-coxph(Surv(waktu,status)~ cardiovascular_t1, data = DataCluster3, method = "breslow")
summary(Fit_Model_Cardivascular1)
Call:
coxph(formula = Surv(waktu, status) ~ cardiovascular_t1, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

                     coef exp(coef) se(coef)     z Pr(>|z|)    
cardiovascular_t1 0.51518   1.67393  0.02496 20.64   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

                  exp(coef) exp(-coef) lower .95 upper .95
cardiovascular_t1     1.674     0.5974     1.594     1.758

Concordance= 0.512  (se = 0.001 )
Likelihood ratio test= 367.9  on 1 df,   p=<2e-16
Wald test            = 425.9  on 1 df,   p=<2e-16
Score (logrank) test = 435.4  on 1 df,   p=<2e-16
## Variabel Cardiovascular
Fit_Model_Cardivascular2<-coxph(Surv(waktu,status)~ cardiovascular_t2, data = DataCluster3, method = "breslow")
summary(Fit_Model_Cardivascular2)
Call:
coxph(formula = Surv(waktu, status) ~ cardiovascular_t2, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

                      coef exp(coef) se(coef)      z Pr(>|z|)    
cardiovascular_t2 -2.26781   0.10354  0.08672 -26.15   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

                  exp(coef) exp(-coef) lower .95 upper .95
cardiovascular_t2    0.1035      9.658   0.08735    0.1227

Concordance= 0.513  (se = 0.001 )
Likelihood ratio test= 1640  on 1 df,   p=<2e-16
Wald test            = 683.9  on 1 df,   p=<2e-16
Score (logrank) test = 1030  on 1 df,   p=<2e-16
Variabel Pregnancy
## Variabel Pregnancy
Fit_Model_Pregnancy<-coxph(Surv(waktu,status)~ pregnancy, data = DataCluster3, method = "breslow")
summary(Fit_Model_Pregnancy)
Call:
coxph(formula = Surv(waktu, status) ~ pregnancy, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

            coef exp(coef) se(coef)     z Pr(>|z|)
pregnancy 0.2278    1.2558   0.1544 1.475     0.14

          exp(coef) exp(-coef) lower .95 upper .95
pregnancy     1.256     0.7963    0.9279       1.7

Concordance= 0.5  (se = 0 )
Likelihood ratio test= 2.02  on 1 df,   p=0.2
Wald test            = 2.18  on 1 df,   p=0.1
Score (logrank) test = 2.19  on 1 df,   p=0.1
Fit_Model_Pregnancy<-coxph(Surv(waktu,status)~ tobacco, data = DataCluster3, method = "breslow")
summary(Fit_Model_Pregnancy)
Call:
coxph(formula = Surv(waktu, status) ~ tobacco, data = DataCluster3, 
    method = "breslow")

  n= 33898, number of events= 32022 

          coef exp(coef) se(coef)     z Pr(>|z|)    
tobacco 0.8789    2.4082   0.2358 3.727 0.000194 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

        exp(coef) exp(-coef) lower .95 upper .95
tobacco     2.408     0.4153     1.517     3.823

Concordance= 0.5  (se = 0 )
Likelihood ratio test= 10.58  on 1 df,   p=0.001
Wald test            = 13.89  on 1 df,   p=2e-04
Score (logrank) test = 14.81  on 1 df,   p=1e-04