##############################
### BS 728  LQAS hw2       ###
##############################
source('C:/Users/miche/Desktop/BS728/LQASprograms.R')
##getDecisionRule default is 10% for alpha and beta 

Question 1

#1
result1 <- getDecisionRule(p.u=0.6,p.l=0.3)
result1
## $d
## [1] 9
## 
## $n
## [1] 19
## 
## $alpha
## [1] 0.08847406
## 
## $beta
## [1] 0.08391516
getOCC(n=result1$n,d=result1$d)

#2
result2 <- getDecisionRule(p.u=0.6,p.l=0.4)
result2
## $d
## [1] 21
## 
## $n
## [1] 41
## 
## $alpha
## [1] 0.09651722
## 
## $beta
## [1] 0.09651722
getOCC(n=result2$n,d=result2$d)

#3
result3 <- getDecisionRule(p.u=0.8,p.l=0.6)
result3
## $d
## [1] 26
## 
## $n
## [1] 36
## 
## $alpha
## [1] 0.08891278
## 
## $beta
## [1] 0.09036317
getOCC(n=result3$n,d=result3$d)

#4
result4 <- getDecisionRule(p.u=0.8,p.l=0.6,alpha=0.1,beta=0.05)
result4
## $d
## [1] 33
## 
## $n
## [1] 45
## 
## $alpha
## [1] 0.09945419
## 
## $beta
## [1] 0.04463063
getOCC(n=result4$n,d=result4$d)