options(scipen=999)
options(digits=9)
cat("\014") # clear screen
rm(list=ls(all=TRUE))

g=function(x,p) p*(1-p)^(x-1)
g(6,0.2)
dgeom(6-1,0.2)
dnbinom(6-1,1,0.2)

x=seq(from=0,to=5,by=1)
Px=dgeom(x-1,0.25)
CPx=pgeom(x-1,0.25)
table=data.frame(x,Px,CPx)
table

x=seq(from=1,to=5,by=1)
Px=dnbinom(x-1,1,0.25)
CPx=pnbinom(x-1,1,0.25)
table=data.frame(x,Px,CPx)
table

