Larasati Dewi_1706014765.docx

  • Uploaded by: Ayy Nanu
  • 0
  • 0
  • October 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Larasati Dewi_1706014765.docx as PDF for free.

More details

  • Words: 63
  • Pages: 4
#nama: larasati dewi #npm: 1706014765

#1 membuat tabel mortalita dari usia 0 sampai 70

tabelm<-function(expr,omega,lo){ age<-0 : omega sx<-eval({x=age;expr}) lx<-lo*sx dx=px=qx <-NULL n<-length(age+1) for(i in 1:n){ dx[i]<-lx[i]-lx[i+1] px[i]<-lx[i+1]/lx[i] qx[i]<-1-(lx[i+1]/lx[i]) } ex<-NULL for(i in 1:n){ ex[n]<-0 ex[n-i]<-px[n-i]+(px[n-i]*ex[n-i+1]) } tabel<-data.frame(age=age,qx=qx,lx=lx,dx=dx,sx=sx,ex=ex) print(tabel,digits=6) } expr<-expression(exp((-0.0001*x)-((0.00025/log10(1.072))*((1.072^x)-1))))

tabelm(expr,omega=70,lo=1000000)

#2 menghitung harapan hidup kontinyu (karena batas usia dalam bentuk interval)

f<-expression(exp(-(0.0001/log(1.07))*((1.07^x)-1)))

kontinyu<-function(f,age,t){ sx<-eval({x=age;f}) sxt<-eval({x=age+t;f}) output<-(sxt)/sx fun<-function(x){output} ending<-integrate(Vectorize(fun),lower=age,upper=age+t)$value ending }

kontinyu(f,age=30,t=12)

Related Documents


More Documents from "Larasati K Sadewi"