R Code- (Part-II)
#Empirical Survival Function
EmpSurFun=(1-(cumsum(x)/sum(x)))
EmpSurFun
#Generating random sample from exp. dist. for obtained Lambda
RandSamp=rexp(length(x),Lambda)
#Estimated Survival Function
EstSurFun=(1-(cumsum(RandSamp)/sum(RandSamp)))
EstSurFun
Output On R Console-(Part-II)
> #Empirical Survival Function
> EmpSurFun=(1-(cumsum(x)/sum(x)))
> EmpSurFun
[1] 0.968988814 0.963192675 0.957839554 0.956215159 0.954996862 0.950529774
[7] 0.944992063 0.934655001 0.918632554 0.891460848 0.869900690 0.837154354
[13] 0.827444900 0.757263632 0.731605567 0.720751652 0.700003692 0.673385757
[19] 0.670579983 0.644368147 0.642669915 0.627828848 0.620666741 0.592645919
[25] 0.580869052 0.563886735 0.562410012 0.513087459 0.500719903 0.451471185
[31] 0.434710378 0.433381327 0.408756968 0.407280245 0.386753793 0.383098904
[37] 0.371875808 0.358031528 0.337098977 0.331967364 0.303171263 0.295676893
[43] 0.279580611 0.278473068 0.264296526 0.259534094 0.259201831 0.251485953
[49] 0.229372023 0.226307823 0.195591981 0.183482852 0.174401004 0.114704471
[55] 0.091150737 0.056558497 0.029423709 0.028020822 0.014545723 0.011149260
[61] 0.008121977 0.000000000
>
>#Generating random sample from exp. dist. for obtained Lambda
> RandSamp=rexp(length(x),Lambda)
>
> #Estimated Survival Function
> EstSurFun=(1-(cumsum(RandSamp)/sum(RandSamp)))
> EstSurFun
[1] 0.9958836847 0.9898595271 0.9561720898 0.9332247427 0.9296837477
[6] 0.9260998591 0.9041657200 0.8911240750 0.8783892748 0.8699581171
[11] 0.8449836190 0.8002355868 0.7978138436 0.7916362753 0.7578671796
[16] 0.7467557932 0.7448121262 0.6612652168 0.6558358106 0.6504815683
[21] 0.6234970438 0.6157943592 0.6100249797 0.6075018423 0.5894325086
[26] 0.5675929444 0.5600044489 0.5440958590 0.5421978622 0.5361511402
[31] 0.5358466889 0.5260765777 0.4684343170 0.4583108311 0.4514342332
[36] 0.4354221137 0.4326665230 0.4000027499 0.3714492975 0.3674126001
[41] 0.3512239676 0.3243834923 0.3214069877 0.3116390768 0.2979975599
[46] 0.2945687680 0.2332472205 0.2120159912 0.1866437425 0.1639607321
[51] 0.1447151586 0.1415385874 0.1397198163 0.1114864165 0.0981152822
[56] 0.0911887110 0.0679361418 0.0412507487 0.0374823271 0.0277813323
[61] 0.0004643265 0.0000000000
Conclusion-
From above obtained output we can observe the empirical as well as the estimated survival functions. It is 1 at beginning and continuously decreases to 0.
Hello! This post couldn’t be written any better! Reading through this post reminds me of my good old room mate! He always kept chatting about this. I will forward this page to him. Pretty sure he will have a good read. Thanks for sharing!
LikeLiked by 1 person