QUESTION_1
pdf
keyboard_arrow_up
School
University of Toronto *
*We aren’t endorsed by this school
Course
3000F
Subject
Industrial Engineering
Date
Dec 6, 2023
Type
Pages
2
Uploaded by ChefValorHawk21
Question 1
#a
pow.z.test
<-
function
(r,n,alpha,theta,sigma){
n2
<-
n/(r+
1
)
x
<-
qnorm(
1
-alpha/
2
)-abs(theta)/(sigma*sqrt(
1
/(r*n2)+
1
/n2))
pow
<-
1
-pnorm(x)
return(pow)}
#b
plot(
x =
seq(.
1
,
5
,
by=
0.1
),
y =
pow.z.test(seq(.
1
,
5
,
by=
0.1
),
168
,.
05
,
1
,
2
),
type=
"l"
,
xlab=
"Allocation ratio"
,
ylab=
"Power"
,
main=
"Power vs. allocation ratio with total sample size fixed at
\n
n=168 alpha=0.05"
)
#c
total_sample_size
<-
168
power
<-
0.80
alpha
<-
0.05
difference_to_detect
<-
1
standard_deviation
<-
2
# Define the function
pow.z.test
<-
function
(r, n, alpha, theta, sigma){
n2
<-
n / (r +
1
)
x
<-
qnorm(
1
- alpha /
2
) - abs(theta) / (sigma * sqrt(
1
/ (r * n2) +
1
/
n2))
pow
<-
1
- pnorm(x)
return(pow)
}
# Find the value of 'r' using the optimize function
r
<-
optimize(
function
(r) abs(pow.z.test(r, total_sample_size, alpha,
difference_to_detect, standard_deviation) - power),
interval =
c(
0
,
100
))$minimum
# Print the value of 'r'
cat(
"The ratio of patients in the experimental group to the control group (r)
is:"
, r,
"
\n
"
)
## The ratio of patients in the experimental group to the control group (r)
is: 3.019929
#d
To increase power, the statistician should recommend modifying the allocation ratio. The
current allocation ratio of 4:1 between the experimental and control groups may not be the
most efficient distribution of subjects. The power can be increased by expanding the
number of patients in the experimental group. The statistician can perform simulations
with various allocation ratios to determine the optimal one that meets or exceeds the
desired 80% power while keeping the total sample size constant at 168.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help