dados<- read.table("C:\\Users\\USER\\Documents\\sobrevivencia2.csv",header = T, sep = ",")
head(dados)
## Bike_id Publish_period End_Date Departure_Date
## 1 XL3-1095127 10 1.301357e+18 1.305590e+18
## 3 XL3-1123648 28 1.302307e+18 1.307923e+18
## 4 XL3-1139930 17 1.302826e+18 1.308096e+18
## 6 XL3-1277412 17 1.301616e+18 1.310170e+18
## 8 XL3-1513147 4 1.302221e+18 1.312848e+18
## 10 XL3-1146406 48 1.307318e+18 1.317427e+18
## Distance_travelled Color Country_Sold N_Photos Price N_Inquires
## 1 123525 Silver Vietnam 27 110000 34
## 3 120000 Silver Vietnam 28 110000 53
## 4 149374 Silver Vietnam 27 130000 34
## 6 112167 Black Vietnam 26 150000 58
## 8 126000 Black Vietnam 29 150000 20
## 10 154117 Silver Laos 28 150000 73
## is_sold
## 1 0
## 3 1
## 4 0
## 6 0
## 8 0
## 10 0
dados$Color<- as.factor(dados$Color)
dados$Country_Sold<- as.factor(dados$Country_Sold)
attach(dados)
dad<-dados[,c(-1,-6,-7,-11)]
basicStats(dad)
## Publish_period End_Date Departure_Date Distance_travelled
## nobs 2660.000000 2.660000e+03 2.660000e+03 2.660000e+03
## NAs 0.000000 0.000000e+00 0.000000e+00 0.000000e+00
## Minimum 0.000000 1.301357e+18 1.305590e+18 6.560000e+03
## Maximum 66.000000 1.402358e+18 1.409702e+18 1.813260e+05
## 1. Quartile 5.000000 1.364947e+18 1.369267e+18 7.151825e+04
## 3. Quartile 17.000000 1.390262e+18 1.395792e+18 1.080158e+05
## Mean 11.968421 1.375150e+18 1.379954e+18 9.012179e+04
## Median 9.000000 1.381277e+18 1.384819e+18 9.051150e+04
## Sum 31836.000000 3.657898e+21 3.670677e+21 2.397240e+08
## SE Mean 0.194594 3.872566e+14 3.876686e+14 5.281289e+02
## LCL Mean 11.586850 1.374390e+18 1.379193e+18 8.908621e+04
## UCL Mean 12.349992 1.375909e+18 1.380714e+18 9.115738e+04
## Variance 100.725591 3.989140e+32 3.997634e+32 7.419276e+08
## Stdev 10.036214 1.997283e+16 1.999408e+16 2.723835e+04
## Skewness 1.482170 -1.173550e+00 -1.024769e+00 2.545200e-02
## Kurtosis 2.995359 1.034617e+00 6.429600e-01 -1.159300e-01
## N_Photos Price N_Inquires
## nobs 2660.000000 2.660000e+03 2660.000000
## NAs 0.000000 0.000000e+00 0.000000
## Minimum 4.000000 6.000000e+04 1.000000
## Maximum 45.000000 2.100000e+05 306.000000
## 1. Quartile 28.000000 9.000000e+04 4.000000
## 3. Quartile 30.000000 1.000000e+05 15.000000
## Mean 29.622180 9.292707e+04 12.218045
## Median 30.000000 9.000000e+04 8.000000
## Sum 78795.000000 2.471860e+08 32500.000000
## SE Mean 0.040813 2.585055e+02 0.311374
## LCL Mean 29.542152 9.242018e+04 11.607485
## UCL Mean 29.702209 9.343396e+04 12.828605
## Variance 4.430723 1.777547e+08 257.897531
## Stdev 2.104928 1.333247e+04 16.059188
## Skewness -3.158401 1.638957e+00 6.851322
## Kurtosis 50.685277 6.119893e+00 87.903827
dad<- dados[,c(6,7,11)]
dad$is_sold<- as.factor(dad$is_sold)
summary(dad)
## Color Country_Sold is_sold
## Silver :649 Laos :1472 0:2321
## Blue :608 Philippine: 404 1: 339
## Red :592 Vietnam : 275
## Pearl :209 Cambodia : 245
## Black :196 Malaysia : 57
## Pink :107 Chile : 41
## (Other):299 (Other) : 166
par(mfrow=c(2,2))
boxplot(dados$Price, las= 2, main = "BoxPlot da variável Preço")
boxplot(dados$N_Inquires, las= 2, main = "BoxPlot da variável Número de conversas")
boxplot(dados$N_Photos, las= 2, main = "BoxPlot da variável N de Fotos")
boxplot(dados$Distance_travelled, las= 2, main = "BoxPlot da variável Distância percorrida")
ad.test(Price)
##
## Anderson-Darling normality test
##
## data: Price
## A = 126.19, p-value < 2.2e-16
ad.test(Publish_period)
##
## Anderson-Darling normality test
##
## data: Publish_period
## A = 72.349, p-value < 2.2e-16
ad.test(N_Inquires)
##
## Anderson-Darling normality test
##
## data: N_Inquires
## A = 261.77, p-value < 2.2e-16
ad.test(N_Photos)
##
## Anderson-Darling normality test
##
## data: N_Photos
## A = 115.53, p-value < 2.2e-16
ad.test(Distance_travelled)
##
## Anderson-Darling normality test
##
## data: Distance_travelled
## A = 0.48731, p-value = 0.224
par(mfrow=c(2,2))
histPlot(as.timeSeries(Price))
histPlot(as.timeSeries(Publish_period))
histPlot(as.timeSeries(N_Inquires))
histPlot(as.timeSeries(N_Photos))
histPlot(as.timeSeries(Distance_travelled))
dad<-dados[,c(-1,-3,-4,-6,-7,-11)]
corrplot(cor(dad), order = "hclust",tl.col = 'black', tl.cex = 0.75)
R <- round(cor(dad), 2);R
## Publish_period Distance_travelled N_Photos Price
## Publish_period 1.00 0.06 0.08 0.16
## Distance_travelled 0.06 1.00 -0.10 -0.12
## N_Photos 0.08 -0.10 1.00 0.03
## Price 0.16 -0.12 0.03 1.00
## N_Inquires 0.26 0.10 -0.12 0.10
## N_Inquires
## Publish_period 0.26
## Distance_travelled 0.10
## N_Photos -0.12
## Price 0.10
## N_Inquires 1.00
ekm1<- survfit(Surv(tempos,cens)~1, data= dados);ekm1
## Call: survfit(formula = Surv(tempos, cens) ~ 1, data = dados)
##
## n events median 0.95LCL 0.95UCL
## 2660 339 NA NA NA
summary(ekm1)
## Call: survfit(formula = Surv(tempos, cens) ~ 1, data = dados)
##
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 0.1 2660 10 0.996 0.00119 0.994 0.999
## 1.0 2548 15 0.990 0.00192 0.987 0.994
## 2.0 2430 20 0.982 0.00263 0.977 0.987
## 3.0 2284 36 0.967 0.00364 0.960 0.974
## 4.0 2145 20 0.958 0.00413 0.950 0.966
## 5.0 2004 22 0.947 0.00465 0.938 0.956
## 6.0 1877 40 0.927 0.00554 0.916 0.938
## 7.0 1728 56 0.897 0.00666 0.884 0.910
## 8.0 1561 26 0.882 0.00716 0.868 0.896
## 9.0 1445 16 0.872 0.00749 0.858 0.887
## 10.0 1329 13 0.864 0.00778 0.849 0.879
## 11.0 1209 8 0.858 0.00799 0.843 0.874
## 12.0 1110 11 0.850 0.00831 0.833 0.866
## 13.0 1019 6 0.845 0.00851 0.828 0.861
## 14.0 932 13 0.833 0.00899 0.815 0.851
## 15.0 832 2 0.831 0.00908 0.813 0.849
## 16.0 752 4 0.826 0.00930 0.808 0.845
## 17.0 691 2 0.824 0.00942 0.806 0.843
## 18.0 633 5 0.817 0.00979 0.798 0.837
## 20.0 505 1 0.816 0.00990 0.797 0.835
## 21.0 461 5 0.807 0.01056 0.787 0.828
## 22.0 401 2 0.803 0.01088 0.782 0.825
## 24.0 324 1 0.800 0.01113 0.779 0.823
## 25.0 284 2 0.795 0.01174 0.772 0.818
## 28.0 210 1 0.791 0.01228 0.767 0.815
## 29.0 186 1 0.787 0.01293 0.762 0.813
## 38.0 65 1 0.775 0.01750 0.741 0.810
plot(ekm1, ylab = "S(t)", xlab = "Dias", main = "Curva de Sobrevivencia")
KMcor <- survfit(Surv(tempos, cens)~ Color, data = dados)
KMcor
## Call: survfit(formula = Surv(tempos, cens) ~ Color, data = dados)
##
## n events median 0.95LCL 0.95UCL
## Color=Beige 2 0 NA NA NA
## Color=Black 196 20 NA NA NA
## Color=Blue 608 78 NA NA NA
## Color=Brown 1 0 NA NA NA
## Color=Gray 73 11 NA NA NA
## Color=Green 49 5 NA NA NA
## Color=Maroon 26 9 16 10 NA
## Color=Pearl 209 29 38 38 NA
## Color=Pink 107 4 NA NA NA
## Color=Purple 1 0 NA NA NA
## Color=Red 592 73 NA NA NA
## Color=Silver 649 93 NA NA NA
## Color=White 106 15 NA NA NA
## Color=Yellow 41 2 NA NA NA
plot(KMcor, lty = 1:14, col = 1:14, ylab = "S(t)", xlab = "Dias",
conf.int = F, main ="Curva de Sobrevivência pelas cores das motos")
#separando o preco em dois(mediana) grupos temos q
summary(Price)#mediana= 90000
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 60000 90000 90000 92927 100000 210000
idapreco<- cut(dados$Price, breaks=c(21000,80000,171000),labels=c("1","2"), right=F)
KMpreco2<- survfit(Surv(tempos, cens) ~idapreco, data= dados)
KMpreco2
## Call: survfit(formula = Surv(tempos, cens) ~ idapreco, data = dados)
##
## 1 observation deleted due to missingness
## n events median 0.95LCL 0.95UCL
## idapreco=1 98 34 21 14 25
## idapreco=2 2561 305 NA NA NA
plot(KMpreco2, lty = 1:2, col = 2:3, ylab = "S(t)", xlab = "Dias",
conf.int = F, main = "Curvas de sobrevivências com base no preço")
legend(1,0.3,lty = 1:2, col = 2:3,c("1 < mediana","2 >= mediana"),lwd=1, bty="n")
survdiff(Surv(tempos,cens)~idapreco, data = dados, rho= 0)
## Call:
## survdiff(formula = Surv(tempos, cens) ~ idapreco, data = dados,
## rho = 0)
##
## n=2659, 1 observation deleted due to missingness.
##
## N Observed Expected (O-E)^2/E (O-E)^2/V
## idapreco=1 98 34 10.3 54.2 56.7
## idapreco=2 2561 305 328.7 1.7 56.7
##
## Chisq= 56.7 on 1 degrees of freedom, p= 5e-14
summary((N_Photos))#30 mediana
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 4.00 28.00 30.00 29.62 30.00 45.00
idafotos<- cut(dados$N_Photos, breaks=c(4,30,46),labels=c("1","2"), right=F)
length(idafotos)
## [1] 2660
KMfoto <- survfit(Surv(tempos, cens) ~ idafotos, data = dados)
KMfoto
## Call: survfit(formula = Surv(tempos, cens) ~ idafotos, data = dados)
##
## n events median 0.95LCL 0.95UCL
## idafotos=1 1284 209 NA NA NA
## idafotos=2 1376 130 NA NA NA
plot(KMfoto, lty = 1:2, col = 2:3, ylab = "S(t)", xlab = "Dias",
conf.int = F, main ="Curva de Sobrevivência pelo número de fotos")
legend(1,0.3,lty = 1:2, col = 2:3,c("1 < mediana","2 >= mediana"),lwd=1, bty="n")
survdiff(Surv(tempos,cens)~idafotos, data = dados, rho= 0)
## Call:
## survdiff(formula = Surv(tempos, cens) ~ idafotos, data = dados,
## rho = 0)
##
## N Observed Expected (O-E)^2/E (O-E)^2/V
## idafotos=1 1284 209 157 17.2 32.5
## idafotos=2 1376 130 182 14.8 32.5
##
## Chisq= 32.5 on 1 degrees of freedom, p= 1e-08
#---------------------------------------------N_inquires
summary(N_Inquires)#8 mediana
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.00 4.00 8.00 12.22 15.00 306.00
idainqui<- cut(dados$N_Inquires, breaks=c(1,8,307),labels=c("1","2"), right=F)
KMinqui <- survfit(Surv(tempos, cens) ~ idainqui, data = dados)
KMinqui
## Call: survfit(formula = Surv(tempos, cens) ~ idainqui, data = dados)
##
## n events median 0.95LCL 0.95UCL
## idainqui=1 1279 261 NA NA NA
## idainqui=2 1381 78 NA NA NA
plot(KMinqui, lty = 1:2, col = 2:3, ylab = "S(t)", xlab = "Dias",
conf.int = F, main ="Curva de Sobrevida pelo número de Inqueritos")
legend(1,0.3,lty = 1:2, col = 2:3,c("1 < mediana","2 >= mediana"),lwd=1, bty="n")
survdiff(Surv(tempos,cens)~idainqui, data = dados, rho= 0)
## Call:
## survdiff(formula = Surv(tempos, cens) ~ idainqui, data = dados,
## rho = 0)
##
## N Observed Expected (O-E)^2/E (O-E)^2/V
## idainqui=1 1279 261 145 92.6 166
## idainqui=2 1381 78 194 69.3 166
##
## Chisq= 166 on 1 degrees of freedom, p= <2e-16
summary(Distance_travelled)#90512 mediana
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 6560 71518 90512 90122 108016 181326
idadist<- cut(dados$Distance_travelled, breaks=c(6560,90512,181326),labels=c("1","2"), right=F)
KMdist <- survfit(Surv(tempos, cens) ~ idainqui, data = dados)
KMdist
## Call: survfit(formula = Surv(tempos, cens) ~ idainqui, data = dados)
##
## n events median 0.95LCL 0.95UCL
## idainqui=1 1279 261 NA NA NA
## idainqui=2 1381 78 NA NA NA
plot(KMdist, lty = 1:2, col = 2:3, ylab = "S(t)", xlab = "Dias",
conf.int = F, main ="Curva de Sobrevida pela distáncia percorrida")
legend(1,0.3,lty = 1:2, col = 2:3,c("1 < mediana","2 >= mediana"),lwd=1, bty="n")
survdiff(Surv(tempos,cens)~idadist, data = dados, rho= 0)
## Call:
## survdiff(formula = Surv(tempos, cens) ~ idadist, data = dados,
## rho = 0)
##
## n=2659, 1 observation deleted due to missingness.
##
## N Observed Expected (O-E)^2/E (O-E)^2/V
## idadist=1 1330 206 166 9.57 19.1
## idadist=2 1329 133 173 9.20 19.1
##
## Chisq= 19.1 on 1 degrees of freedom, p= 1e-05
ajust1<-survreg(Surv(tempos,cens)~1,dist="exponential")
alpha1<-exp(ajust1$coefficients[1])
ajust2<-survreg(Surv(tempos,cens)~1,dist="weibull")
alpha2<-exp(ajust2$coefficients[1]);
gama<-1/ajust2$scale
ajust3<-survreg(Surv(tempos,cens)~1,dist="lognorm")
#S(T) KAPLA VS ESTIMATIVAS
ekm<- survfit(Surv(tempos,cens)~1, data= dados)
time<-ekm$time
st<-ekm$surv
ste<- exp(-time/alpha1)
stw<- exp(-(time/alpha2)^gama)
stln<- pnorm((-log(time)+ 4.778)/2.0347)
cbind(time,st,ste,stw,stln)
## time st ste stw stln
## [1,] 0.1 0.9962406 0.9989361 0.9984058 0.9997492
## [2,] 1.0 0.9903758 0.9894119 0.9868017 0.9905693
## [3,] 2.0 0.9822245 0.9789359 0.9751655 0.9776568
## [4,] 3.0 0.9667429 0.9685708 0.9641332 0.9647216
## [5,] 4.0 0.9577290 0.9583154 0.9535150 0.9522360
## [6,] 5.0 0.9472150 0.9481687 0.9432214 0.9402959
## [7,] 6.0 0.9270292 0.9381293 0.9331998 0.9289012
## [8,] 7.0 0.8969866 0.9281963 0.9234151 0.9180230
## [9,] 8.0 0.8820464 0.9183684 0.9138422 0.9076246
## [10,] 9.0 0.8722798 0.9086446 0.9044619 0.8976691
## [11,] 10.0 0.8637474 0.8990238 0.8952592 0.8881217
## [12,] 11.0 0.8580319 0.8895048 0.8862221 0.8789506
## [13,] 12.0 0.8495289 0.8800866 0.8773404 0.8701274
## [14,] 13.0 0.8445268 0.8707682 0.8686055 0.8616262
## [15,] 14.0 0.8327469 0.8615484 0.8600101 0.8534241
## [16,] 15.0 0.8307451 0.8524262 0.8515477 0.8455004
## [17,] 16.0 0.8263262 0.8434006 0.8432126 0.8378366
## [18,] 17.0 0.8239345 0.8344706 0.8349999 0.8304159
## [19,] 18.0 0.8174264 0.8256351 0.8269050 0.8232231
## [20,] 19.0 0.8174264 0.8168931 0.8189237 0.8162446
## [21,] 20.0 0.8158077 0.8082438 0.8110523 0.8094677
## [22,] 21.0 0.8069595 0.7996860 0.8032873 0.8028811
## [23,] 22.0 0.8029347 0.7912188 0.7956256 0.7964744
## [24,] 23.0 0.8029347 0.7828413 0.7880642 0.7902379
## [25,] 24.0 0.8004565 0.7745525 0.7806004 0.7841630
## [26,] 25.0 0.7948195 0.7663514 0.7732316 0.7782414
## [27,] 26.0 0.7948195 0.7582372 0.7659555 0.7724656
## [28,] 27.0 0.7948195 0.7502089 0.7587697 0.7668288
## [29,] 28.0 0.7910347 0.7422656 0.7516722 0.7613244
## [30,] 29.0 0.7867818 0.7344064 0.7446609 0.7559465
## [31,] 30.0 0.7867818 0.7266304 0.7377339 0.7506895
## [32,] 31.0 0.7867818 0.7189367 0.7308894 0.7455482
## [33,] 32.0 0.7867818 0.7113245 0.7241257 0.7405177
## [34,] 33.0 0.7867818 0.7037930 0.7174412 0.7355934
## [35,] 34.0 0.7867818 0.6963411 0.7108342 0.7307712
## [36,] 35.0 0.7867818 0.6889682 0.7043033 0.7260468
## [37,] 36.0 0.7867818 0.6816733 0.6978470 0.7214167
## [38,] 37.0 0.7867818 0.6744556 0.6914639 0.7168771
## [39,] 38.0 0.7746775 0.6673144 0.6851528 0.7124248
## [40,] 39.0 0.7746775 0.6602488 0.6789122 0.7080566
## [41,] 40.0 0.7746775 0.6532580 0.6727410 0.7037696
## [42,] 41.0 0.7746775 0.6463412 0.6666380 0.6995607
## [43,] 42.0 0.7746775 0.6394977 0.6606020 0.6954275
## [44,] 43.0 0.7746775 0.6327266 0.6546320 0.6913673
## [45,] 44.0 0.7746775 0.6260272 0.6487267 0.6873777
## [46,] 45.0 0.7746775 0.6193988 0.6428853 0.6834564
## [47,] 46.0 0.7746775 0.6128405 0.6371066 0.6796013
## [48,] 47.0 0.7746775 0.6063517 0.6313897 0.6758102
## [49,] 48.0 0.7746775 0.5999315 0.6257336 0.6720812
## [50,] 49.0 0.7746775 0.5935794 0.6201375 0.6684123
## [51,] 50.0 0.7746775 0.5872945 0.6146003 0.6648019
## [52,] 51.0 0.7746775 0.5810761 0.6091212 0.6612481
## [53,] 52.0 0.7746775 0.5749236 0.6036994 0.6577493
## [54,] 54.0 0.7746775 0.5628134 0.5930243 0.6509106
## [55,] 56.0 0.7746775 0.5509582 0.5825686 0.6442738
## [56,] 57.0 0.7746775 0.5451246 0.5774210 0.6410278
## [57,] 59.0 0.7746775 0.5336420 0.5672828 0.6346740
## [58,] 60.0 0.7746775 0.5279917 0.5622908 0.6315639
## [59,] 61.0 0.7746775 0.5224013 0.5573492 0.6284967
## [60,] 63.0 0.7746775 0.5113973 0.5476148 0.6224870
## [61,] 66.0 0.7746775 0.4953245 0.5333751 0.6137689
x1<-survreg(Surv(tempos,cens)~1, data= dados, dist="lognormal") #lognormal tem 2 parametros
x2<-survreg(Surv(tempos,cens)~1, data= dados, dist="exponential") #exponencial tem 1 parametros
x3<-survreg(Surv(tempos,cens)~1, data= dados, dist="weibull") #tem 2 parametros
alpha.e<-exp(x2$coefficients[1])
alpha.w<-exp(x3$coefficients[1])
gama<-1/x3$scale
x4<-flexsurvreg(Surv(tempos,cens)~1, data= dados, dist="gengamma")# gama generalizada tem 3 parametros
TRV1=2*(x4$loglik-x1$loglik[2])
modelo1=1-pchisq(TRV1,1)
TRV2=2*(x4$loglik-x2$loglik[2])
modelo2=1-pchisq(TRV2,2)
TRV3=2*(x4$loglik-x3$loglik[2])
modelo3=1-pchisq(TRV3,1)
distri<- c("exp","weibull","lognormal");distri
## [1] "exp" "weibull" "lognormal"
modelos=c(modelo1,modelo2,modelo3);modelos
## [1] 8.939157e-01 8.088587e-07 7.059712e-07
par(mfrow=c(1,1))
plot(ekm, conf.int=F, xlab="Tempos", ylab="S(t)", main= "Kaplan-Meier vs exponencial" )
lines(c(0,time),c(1,ste), lty=2)
legend(3,0.4,lty=c(1,2),c("Kaplan-Meier", "exponencial"),bty="n",cex=0.8)
plot(ekm, conf.int=F, xlab="Tempos", ylab="S(t)", main= "Kaplan-Meier vs Weibull" )
lines(c(0,time),c(1,stw), lty=2)
legend(3,0.4,lty=c(1,2),c("Kaplan-Meier", "Weibull"),bty="n",cex=0.8)
plot(ekm, conf.int=F, xlab="Tempos", ylab="S(t)", main= "Kaplan-Meiervs log-normal")
lines(c(0,time),c(1,stln), lty=2)
legend(3,0.4,lty=c(1,2),c("Kaplan-Meier", "Log-normal"),bty="n",cex=0.8)
ajuste1<-survreg(Surv(tempos,cens)~1, data= dados, dist="lognorm")
ajuste2<-survreg(Surv(tempos,cens)~Distance_travelled, data= dados, dist="lognorm")
summary(ajust2)
##
## Call:
## survreg(formula = Surv(tempos, cens) ~ 1, dist = "weibull")
## Value Std. Error z p
## (Intercept) 4.6941 0.1055 44.49 <2e-16
## Log(scale) 0.0828 0.0454 1.82 0.068
##
## Scale= 1.09
##
## Weibull distribution
## Loglik(model)= -1877.2 Loglik(intercept only)= -1877.2
## Number of Newton-Raphson Iterations: 10
## n= 2660
ajuste3<-survreg(Surv(tempos,cens)~N_Photos, data= dados, dist="lognorm")
summary(ajuste3)
##
## Call:
## survreg(formula = Surv(tempos, cens) ~ N_Photos, data = dados,
## dist = "lognorm")
## Value Std. Error z p
## (Intercept) -0.7709 0.7631 -1.01 0.31
## N_Photos 0.1862 0.0264 7.05 1.8e-12
## Log(scale) 0.6783 0.0423 16.03 < 2e-16
##
## Scale= 1.97
##
## Log Normal distribution
## Loglik(model)= -1839.5 Loglik(intercept only)= -1865
## Chisq= 50.99 on 1 degrees of freedom, p= 9.3e-13
## Number of Newton-Raphson Iterations: 5
## n= 2660
ajuste4<-survreg(Surv(tempos,cens)~N_Inquires, data= dados, dist="lognorm")
summary(ajuste4)
##
## Call:
## survreg(formula = Surv(tempos, cens) ~ N_Inquires, data = dados,
## dist = "lognorm")
## Value Std. Error z p
## (Intercept) 3.49654 0.10763 32.5 <2e-16
## N_Inquires 0.10473 0.00891 11.8 <2e-16
## Log(scale) 0.55693 0.04185 13.3 <2e-16
##
## Scale= 1.75
##
## Log Normal distribution
## Loglik(model)= -1758.2 Loglik(intercept only)= -1865
## Chisq= 213.47 on 1 degrees of freedom, p= 2.4e-48
## Number of Newton-Raphson Iterations: 5
## n= 2660
ajuste5<-survreg(Surv(tempos,cens)~Price, data= dados, dist="lognorm")
summary(ajuste5)
##
## Call:
## survreg(formula = Surv(tempos, cens) ~ Price, data = dados, dist = "lognorm")
## Value Std. Error z p
## (Intercept) 1.85e+00 4.59e-01 4.03 5.5e-05
## Price 3.13e-05 5.08e-06 6.16 7.1e-10
## Log(scale) 6.88e-01 4.24e-02 16.25 < 2e-16
##
## Scale= 1.99
##
## Log Normal distribution
## Loglik(model)= -1844 Loglik(intercept only)= -1865
## Chisq= 41.91 on 1 degrees of freedom, p= 9.6e-11
## Number of Newton-Raphson Iterations: 5
## n= 2660
ajuste6<-survreg(Surv(tempos,cens)~Color, data= dados, dist="lognorm")
summary(ajuste6)
##
## Call:
## survreg(formula = Surv(tempos, cens) ~ Color, data = dados, dist = "lognorm")
## Value Std. Error z p
## (Intercept) 12.8322 813.3195 0.02 0.99
## ColorBlack -7.9480 813.3195 -0.01 0.99
## ColorBlue -8.0969 813.3195 -0.01 0.99
## ColorBrown -4.7233 1429.9126 0.00 1.00
## ColorGray -7.9780 813.3195 -0.01 0.99
## ColorGreen -7.6169 813.3196 -0.01 0.99
## ColorMaroon -9.6240 813.3196 -0.01 0.99
## ColorPearl -8.1915 813.3195 -0.01 0.99
## ColorPink -6.5785 813.3196 -0.01 0.99
## ColorPurple -1.0345 1429.9126 0.00 1.00
## ColorRed -8.0493 813.3195 -0.01 0.99
## ColorSilver -8.2466 813.3195 -0.01 0.99
## ColorWhite -8.3344 813.3195 -0.01 0.99
## ColorYellow -7.0512 813.3197 -0.01 0.99
## Log(scale) 0.6959 0.0424 16.41 <2e-16
##
## Scale= 2.01
##
## Log Normal distribution
## Loglik(model)= -1850.6 Loglik(intercept only)= -1865
## Chisq= 28.79 on 13 degrees of freedom, p= 0.007
## Number of Newton-Raphson Iterations: 12
## n= 2660
ajuste7<-survreg(Surv(tempos,cens)~Country_Sold, data= dados, dist="lognorm")
summary(ajuste7)
##
## Call:
## survreg(formula = Surv(tempos, cens) ~ Country_Sold, data = dados,
## dist = "lognorm")
## Value Std. Error z p
## (Intercept) 3.10e+00 6.82e-01 4.54 5.5e-06
## Country_SoldAruba 1.06e+01 1.09e+03 0.01 0.9922
## Country_SoldBahamas 1.30e+00 1.31e+00 1.00 0.3190
## Country_SoldBotswana 1.03e+01 1.57e+03 0.01 0.9948
## Country_SoldBrunei 1.02e+00 1.07e+00 0.95 0.3408
## Country_SoldBurundi -5.04e-01 1.63e+00 -0.31 0.7576
## Country_SoldCambodia 9.65e-01 7.02e-01 1.38 0.1690
## Country_SoldCayman Islands -2.00e+00 2.02e+00 -0.99 0.3213
## Country_SoldChile 3.38e-01 7.83e-01 0.43 0.6665
## Country_SoldCommonwealth Of Dominica 9.14e+00 0.00e+00 Inf < 2e-16
## Country_SoldD.R.Congo 1.05e+01 1.58e+03 0.01 0.9947
## Country_SoldGuatemala 5.00e-01 1.11e+00 0.45 0.6515
## Country_SoldIndonesia 3.15e-01 8.10e-01 0.39 0.6978
## Country_SoldKazakhstan 5.23e+00 0.00e+00 Inf < 2e-16
## Country_SoldLaos 2.02e+00 6.87e-01 2.93 0.0033
## Country_SoldLiberia 9.93e+00 0.00e+00 Inf < 2e-16
## Country_SoldMalawi 9.22e-01 8.55e-01 1.08 0.2807
## Country_SoldMalaysia 1.17e+00 7.73e-01 1.51 0.1313
## Country_SoldMicronesia 1.69e+00 1.01e+00 1.68 0.0936
## Country_SoldMyanmar -6.39e-03 1.34e+00 0.00 0.9962
## Country_SoldNew Zealand 8.87e+00 2.21e+03 0.00 0.9968
## Country_SoldNigeria 9.32e+00 0.00e+00 Inf < 2e-16
## Country_SoldPhilippine 8.82e-01 6.94e-01 1.27 0.2034
## Country_SoldRussian Federation 9.83e+00 0.00e+00 Inf < 2e-16
## Country_SoldSamoa 1.07e+01 0.00e+00 Inf < 2e-16
## Country_SoldSt.Maarten 9.61e+00 0.00e+00 Inf < 2e-16
## Country_SoldThailand 1.01e+01 1.82e+03 0.01 0.9956
## Country_SoldTurks And Caicos Islands 1.04e+01 1.39e+03 0.01 0.9941
## Country_SoldUganda 3.61e-01 1.49e+00 0.24 0.8082
## Country_SoldVietnam 1.48e+00 7.02e-01 2.10 0.0354
## Log(scale) 6.40e-01 4.22e-02 15.15 < 2e-16
##
## Scale= 1.9
##
## Log Normal distribution
## Loglik(model)= -1815 Loglik(intercept only)= -1865
## Chisq= 99.95 on 29 degrees of freedom, p= 1e-09
## Number of Newton-Raphson Iterations: 14
## n= 2660
ajuste8<-survreg(Surv(tempos,cens)~Distance_travelled+N_Photos+N_Inquires+Price, data= dados, dist="lognorm")
ajuste9<-survreg(Surv(tempos,cens)~Distance_travelled+N_Photos+N_Inquires, data= dados, dist="lognorm")
anova(ajuste8,ajuste9)
## Terms Resid. Df -2*LL
## 1 Distance_travelled + N_Photos + N_Inquires + Price 2654 3370.644
## 2 Distance_travelled + N_Photos + N_Inquires 2655 3422.343
## Test Df Deviance Pr(>Chi)
## 1 NA NA NA
## 2 = -1 -51.69896 6.469689e-13
ajuste10<-survreg(Surv(tempos,cens)~Distance_travelled+N_Photos+Price, data= dados, dist="lognorm")
anova(ajuste8,ajuste10)
## Terms Resid. Df -2*LL
## 1 Distance_travelled + N_Photos + N_Inquires + Price 2654 3370.644
## 2 Distance_travelled + N_Photos + Price 2655 3598.260
## Test Df Deviance Pr(>Chi)
## 1 NA NA NA
## 2 = -1 -227.6164 1.973225e-51
ajuste11<-survreg(Surv(tempos,cens)~Distance_travelled+N_Inquires+Price, data= dados, dist="lognorm")
anova(ajuste8,ajuste11)
## Terms Resid. Df -2*LL
## 1 Distance_travelled + N_Photos + N_Inquires + Price 2654 3370.644
## 2 Distance_travelled + N_Inquires + Price 2655 3440.377
## Test Df Deviance Pr(>Chi)
## 1 NA NA NA
## 2 = -1 -69.73361 6.787952e-17
ajuste12<-survreg(Surv(tempos,cens)~N_Photos+N_Inquires+Price, data= dados, dist="lognorm")
anova(ajuste8,ajuste12)
## Terms Resid. Df -2*LL
## 1 Distance_travelled + N_Photos + N_Inquires + Price 2654 3370.644
## 2 N_Photos + N_Inquires + Price 2655 3403.219
## Test Df Deviance Pr(>Chi)
## 1 NA NA NA
## 2 = -1 -32.57498 1.146817e-08
ajuste13<-survreg(Surv(tempos,cens)~Distance_travelled+N_Photos+N_Inquires+Price+Color, data= dados, dist="lognorm")
anova(ajuste8,ajuste13)
## Terms Resid. Df
## 1 Distance_travelled + N_Photos + N_Inquires + Price 2654
## 2 Distance_travelled + N_Photos + N_Inquires + Price + Color 2641
## -2*LL Test Df Deviance Pr(>Chi)
## 1 3370.644 NA NA NA
## 2 3335.245 = 13 35.39868 0.0007351088
ajuste14<-survreg(Surv(tempos,cens)~Distance_travelled+N_Photos+N_Inquires+Price+Country_Sold, data= dados, dist="lognorm")
anova(ajuste8,ajuste14)
## Terms
## 1 Distance_travelled + N_Photos + N_Inquires + Price
## 2 Distance_travelled + N_Photos + N_Inquires + Price + Country_Sold
## Resid. Df -2*LL Test Df Deviance Pr(>Chi)
## 1 2654 3370.644 NA NA NA
## 2 2625 3262.946 = 29 107.6977 5.535194e-11
ajuste15<-survreg(Surv(tempos,cens)~Distance_travelled+N_Photos+N_Inquires, data= dados, dist="lognorm")
anova(ajuste8,ajuste15)
## Terms Resid. Df -2*LL
## 1 Distance_travelled + N_Photos + N_Inquires + Price 2654 3370.644
## 2 Distance_travelled + N_Photos + N_Inquires 2655 3422.343
## Test Df Deviance Pr(>Chi)
## 1 NA NA NA
## 2 = -1 -51.69896 6.469689e-13
ajuste16<-survreg(Surv(tempos,cens)~Distance_travelled+N_Photos+Price, data= dados, dist="lognorm")
anova(ajuste8,ajuste16)
## Terms Resid. Df -2*LL
## 1 Distance_travelled + N_Photos + N_Inquires + Price 2654 3370.644
## 2 Distance_travelled + N_Photos + Price 2655 3598.260
## Test Df Deviance Pr(>Chi)
## 1 NA NA NA
## 2 = -1 -227.6164 1.973225e-51
ajuste17<-survreg(Surv(tempos,cens)~Distance_travelled+N_Inquires+Price, data= dados, dist="lognorm")
anova(ajuste8,ajuste17)
## Terms Resid. Df -2*LL
## 1 Distance_travelled + N_Photos + N_Inquires + Price 2654 3370.644
## 2 Distance_travelled + N_Inquires + Price 2655 3440.377
## Test Df Deviance Pr(>Chi)
## 1 NA NA NA
## 2 = -1 -69.73361 6.787952e-17
ajuste18<-survreg(Surv(tempos,cens)~N_Photos+N_Inquires+Price, data= dados, dist="lognorm")
anova(ajuste8,ajuste18)
## Terms Resid. Df -2*LL
## 1 Distance_travelled + N_Photos + N_Inquires + Price 2654 3370.644
## 2 N_Photos + N_Inquires + Price 2655 3403.219
## Test Df Deviance Pr(>Chi)
## 1 NA NA NA
## 2 = -1 -32.57498 1.146817e-08
ajuste19<-survreg(Surv(tempos,cens)~Distance_travelled+N_Photos+N_Inquires+Price+(Distance_travelled*N_Photos), data= dados, dist="lognorm")
anova(ajuste8,ajuste19)
## Terms
## 1 Distance_travelled + N_Photos + N_Inquires + Price
## 2 Distance_travelled + N_Photos + N_Inquires + Price + (Distance_travelled * N_Photos)
## Resid. Df -2*LL Test Df Deviance Pr(>Chi)
## 1 2654 3370.644 NA NA NA
## 2 2653 3369.548 = 1 1.095159 0.2953309
ajuste20<-survreg(Surv(tempos,cens)~Distance_travelled+N_Photos+N_Inquires+Price+(Distance_travelled*N_Inquires), data= dados, dist="lognorm")
anova(ajuste8,ajuste20)
## Terms
## 1 Distance_travelled + N_Photos + N_Inquires + Price
## 2 Distance_travelled + N_Photos + N_Inquires + Price + (Distance_travelled * N_Inquires)
## Resid. Df -2*LL Test Df Deviance Pr(>Chi)
## 1 2654 3370.644 NA NA NA
## 2 2653 3366.917 = 1 3.726522 0.05355479
ajuste21<-survreg(Surv(tempos,cens)~Distance_travelled+N_Photos+N_Inquires+Price+(Distance_travelled*Price), data= dados, dist="lognorm")
anova(ajuste8,ajuste21)
## Terms
## 1 Distance_travelled + N_Photos + N_Inquires + Price
## 2 Distance_travelled + N_Photos + N_Inquires + Price + (Distance_travelled * Price)
## Resid. Df -2*LL Test Df Deviance Pr(>Chi)
## 1 2654 3370.644 NA NA NA
## 2 2653 3359.920 = 1 10.72354 0.001057813
ajuste22<-survreg(Surv(tempos,cens)~Distance_travelled+N_Photos+N_Inquires+Price+(N_Photos*N_Inquires), data= dados, dist="lognorm")
anova(ajuste8,ajuste22)
## Terms
## 1 Distance_travelled + N_Photos + N_Inquires + Price
## 2 Distance_travelled + N_Photos + N_Inquires + Price + (N_Photos * N_Inquires)
## Resid. Df -2*LL Test Df Deviance Pr(>Chi)
## 1 2654 3370.644 NA NA NA
## 2 2653 3370.308 = 1 0.3356108 0.5623738
ajuste23<-survreg(Surv(tempos,cens)~Distance_travelled+N_Photos+N_Inquires+Price+(N_Photos*Price), data= dados, dist="lognorm")
anova(ajuste8,ajuste23)
## Terms
## 1 Distance_travelled + N_Photos + N_Inquires + Price
## 2 Distance_travelled + N_Photos + N_Inquires + Price + (N_Photos * Price)
## Resid. Df -2*LL Test Df Deviance Pr(>Chi)
## 1 2654 3370.644 NA NA NA
## 2 2653 3368.197 = 1 2.446227 0.1178077
ajuste24<-survreg(Surv(tempos,cens)~Distance_travelled+N_Photos+N_Inquires+Price+(N_Inquires*Price), data= dados, dist="lognorm")
anova(ajuste8,ajuste24)
## Terms
## 1 Distance_travelled + N_Photos + N_Inquires + Price
## 2 Distance_travelled + N_Photos + N_Inquires + Price + (N_Inquires * Price)
## Resid. Df -2*LL Test Df Deviance Pr(>Chi)
## 1 2654 3370.644 NA NA NA
## 2 2653 3370.511 = 1 0.1322858 0.7160738
modelofinal<-survreg(Surv(tempos,cens)~Distance_travelled+N_Photos+N_Inquires+Price+(Distance_travelled*N_Inquires), data= dados, dist="lognorm")
summary(modelofinal)
##
## Call:
## survreg(formula = Surv(tempos, cens) ~ Distance_travelled + N_Photos +
## N_Inquires + Price + (Distance_travelled * N_Inquires), data = dados,
## dist = "lognorm")
## Value Std. Error z p
## (Intercept) -6.51e+00 8.54e-01 -7.62 2.5e-14
## Distance_travelled 1.55e-05 2.90e-06 5.34 9.3e-08
## N_Photos 1.86e-01 2.24e-02 8.30 < 2e-16
## N_Inquires 1.49e-01 2.47e-02 6.03 1.6e-09
## Price 3.27e-05 4.65e-06 7.03 2.0e-12
## Distance_travelled:N_Inquires -4.73e-07 2.45e-07 -1.93 0.054
## Log(scale) 4.70e-01 4.14e-02 11.36 < 2e-16
##
## Scale= 1.6
##
## Log Normal distribution
## Loglik(model)= -1683.5 Loglik(intercept only)= -1865
## Chisq= 363 on 5 degrees of freedom, p= 2.8e-76
## Number of Newton-Raphson Iterations: 5
## n= 2660
###analise de residuos
modelofinal$coefficients
## (Intercept) Distance_travelled
## -6.505190e+00 1.549905e-05
## N_Photos N_Inquires
## 1.856982e-01 1.487064e-01
## Price Distance_travelled:N_Inquires
## 3.272951e-05 -4.726824e-07
xb<- modelofinal$coefficients[1]+modelofinal$coefficients[2]*Distance_travelled+modelofinal$coefficients[3]*N_Photos+modelofinal$coefficients[4]*N_Inquires+modelofinal$coefficients[5]*Price + modelofinal$coefficients[6]*(Distance_travelled*N_Inquires)
sigma<-modelofinal$scale
res<-(log(tempos)-(xb))/sigma # residuos padronizados
resid<-exp(res) # exponencial dos residuos padronizados
ekm<- survfit(Surv(resid,cens)~1)
resid<-ekm$time
sln<-pnorm(-log(resid))
# Sobrevivências dos resíduos e??? i estimadas pelo método de Kaplan-Meier e
# pelo modelo log-normal padrão (gráfico á esquerda) e respectivas curvas
# de sobrevivência estimadas (gráfico á direita).
par(mfrow=c(1,2))
plot(ekm$surv,sln, xlab="S(ei*): Kaplan-Meier",ylab="S(ei*): Log-normal padrão",pch=16,col=4)
plot(ekm,conf.int=F,mark.time=F,xlab="Residuos (ei*)",ylab="Sobrevivencia estimada",pch=16, col=2)
lines(resid,sln,lty=2)
legend(1.3,0.8,lty=c(1,2),c("Kaplan-Meier","Log-normal padrão"),cex=0.5,bty="n",col=c(2,1))
##Gráficos de resíduos
help("predict")
## starting httpd help server ... done
sr<-modelofinal
linFit<-predict(sr, type="lp")
sderr <-(log(tempos)-linFit)/sr$scale
plot(sderr, main="vetor de parâmetros", xlab="indice")
res.ldcase=resid(modelofinal, type="ldcase")
res.ldresp=resid(modelofinal, type="ldresp")
res.ldshape=resid(modelofinal, type="ldshape")
par(mfrow=c(1,3))
plot(res.ldcase, main="vetor de parâmetros", xlab="indice")
plot(res.ldresp, main="valores Preditos", xlab="indice")
plot(res.ldshape, main="parâmetros de forma", xlab="indice")
ei<- -log(1-pnorm(res)) # residuos de Cox-Snell
ekm1<-survfit(Surv(ei,cens)~1); ekm1
## Call: survfit(formula = Surv(ei, cens) ~ 1)
##
## n events median 0.95LCL 0.95UCL
## 2660.000 339.000 0.544 0.476 NA
t<-ekm1$time
st<-ekm1$surv
sexp<-exp(-t)
par(mfrow=c(1,2))
plot(st,sexp,xlab="S(ei): Kaplan-Meier",ylab="S(ei): Exponencial padrão",pch=16,col=4)
plot(ekm1,conf.int=F,mark.time=F, xlab="Residuos de Cox-Snell", ylab="Sobrevivencia estimada",col=2)
lines(t,sexp,lty=4)
legend(1.0,0.8,lty=c(1,4),c("Kaplan-Meier","Exponencial padrão"),cex=0.5,bty="n",col=c(2,1))
####os resíduos de Cox-Snell deveriam seguir a distribuição exponencial padrão ####para que o modelo de regressão log-normal possa ser considerado adequado ####A partir dos gráficos apresentados a seguir pode-se observar, que a análise ####desses resíduos encontram-se bem ajustados.
CoxSnellResidual <- function (standRes, weight=1, dist){
standRes <- standRes[rep(seq_len(length(standRes)), weight)]
if (dist=="lognormal") {csr <- -log(1-pnorm(standRes))}
else if (dist=="weibull") {csr <- -log(exp(-exp(standRes)))}
}
cxsn <- CoxSnellResidual(standRes=sderr, dist="lognormal")
MartingaleResidual <- function (CoxSnellResid, Status, weight=1) {
delta <- Status[rep(seq_len(length(Status)), weight)]
martingale <- delta-CoxSnellResid
data.frame(Martingale=martingale, Status=delta)
}
mgale <- MartingaleResidual(CoxSnellResid=cxsn, Status=cens)
max(mgale$Martingale)
## [1] 1
sum(mgale$Martingale)
## [1] 10.16064
plotMartingale <- function (covariate, martingaleResidual,
nameCovariate="covariate", weight=1) {
cov <- covariate[rep(seq_len(length(covariate)), weight)]
plot(cov, martingaleResidual$Martingale, pch=martingaleResidual$Status,
xlab=nameCovariate, ylab="Martingale Residual")
abline(h=0, lty=2, col="gray40")
lines(lowess(cov, martingaleResidual$Martingale, iter=0), col="blue")
legend("bottomleft", pch=c(1,0), legend=c("event","censored"))
}
plotMartingale(covariate=Price, nameCovariate="Preço", martingaleResidual=mgale)
plotMartingale(covariate=N_Inquires, nameCovariate="Conversas", martingaleResidual=mgale)
plotMartingale(covariate=N_Photos, nameCovariate="Fotos", martingaleResidual=mgale)
plotMartingale(covariate=Distance_travelled, nameCovariate="Distância", martingaleResidual=mgale)
fit <- coxph(Surv(Publish_period,is_sold) ~ idadist +idafotos+idainqui+idapreco+Color+Country_Sold, data = dados, method="breslow")
## Warning in fitter(X, Y, strats, offset, init, control,
## weights = weights, : Loglik converged before variable
## 5,6,8,9,10,11,12,14,15,16,17,18,20,26,27,30,32,37,38,40,41,42,43,44 ;
## coefficient may be infinite.
summary(fit)
## Call:
## coxph(formula = Surv(Publish_period, is_sold) ~ idadist + idafotos +
## idainqui + idapreco + Color + Country_Sold, data = dados,
## method = "breslow")
##
## n= 2658, number of events= 339
## (2 observations deleted due to missingness)
##
## coef exp(coef) se(coef)
## idadist2 -6.773e-01 5.080e-01 1.184e-01
## idafotos2 -7.112e-01 4.911e-01 1.180e-01
## idainqui2 -1.789e+00 1.671e-01 1.397e-01
## idapreco2 -1.803e+00 1.647e-01 2.148e-01
## ColorBlack 1.544e+01 5.083e+06 4.989e+03
## ColorBlue 1.569e+01 6.529e+06 4.989e+03
## ColorBrown 1.750e+00 5.757e+00 4.180e+04
## ColorGray 1.562e+01 6.088e+06 4.989e+03
## ColorGreen 1.533e+01 4.554e+06 4.989e+03
## ColorMaroon 1.648e+01 1.439e+07 4.989e+03
## ColorPearl 1.559e+01 5.874e+06 4.989e+03
## ColorPink 1.459e+01 2.164e+06 4.989e+03
## ColorPurple -9.624e-01 3.820e-01 1.311e+04
## ColorRed 1.530e+01 4.431e+06 4.989e+03
## ColorSilver 1.572e+01 6.721e+06 4.989e+03
## ColorWhite 1.565e+01 6.289e+06 4.989e+03
## ColorYellow 1.433e+01 1.681e+06 4.989e+03
## Country_SoldAruba -1.618e+01 9.417e-08 1.984e+03
## Country_SoldBahamas -4.634e-01 6.291e-01 1.132e+00
## Country_SoldBotswana -1.574e+01 1.464e-07 2.655e+03
## Country_SoldBrunei -3.670e-01 6.928e-01 8.871e-01
## Country_SoldBurundi 1.297e+00 3.659e+00 1.130e+00
## Country_SoldCambodia -5.152e-01 5.974e-01 5.270e-01
## Country_SoldCayman Islands 7.195e-01 2.053e+00 1.144e+00
## Country_SoldChile -3.337e-02 9.672e-01 6.038e-01
## Country_SoldCommonwealth Of Dominica -1.690e+01 4.585e-08 1.077e+04
## Country_SoldD.R.Congo -1.632e+01 8.147e-08 2.638e+03
## Country_SoldGuatemala -2.740e-01 7.604e-01 8.716e-01
## Country_SoldIndonesia 2.950e-01 1.343e+00 6.154e-01
## Country_SoldKazakhstan -1.761e+01 2.246e-08 4.150e+04
## Country_SoldLaos -1.141e+00 3.196e-01 5.110e-01
## Country_SoldLiberia -1.550e+01 1.849e-07 6.288e+03
## Country_SoldMalawi -5.716e-02 9.444e-01 6.801e-01
## Country_SoldMalaysia -7.151e-01 4.891e-01 5.943e-01
## Country_SoldMicronesia -1.230e+00 2.924e-01 8.741e-01
## Country_SoldMyanmar 4.555e-02 1.047e+00 8.931e-01
## Country_SoldNew Zealand -1.517e+01 2.585e-07 9.941e+03
## Country_SoldNigeria -1.513e+01 2.694e-07 9.057e+03
## Country_SoldPhilippine -3.022e-01 7.392e-01 5.155e-01
## Country_SoldRussian Federation -1.590e+01 1.248e-07 6.435e+03
## Country_SoldSamoa -1.473e+01 4.011e-07 3.676e+03
## Country_SoldSt.Maarten -1.690e+01 4.558e-08 6.970e+03
## Country_SoldThailand -1.663e+01 5.968e-08 4.312e+03
## Country_SoldTurks And Caicos Islands -1.617e+01 9.468e-08 2.852e+03
## Country_SoldUganda 8.406e-01 2.318e+00 1.124e+00
## Country_SoldVietnam -4.241e-01 6.543e-01 5.270e-01
## z Pr(>|z|)
## idadist2 -5.722 1.05e-08 ***
## idafotos2 -6.029 1.65e-09 ***
## idainqui2 -12.808 < 2e-16 ***
## idapreco2 -8.398 < 2e-16 ***
## ColorBlack 0.003 0.9975
## ColorBlue 0.003 0.9975
## ColorBrown 0.000 1.0000
## ColorGray 0.003 0.9975
## ColorGreen 0.003 0.9975
## ColorMaroon 0.003 0.9974
## ColorPearl 0.003 0.9975
## ColorPink 0.003 0.9977
## ColorPurple 0.000 0.9999
## ColorRed 0.003 0.9976
## ColorSilver 0.003 0.9975
## ColorWhite 0.003 0.9975
## ColorYellow 0.003 0.9977
## Country_SoldAruba -0.008 0.9935
## Country_SoldBahamas -0.409 0.6822
## Country_SoldBotswana -0.006 0.9953
## Country_SoldBrunei -0.414 0.6791
## Country_SoldBurundi 1.148 0.2511
## Country_SoldCambodia -0.978 0.3282
## Country_SoldCayman Islands 0.629 0.5294
## Country_SoldChile -0.055 0.9559
## Country_SoldCommonwealth Of Dominica -0.002 0.9987
## Country_SoldD.R.Congo -0.006 0.9951
## Country_SoldGuatemala -0.314 0.7533
## Country_SoldIndonesia 0.479 0.6316
## Country_SoldKazakhstan 0.000 0.9997
## Country_SoldLaos -2.233 0.0256 *
## Country_SoldLiberia -0.002 0.9980
## Country_SoldMalawi -0.084 0.9330
## Country_SoldMalaysia -1.203 0.2289
## Country_SoldMicronesia -1.407 0.1595
## Country_SoldMyanmar 0.051 0.9593
## Country_SoldNew Zealand -0.002 0.9988
## Country_SoldNigeria -0.002 0.9987
## Country_SoldPhilippine -0.586 0.5577
## Country_SoldRussian Federation -0.002 0.9980
## Country_SoldSamoa -0.004 0.9968
## Country_SoldSt.Maarten -0.002 0.9981
## Country_SoldThailand -0.004 0.9969
## Country_SoldTurks And Caicos Islands -0.006 0.9955
## Country_SoldUganda 0.748 0.4544
## Country_SoldVietnam -0.805 0.4209
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95
## idadist2 5.080e-01 1.969e+00 0.40280
## idafotos2 4.911e-01 2.036e+00 0.38969
## idainqui2 1.671e-01 5.984e+00 0.12708
## idapreco2 1.647e-01 6.070e+00 0.10814
## ColorBlack 5.083e+06 1.967e-07 0.00000
## ColorBlue 6.529e+06 1.532e-07 0.00000
## ColorBrown 5.757e+00 1.737e-01 0.00000
## ColorGray 6.088e+06 1.643e-07 0.00000
## ColorGreen 4.554e+06 2.196e-07 0.00000
## ColorMaroon 1.439e+07 6.949e-08 0.00000
## ColorPearl 5.874e+06 1.702e-07 0.00000
## ColorPink 2.164e+06 4.621e-07 0.00000
## ColorPurple 3.820e-01 2.618e+00 0.00000
## ColorRed 4.431e+06 2.257e-07 0.00000
## ColorSilver 6.721e+06 1.488e-07 0.00000
## ColorWhite 6.289e+06 1.590e-07 0.00000
## ColorYellow 1.681e+06 5.948e-07 0.00000
## Country_SoldAruba 9.417e-08 1.062e+07 0.00000
## Country_SoldBahamas 6.291e-01 1.589e+00 0.06846
## Country_SoldBotswana 1.464e-07 6.832e+06 0.00000
## Country_SoldBrunei 6.928e-01 1.443e+00 0.12177
## Country_SoldBurundi 3.659e+00 2.733e-01 0.39936
## Country_SoldCambodia 5.974e-01 1.674e+00 0.21265
## Country_SoldCayman Islands 2.053e+00 4.870e-01 0.21811
## Country_SoldChile 9.672e-01 1.034e+00 0.29620
## Country_SoldCommonwealth Of Dominica 4.585e-08 2.181e+07 0.00000
## Country_SoldD.R.Congo 8.147e-08 1.227e+07 0.00000
## Country_SoldGuatemala 7.604e-01 1.315e+00 0.13777
## Country_SoldIndonesia 1.343e+00 7.445e-01 0.40209
## Country_SoldKazakhstan 2.246e-08 4.452e+07 0.00000
## Country_SoldLaos 3.196e-01 3.129e+00 0.11739
## Country_SoldLiberia 1.849e-07 5.408e+06 0.00000
## Country_SoldMalawi 9.444e-01 1.059e+00 0.24905
## Country_SoldMalaysia 4.891e-01 2.044e+00 0.15260
## Country_SoldMicronesia 2.924e-01 3.420e+00 0.05271
## Country_SoldMyanmar 1.047e+00 9.555e-01 0.18178
## Country_SoldNew Zealand 2.585e-07 3.868e+06 0.00000
## Country_SoldNigeria 2.693e-07 3.713e+06 0.00000
## Country_SoldPhilippine 7.392e-01 1.353e+00 0.26910
## Country_SoldRussian Federation 1.248e-07 8.010e+06 0.00000
## Country_SoldSamoa 4.011e-07 2.493e+06 0.00000
## Country_SoldSt.Maarten 4.558e-08 2.194e+07 0.00000
## Country_SoldThailand 5.968e-08 1.676e+07 0.00000
## Country_SoldTurks And Caicos Islands 9.468e-08 1.056e+07 0.00000
## Country_SoldUganda 2.318e+00 4.315e-01 0.25627
## Country_SoldVietnam 6.543e-01 1.528e+00 0.23294
## upper .95
## idadist2 0.6406
## idafotos2 0.6188
## idainqui2 0.2197
## idapreco2 0.2509
## ColorBlack Inf
## ColorBlue Inf
## ColorBrown Inf
## ColorGray Inf
## ColorGreen Inf
## ColorMaroon Inf
## ColorPearl Inf
## ColorPink Inf
## ColorPurple Inf
## ColorRed Inf
## ColorSilver Inf
## ColorWhite Inf
## ColorYellow Inf
## Country_SoldAruba Inf
## Country_SoldBahamas 5.7819
## Country_SoldBotswana Inf
## Country_SoldBrunei 3.9420
## Country_SoldBurundi 33.5223
## Country_SoldCambodia 1.6780
## Country_SoldCayman Islands 19.3319
## Country_SoldChile 3.1581
## Country_SoldCommonwealth Of Dominica Inf
## Country_SoldD.R.Congo Inf
## Country_SoldGuatemala 4.1966
## Country_SoldIndonesia 4.4869
## Country_SoldKazakhstan Inf
## Country_SoldLaos 0.8699
## Country_SoldLiberia Inf
## Country_SoldMalawi 3.5815
## Country_SoldMalaysia 1.5678
## Country_SoldMicronesia 1.6219
## Country_SoldMyanmar 6.0258
## Country_SoldNew Zealand Inf
## Country_SoldNigeria Inf
## Country_SoldPhilippine 2.0303
## Country_SoldRussian Federation Inf
## Country_SoldSamoa Inf
## Country_SoldSt.Maarten Inf
## Country_SoldThailand Inf
## Country_SoldTurks And Caicos Islands Inf
## Country_SoldUganda 20.9614
## Country_SoldVietnam 1.8381
##
## Concordance= 0.799 (se = 0.012 )
## Likelihood ratio test= 396.4 on 46 df, p=<2e-16
## Wald test = 351.6 on 46 df, p=<2e-16
## Score (logrank) test = 428.6 on 46 df, p=<2e-16
fit$loglik
## [1] -2501.510 -2303.283
#nem a variável cor nem a país vendido foi siguinificativa.
fit2<- coxph(Surv(Publish_period,is_sold) ~ idadist +idafotos+idainqui+idapreco, data = dados, method="breslow")
summary(fit2)
## Call:
## coxph(formula = Surv(Publish_period, is_sold) ~ idadist + idafotos +
## idainqui + idapreco, data = dados, method = "breslow")
##
## n= 2658, number of events= 339
## (2 observations deleted due to missingness)
##
## coef exp(coef) se(coef) z Pr(>|z|)
## idadist2 -0.6056 0.5457 0.1138 -5.323 1.02e-07 ***
## idafotos2 -0.7922 0.4528 0.1149 -6.897 5.32e-12 ***
## idainqui2 -1.7458 0.1745 0.1333 -13.099 < 2e-16 ***
## idapreco2 -1.6964 0.1833 0.1905 -8.904 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## idadist2 0.5457 1.832 0.4366 0.6821
## idafotos2 0.4528 2.208 0.3616 0.5672
## idainqui2 0.1745 5.730 0.1344 0.2266
## idapreco2 0.1833 5.454 0.1262 0.2663
##
## Concordance= 0.759 (se = 0.012 )
## Likelihood ratio test= 299.8 on 4 df, p=<2e-16
## Wald test = 277.6 on 4 df, p=<2e-16
## Score (logrank) test = 310.1 on 4 df, p=<2e-16
fit2$loglik
## [1] -2501.510 -2351.592
#as quartro variáveis foram siguinificativas
fit4<- coxph(Surv(Publish_period,is_sold) ~ idadist +idafotos+idainqui+idapreco+ (idapreco*idadist)+(idainqui*idadist), data = dados, method="breslow")
summary(fit4)
## Call:
## coxph(formula = Surv(Publish_period, is_sold) ~ idadist + idafotos +
## idainqui + idapreco + (idapreco * idadist) + (idainqui *
## idadist), data = dados, method = "breslow")
##
## n= 2658, number of events= 339
## (2 observations deleted due to missingness)
##
## coef exp(coef) se(coef) z Pr(>|z|)
## idadist2 -0.54371 0.58059 0.37933 -1.433 0.1518
## idafotos2 -0.78762 0.45493 0.11485 -6.858 7.00e-12 ***
## idainqui2 -1.54395 0.21354 0.16447 -9.387 < 2e-16 ***
## idapreco2 -1.76077 0.17191 0.30508 -5.772 7.85e-09 ***
## idadist2:idapreco2 0.06312 1.06515 0.38502 0.164 0.8698
## idadist2:idainqui2 -0.53377 0.58639 0.27602 -1.934 0.0531 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## idadist2 0.5806 1.7224 0.27605 1.2211
## idafotos2 0.4549 2.1982 0.36323 0.5698
## idainqui2 0.2135 4.6831 0.15469 0.2948
## idapreco2 0.1719 5.8169 0.09454 0.3126
## idadist2:idapreco2 1.0652 0.9388 0.50082 2.2654
## idadist2:idainqui2 0.5864 1.7054 0.34138 1.0072
##
## Concordance= 0.763 (se = 0.011 )
## Likelihood ratio test= 303.9 on 6 df, p=<2e-16
## Wald test = 274 on 6 df, p=<2e-16
## Score (logrank) test = 320.7 on 6 df, p=<2e-16
fit4$loglik
## [1] -2501.510 -2349.533
#as interações não foram siguinificativas
modelocox<- fit2
summary(modelocox)
## Call:
## coxph(formula = Surv(Publish_period, is_sold) ~ idadist + idafotos +
## idainqui + idapreco, data = dados, method = "breslow")
##
## n= 2658, number of events= 339
## (2 observations deleted due to missingness)
##
## coef exp(coef) se(coef) z Pr(>|z|)
## idadist2 -0.6056 0.5457 0.1138 -5.323 1.02e-07 ***
## idafotos2 -0.7922 0.4528 0.1149 -6.897 5.32e-12 ***
## idainqui2 -1.7458 0.1745 0.1333 -13.099 < 2e-16 ***
## idapreco2 -1.6964 0.1833 0.1905 -8.904 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## exp(coef) exp(-coef) lower .95 upper .95
## idadist2 0.5457 1.832 0.4366 0.6821
## idafotos2 0.4528 2.208 0.3616 0.5672
## idainqui2 0.1745 5.730 0.1344 0.2266
## idapreco2 0.1833 5.454 0.1262 0.2663
##
## Concordance= 0.759 (se = 0.012 )
## Likelihood ratio test= 299.8 on 4 df, p=<2e-16
## Wald test = 277.6 on 4 df, p=<2e-16
## Score (logrank) test = 310.1 on 4 df, p=<2e-16
zph <- cox.zph(fit2)
zph
## rho chisq p
## idadist2 -0.0632 1.38 2.41e-01
## idafotos2 -0.1801 11.86 5.73e-04
## idainqui2 0.2119 13.95 1.87e-04
## idapreco2 -0.0957 3.13 7.67e-02
## GLOBAL NA 38.88 7.37e-08
O nenhuma das variáveis rejeita a hipotese nula de proporcionalidade.
residuals(fit2,type="schoenfeld")
## idadist2 idafotos2 idainqui2 idapreco2
## 0 -0.3892666 -0.3527470 -0.1886202 0.12528840
## 0 0.6107334 0.6472530 -0.1886202 -0.87471160
## 0 0.6107334 -0.3527470 -0.1886202 0.12528840
## 0 -0.3892666 -0.3527470 -0.1886202 0.12528840
## 0 -0.3892666 0.6472530 -0.1886202 0.12528840
## 0 -0.3892666 0.6472530 -0.1886202 0.12528840
## 0 -0.3892666 0.6472530 -0.1886202 0.12528840
## 0 0.6107334 -0.3527470 -0.1886202 0.12528840
## 0 0.6107334 0.6472530 -0.1886202 0.12528840
## 0 0.6107334 0.6472530 -0.1886202 0.12528840
## 1 -0.3965849 -0.3534115 -0.1891188 0.12051452
## 1 -0.3965849 -0.3534115 -0.1891188 0.12051452
## 1 0.6034151 -0.3534115 -0.1891188 0.12051452
## 1 -0.3965849 0.6465885 -0.1891188 0.12051452
## 1 -0.3965849 -0.3534115 -0.1891188 0.12051452
## 1 0.6034151 -0.3534115 -0.1891188 0.12051452
## 1 0.6034151 -0.3534115 -0.1891188 0.12051452
## 1 -0.3965849 0.6465885 -0.1891188 0.12051452
## 1 0.6034151 -0.3534115 -0.1891188 0.12051452
## 1 0.6034151 0.6465885 -0.1891188 0.12051452
## 1 -0.3965849 -0.3534115 -0.1891188 0.12051452
## 1 -0.3965849 0.6465885 -0.1891188 0.12051452
## 1 0.6034151 0.6465885 -0.1891188 0.12051452
## 1 -0.3965849 -0.3534115 -0.1891188 0.12051452
## 1 0.6034151 -0.3534115 -0.1891188 0.12051452
## 2 -0.3912785 -0.3559842 -0.1934033 0.11991936
## 2 -0.3912785 -0.3559842 -0.1934033 0.11991936
## 2 -0.3912785 0.6440158 -0.1934033 0.11991936
## 2 0.6087215 -0.3559842 -0.1934033 0.11991936
## 2 0.6087215 -0.3559842 -0.1934033 0.11991936
## 2 -0.3912785 -0.3559842 -0.1934033 0.11991936
## 2 0.6087215 -0.3559842 -0.1934033 0.11991936
## 2 -0.3912785 0.6440158 -0.1934033 0.11991936
## 2 -0.3912785 0.6440158 -0.1934033 0.11991936
## 2 0.6087215 0.6440158 -0.1934033 0.11991936
## 2 0.6087215 0.6440158 -0.1934033 0.11991936
## 2 0.6087215 0.6440158 -0.1934033 0.11991936
## 2 0.6087215 0.6440158 -0.1934033 0.11991936
## 2 0.6087215 0.6440158 -0.1934033 0.11991936
## 2 -0.3912785 -0.3559842 -0.1934033 0.11991936
## 2 -0.3912785 -0.3559842 -0.1934033 0.11991936
## 2 -0.3912785 -0.3559842 -0.1934033 0.11991936
## 2 -0.3912785 0.6440158 -0.1934033 0.11991936
## 2 -0.3912785 0.6440158 -0.1934033 0.11991936
## 2 -0.3912785 0.6440158 -0.1934033 0.11991936
## 3 -0.3931935 -0.3564374 0.8059835 0.12298227
## 3 0.6068065 -0.3564374 -0.1940165 -0.87701773
## 3 -0.3931935 -0.3564374 -0.1940165 0.12298227
## 3 -0.3931935 -0.3564374 -0.1940165 0.12298227
## 3 -0.3931935 -0.3564374 -0.1940165 -0.87701773
## 3 -0.3931935 -0.3564374 0.8059835 -0.87701773
## 3 -0.3931935 -0.3564374 -0.1940165 0.12298227
## 3 -0.3931935 0.6435626 0.8059835 -0.87701773
## 3 -0.3931935 -0.3564374 0.8059835 0.12298227
## 3 -0.3931935 0.6435626 0.8059835 0.12298227
## 3 -0.3931935 -0.3564374 -0.1940165 0.12298227
## 3 0.6068065 -0.3564374 -0.1940165 -0.87701773
## 3 0.6068065 0.6435626 -0.1940165 -0.87701773
## 3 0.6068065 -0.3564374 -0.1940165 0.12298227
## 3 -0.3931935 -0.3564374 -0.1940165 0.12298227
## 3 0.6068065 -0.3564374 0.8059835 0.12298227
## 3 -0.3931935 0.6435626 -0.1940165 0.12298227
## 3 -0.3931935 0.6435626 -0.1940165 0.12298227
## 3 0.6068065 -0.3564374 -0.1940165 -0.87701773
## 3 -0.3931935 0.6435626 -0.1940165 0.12298227
## 3 0.6068065 -0.3564374 -0.1940165 0.12298227
## 3 -0.3931935 0.6435626 -0.1940165 0.12298227
## 3 0.6068065 0.6435626 -0.1940165 0.12298227
## 3 0.6068065 0.6435626 -0.1940165 0.12298227
## 3 -0.3931935 0.6435626 -0.1940165 0.12298227
## 3 0.6068065 0.6435626 -0.1940165 0.12298227
## 3 0.6068065 0.6435626 -0.1940165 0.12298227
## 3 -0.3931935 0.6435626 0.8059835 0.12298227
## 3 -0.3931935 0.6435626 -0.1940165 0.12298227
## 3 0.6068065 0.6435626 -0.1940165 0.12298227
## 3 -0.3931935 0.6435626 -0.1940165 0.12298227
## 3 0.6068065 0.6435626 -0.1940165 0.12298227
## 3 -0.3931935 -0.3564374 -0.1940165 0.12298227
## 3 -0.3931935 0.6435626 -0.1940165 0.12298227
## 3 -0.3931935 0.6435626 -0.1940165 0.12298227
## 3 0.6068065 0.6435626 -0.1940165 0.12298227
## 4 -0.3847553 -0.3647792 -0.2010549 0.10295977
## 4 0.6152447 -0.3647792 -0.2010549 0.10295977
## 4 0.6152447 -0.3647792 -0.2010549 0.10295977
## 4 0.6152447 -0.3647792 -0.2010549 0.10295977
## 4 0.6152447 -0.3647792 -0.2010549 0.10295977
## 4 -0.3847553 0.6352208 -0.2010549 0.10295977
## 4 0.6152447 -0.3647792 -0.2010549 0.10295977
## 4 0.6152447 0.6352208 -0.2010549 0.10295977
## 4 -0.3847553 -0.3647792 -0.2010549 0.10295977
## 4 0.6152447 -0.3647792 -0.2010549 0.10295977
## 4 -0.3847553 -0.3647792 -0.2010549 0.10295977
## 4 -0.3847553 0.6352208 -0.2010549 0.10295977
## 4 -0.3847553 0.6352208 0.7989451 0.10295977
## 4 0.6152447 -0.3647792 -0.2010549 0.10295977
## 4 -0.3847553 0.6352208 -0.2010549 0.10295977
## 4 0.6152447 -0.3647792 -0.2010549 0.10295977
## 4 -0.3847553 -0.3647792 -0.2010549 0.10295977
## 4 0.6152447 -0.3647792 -0.2010549 0.10295977
## 4 -0.3847553 0.6352208 -0.2010549 0.10295977
## 4 -0.3847553 -0.3647792 -0.2010549 0.10295977
## 5 -0.3829539 -0.3652998 -0.2043357 0.10275778
## 5 -0.3829539 -0.3652998 -0.2043357 0.10275778
## 5 0.6170461 0.6347002 -0.2043357 0.10275778
## 5 -0.3829539 -0.3652998 0.7956643 -0.89724222
## 5 -0.3829539 -0.3652998 -0.2043357 0.10275778
## 5 0.6170461 0.6347002 -0.2043357 -0.89724222
## 5 -0.3829539 0.6347002 0.7956643 0.10275778
## 5 -0.3829539 -0.3652998 -0.2043357 0.10275778
## 5 0.6170461 -0.3652998 -0.2043357 0.10275778
## 5 -0.3829539 0.6347002 -0.2043357 0.10275778
## 5 0.6170461 -0.3652998 -0.2043357 0.10275778
## 5 -0.3829539 0.6347002 -0.2043357 0.10275778
## 5 -0.3829539 0.6347002 -0.2043357 0.10275778
## 5 -0.3829539 -0.3652998 -0.2043357 0.10275778
## 5 -0.3829539 0.6347002 0.7956643 0.10275778
## 5 -0.3829539 -0.3652998 -0.2043357 0.10275778
## 5 -0.3829539 0.6347002 -0.2043357 0.10275778
## 5 -0.3829539 -0.3652998 -0.2043357 0.10275778
## 5 -0.3829539 -0.3652998 -0.2043357 0.10275778
## 5 0.6170461 0.6347002 -0.2043357 0.10275778
## 5 0.6170461 -0.3652998 -0.2043357 0.10275778
## 5 0.6170461 0.6347002 -0.2043357 0.10275778
## 6 -0.3805964 -0.3672717 -0.2124410 -0.90022734
## 6 -0.3805964 -0.3672717 0.7875590 -0.90022734
## 6 0.6194036 -0.3672717 0.7875590 -0.90022734
## 6 -0.3805964 -0.3672717 -0.2124410 0.09977266
## 6 -0.3805964 -0.3672717 -0.2124410 0.09977266
## 6 0.6194036 -0.3672717 0.7875590 0.09977266
## 6 0.6194036 0.6327283 0.7875590 0.09977266
## 6 -0.3805964 -0.3672717 -0.2124410 0.09977266
## 6 -0.3805964 -0.3672717 -0.2124410 0.09977266
## 6 -0.3805964 -0.3672717 0.7875590 0.09977266
## 6 -0.3805964 -0.3672717 -0.2124410 0.09977266
## 6 -0.3805964 0.6327283 -0.2124410 0.09977266
## 6 -0.3805964 -0.3672717 0.7875590 0.09977266
## 6 0.6194036 -0.3672717 -0.2124410 0.09977266
## 6 -0.3805964 0.6327283 -0.2124410 0.09977266
## 6 -0.3805964 -0.3672717 -0.2124410 0.09977266
## 6 -0.3805964 -0.3672717 -0.2124410 0.09977266
## 6 -0.3805964 -0.3672717 -0.2124410 0.09977266
## 6 0.6194036 -0.3672717 -0.2124410 0.09977266
## 6 -0.3805964 -0.3672717 -0.2124410 0.09977266
## 6 -0.3805964 0.6327283 0.7875590 0.09977266
## 6 0.6194036 -0.3672717 -0.2124410 0.09977266
## 6 -0.3805964 0.6327283 -0.2124410 0.09977266
## 6 -0.3805964 -0.3672717 0.7875590 0.09977266
## 6 -0.3805964 -0.3672717 0.7875590 0.09977266
## 6 -0.3805964 0.6327283 -0.2124410 0.09977266
## 6 -0.3805964 -0.3672717 -0.2124410 0.09977266
## 6 0.6194036 0.6327283 0.7875590 -0.90022734
## 6 0.6194036 -0.3672717 -0.2124410 0.09977266
## 6 -0.3805964 -0.3672717 -0.2124410 0.09977266
## 6 0.6194036 0.6327283 -0.2124410 0.09977266
## 6 -0.3805964 -0.3672717 -0.2124410 0.09977266
## 6 -0.3805964 0.6327283 -0.2124410 0.09977266
## 6 -0.3805964 0.6327283 -0.2124410 0.09977266
## 6 -0.3805964 -0.3672717 -0.2124410 0.09977266
## 6 0.6194036 0.6327283 -0.2124410 0.09977266
## 6 -0.3805964 -0.3672717 -0.2124410 0.09977266
## 6 -0.3805964 -0.3672717 0.7875590 0.09977266
## 6 0.6194036 0.6327283 -0.2124410 -0.90022734
## 6 0.6194036 0.6327283 -0.2124410 0.09977266
## 7 0.6083233 -0.3713763 0.7807188 0.09075752
## 7 0.6083233 -0.3713763 -0.2192812 0.09075752
## 7 0.6083233 -0.3713763 0.7807188 0.09075752
## 7 0.6083233 -0.3713763 0.7807188 -0.90924248
## 7 -0.3916767 -0.3713763 -0.2192812 0.09075752
## 7 -0.3916767 -0.3713763 -0.2192812 0.09075752
## 7 -0.3916767 -0.3713763 -0.2192812 0.09075752
## 7 -0.3916767 -0.3713763 0.7807188 0.09075752
## 7 0.6083233 -0.3713763 -0.2192812 0.09075752
## 7 -0.3916767 -0.3713763 0.7807188 0.09075752
## 7 0.6083233 -0.3713763 0.7807188 -0.90924248
## 7 -0.3916767 -0.3713763 -0.2192812 0.09075752
## 7 -0.3916767 -0.3713763 -0.2192812 0.09075752
## 7 -0.3916767 -0.3713763 0.7807188 0.09075752
## 7 0.6083233 -0.3713763 -0.2192812 0.09075752
## 7 -0.3916767 -0.3713763 -0.2192812 0.09075752
## 7 -0.3916767 -0.3713763 -0.2192812 0.09075752
## 7 -0.3916767 -0.3713763 -0.2192812 0.09075752
## 7 0.6083233 0.6286237 -0.2192812 0.09075752
## 7 0.6083233 0.6286237 -0.2192812 0.09075752
## 7 0.6083233 -0.3713763 -0.2192812 0.09075752
## 7 0.6083233 0.6286237 -0.2192812 0.09075752
## 7 -0.3916767 0.6286237 0.7807188 0.09075752
## 7 -0.3916767 -0.3713763 0.7807188 0.09075752
## 7 0.6083233 -0.3713763 -0.2192812 0.09075752
## 7 0.6083233 -0.3713763 -0.2192812 0.09075752
## 7 -0.3916767 -0.3713763 -0.2192812 0.09075752
## 7 0.6083233 0.6286237 0.7807188 -0.90924248
## 7 -0.3916767 0.6286237 -0.2192812 0.09075752
## 7 0.6083233 -0.3713763 0.7807188 0.09075752
## 7 -0.3916767 0.6286237 -0.2192812 0.09075752
## 7 -0.3916767 -0.3713763 -0.2192812 0.09075752
## 7 0.6083233 0.6286237 -0.2192812 0.09075752
## 7 -0.3916767 -0.3713763 -0.2192812 0.09075752
## 7 0.6083233 -0.3713763 -0.2192812 0.09075752
## 7 0.6083233 0.6286237 -0.2192812 0.09075752
## 7 0.6083233 0.6286237 -0.2192812 0.09075752
## 7 -0.3916767 0.6286237 0.7807188 0.09075752
## 7 0.6083233 -0.3713763 -0.2192812 0.09075752
## 7 -0.3916767 -0.3713763 -0.2192812 0.09075752
## 7 -0.3916767 0.6286237 -0.2192812 0.09075752
## 7 -0.3916767 0.6286237 -0.2192812 0.09075752
## 7 -0.3916767 -0.3713763 -0.2192812 0.09075752
## 7 0.6083233 -0.3713763 -0.2192812 -0.90924248
## 7 0.6083233 -0.3713763 -0.2192812 0.09075752
## 7 0.6083233 -0.3713763 -0.2192812 0.09075752
## 7 -0.3916767 0.6286237 -0.2192812 0.09075752
## 7 0.6083233 0.6286237 -0.2192812 0.09075752
## 7 -0.3916767 0.6286237 -0.2192812 0.09075752
## 7 0.6083233 0.6286237 -0.2192812 0.09075752
## 7 0.6083233 0.6286237 -0.2192812 0.09075752
## 7 0.6083233 0.6286237 -0.2192812 0.09075752
## 7 -0.3916767 0.6286237 -0.2192812 0.09075752
## 7 0.6083233 -0.3713763 -0.2192812 0.09075752
## 7 -0.3916767 0.6286237 -0.2192812 0.09075752
## 7 -0.3916767 0.6286237 -0.2192812 0.09075752
## 8 -0.3956468 -0.3913006 -0.2323516 0.09263074
## 8 -0.3956468 -0.3913006 -0.2323516 0.09263074
## 8 0.6043532 -0.3913006 0.7676484 -0.90736926
## 8 -0.3956468 -0.3913006 0.7676484 0.09263074
## 8 -0.3956468 -0.3913006 -0.2323516 0.09263074
## 8 -0.3956468 -0.3913006 -0.2323516 0.09263074
## 8 -0.3956468 -0.3913006 -0.2323516 0.09263074
## 8 -0.3956468 0.6086994 0.7676484 0.09263074
## 8 -0.3956468 -0.3913006 0.7676484 0.09263074
## 8 0.6043532 -0.3913006 -0.2323516 -0.90736926
## 8 0.6043532 -0.3913006 -0.2323516 0.09263074
## 8 -0.3956468 -0.3913006 -0.2323516 0.09263074
## 8 -0.3956468 -0.3913006 -0.2323516 0.09263074
## 8 -0.3956468 0.6086994 0.7676484 0.09263074
## 8 -0.3956468 -0.3913006 -0.2323516 0.09263074
## 8 0.6043532 -0.3913006 -0.2323516 0.09263074
## 8 -0.3956468 0.6086994 -0.2323516 0.09263074
## 8 0.6043532 0.6086994 -0.2323516 0.09263074
## 8 -0.3956468 0.6086994 -0.2323516 0.09263074
## 8 -0.3956468 0.6086994 -0.2323516 0.09263074
## 8 -0.3956468 0.6086994 -0.2323516 0.09263074
## 8 -0.3956468 0.6086994 -0.2323516 0.09263074
## 8 -0.3956468 -0.3913006 -0.2323516 0.09263074
## 8 -0.3956468 0.6086994 -0.2323516 0.09263074
## 8 -0.3956468 0.6086994 -0.2323516 0.09263074
## 8 -0.3956468 -0.3913006 -0.2323516 0.09263074
## 9 0.6046999 -0.4059295 0.7619610 0.09008937
## 9 -0.3953001 -0.4059295 -0.2380390 0.09008937
## 9 0.6046999 0.5940705 0.7619610 -0.90991063
## 9 -0.3953001 0.5940705 -0.2380390 0.09008937
## 9 -0.3953001 0.5940705 -0.2380390 0.09008937
## 9 0.6046999 0.5940705 -0.2380390 0.09008937
## 9 -0.3953001 -0.4059295 -0.2380390 0.09008937
## 9 0.6046999 -0.4059295 -0.2380390 0.09008937
## 9 -0.3953001 0.5940705 0.7619610 0.09008937
## 9 -0.3953001 0.5940705 -0.2380390 0.09008937
## 9 -0.3953001 -0.4059295 -0.2380390 0.09008937
## 9 -0.3953001 -0.4059295 -0.2380390 0.09008937
## 9 0.6046999 -0.4059295 -0.2380390 0.09008937
## 9 -0.3953001 -0.4059295 -0.2380390 0.09008937
## 9 -0.3953001 0.5940705 0.7619610 0.09008937
## 9 -0.3953001 -0.4059295 -0.2380390 0.09008937
## 10 0.6026547 -0.4186584 -0.2496019 0.08920441
## 10 0.6026547 -0.4186584 -0.2496019 0.08920441
## 10 0.6026547 -0.4186584 -0.2496019 0.08920441
## 10 -0.3973453 0.5813416 -0.2496019 0.08920441
## 10 -0.3973453 -0.4186584 0.7503981 0.08920441
## 10 -0.3973453 0.5813416 0.7503981 0.08920441
## 10 -0.3973453 0.5813416 -0.2496019 0.08920441
## 10 -0.3973453 0.5813416 0.7503981 0.08920441
## 10 -0.3973453 -0.4186584 -0.2496019 0.08920441
## 10 -0.3973453 -0.4186584 -0.2496019 0.08920441
## 10 -0.3973453 0.5813416 -0.2496019 0.08920441
## 10 0.6026547 0.5813416 -0.2496019 0.08920441
## 10 0.6026547 0.5813416 -0.2496019 0.08920441
## 11 0.5972990 -0.4199907 -0.2616726 0.09836059
## 11 -0.4027010 -0.4199907 0.7383274 0.09836059
## 11 -0.4027010 -0.4199907 -0.2616726 0.09836059
## 11 -0.4027010 -0.4199907 -0.2616726 0.09836059
## 11 0.5972990 -0.4199907 -0.2616726 0.09836059
## 11 -0.4027010 0.5800093 0.7383274 0.09836059
## 11 -0.4027010 -0.4199907 -0.2616726 0.09836059
## 11 -0.4027010 -0.4199907 0.7383274 0.09836059
## 12 -0.4038876 -0.4212811 -0.2714164 0.10088318
## 12 0.5961124 -0.4212811 -0.2714164 -0.89911682
## 12 -0.4038876 -0.4212811 -0.2714164 0.10088318
## 12 0.5961124 0.5787189 -0.2714164 0.10088318
## 12 -0.4038876 -0.4212811 0.7285836 0.10088318
## 12 0.5961124 -0.4212811 -0.2714164 0.10088318
## 12 -0.4038876 -0.4212811 -0.2714164 0.10088318
## 12 -0.4038876 -0.4212811 -0.2714164 0.10088318
## 12 -0.4038876 -0.4212811 -0.2714164 0.10088318
## 12 -0.4038876 0.5787189 -0.2714164 0.10088318
## 12 0.5961124 0.5787189 -0.2714164 0.10088318
## 13 -0.3999807 0.5610661 -0.2774269 0.09507803
## 13 -0.3999807 -0.4389339 0.7225731 0.09507803
## 13 -0.3999807 -0.4389339 -0.2774269 0.09507803
## 13 0.6000193 -0.4389339 -0.2774269 0.09507803
## 13 -0.3999807 0.5610661 -0.2774269 0.09507803
## 13 0.6000193 0.5610661 0.7225731 0.09507803
## 14 -0.4048289 -0.4399738 0.7166681 0.09746007
## 14 -0.4048289 -0.4399738 0.7166681 0.09746007
## 14 -0.4048289 -0.4399738 0.7166681 0.09746007
## 14 0.5951711 -0.4399738 -0.2833319 0.09746007
## 14 0.5951711 -0.4399738 0.7166681 -0.90253993
## 14 0.5951711 -0.4399738 0.7166681 0.09746007
## 14 -0.4048289 -0.4399738 -0.2833319 -0.90253993
## 14 -0.4048289 -0.4399738 -0.2833319 0.09746007
## 14 0.5951711 -0.4399738 0.7166681 0.09746007
## 14 0.5951711 -0.4399738 -0.2833319 0.09746007
## 14 -0.4048289 0.5600262 -0.2833319 0.09746007
## 14 -0.4048289 0.5600262 -0.2833319 0.09746007
## 14 -0.4048289 0.5600262 -0.2833319 0.09746007
## 15 0.5881643 -0.4431387 -0.3038056 0.06759631
## 15 -0.4118357 -0.4431387 0.6961944 0.06759631
## 16 -0.4083638 -0.4452688 0.6966977 0.06906963
## 16 -0.4083638 -0.4452688 0.6966977 -0.93093037
## 16 0.5916362 -0.4452688 0.6966977 0.06906963
## 16 0.5916362 -0.4452688 -0.3033023 0.06906963
## 17 0.5910844 -0.4467351 -0.2972368 0.06935768
## 17 0.5910844 0.5532649 0.7027632 -0.93064232
## 18 0.5941598 -0.4444671 0.6875028 0.07279190
## 18 0.5941598 -0.4444671 0.6875028 0.07279190
## 18 0.5941598 -0.4444671 -0.3124972 0.07279190
## 18 -0.4058402 -0.4444671 0.6875028 0.07279190
## 18 -0.4058402 -0.4444671 0.6875028 0.07279190
## 20 -0.4142306 -0.4571741 0.6735318 0.08737412
## 21 -0.4028323 0.5567544 0.6663411 0.09528395
## 21 -0.4028323 -0.4432456 0.6663411 0.09528395
## 21 0.5971677 -0.4432456 -0.3336589 -0.90471605
## 21 -0.4028323 -0.4432456 0.6663411 -0.90471605
## 21 0.5971677 -0.4432456 -0.3336589 0.09528395
## 22 -0.3715030 -0.4580711 0.6481843 -0.93072749
## 22 -0.3715030 -0.4580711 0.6481843 -0.93072749
## 24 -0.3934712 -0.4719849 0.6206549 -0.93748426
## 25 0.6211665 -0.4770270 0.6112426 -0.95255739
## 25 -0.3788335 0.5229730 -0.3887574 0.04744261
## 28 0.6555565 -0.4402508 0.5705433 0.02865658
## 29 0.6262968 -0.4069310 0.5186593 0.03436777
## 38 0.5487997 -0.2953528 0.1347705 -0.85998901
cox.zph(fit2)
## rho chisq p
## idadist2 -0.0632 1.38 2.41e-01
## idafotos2 -0.1801 11.86 5.73e-04
## idainqui2 0.2119 13.95 1.87e-04
## idapreco2 -0.0957 3.13 7.67e-02
## GLOBAL NA 38.88 7.37e-08
plot(cox.zph(fit2))
mresid <- resid(fit2);
plot(mresid)