Dear all,
Please could you help with gsdesign usermethod?
The manual says that "Your program can be as complicated as you would like; you can even use simulations to compute your results."
How can this be done? It is not clear to me. Below is some code I found in the manual to demonstrate the power command with simulations. But then I am unclear how to then implement this with gsdesign. The simulations are based by defining first the sample size so the power can be computed. However the premise of gsdesign is to specify a power so the sample size for a group sequential design is defined given the looks and alpha.
Can you help me how to implement gsdesign usermethod with simulations as noted in the manual?
Thank you
Andrew
Please could you help with gsdesign usermethod?
The manual says that "Your program can be as complicated as you would like; you can even use simulations to compute your results."
How can this be done? It is not clear to me. Below is some code I found in the manual to demonstrate the power command with simulations. But then I am unclear how to then implement this with gsdesign. The simulations are based by defining first the sample size so the power can be computed. However the premise of gsdesign is to specify a power so the sample size for a group sequential design is defined given the looks and alpha.
Can you help me how to implement gsdesign usermethod with simulations as noted in the manual?
Code:
capture program drop simttest
program simttest, rclass
version 18
syntax, n(integer) /// Sample size
[ alpha(real 0.05) /// Alpha level
m0(real 0) /// Mean under the null
ma(real 1) /// Mean under the alternative
sd(real 1) ] // Standard deviation
drawnorm y, n(`n') means(`ma') sds(`sd') clear
ttest y = `m0'
return scalar reject = (r(p)<`alpha')
end
capture program drop power_cmd_simttest
program power_cmd_simttest, rclass
version 18
// DEFINE THE INPUT PARAMETERS AND THEIR DEFAULT VALUES
syntax, n(integer) /// Sample size
[ alpha(real 0.05) /// Alpha level
m0(real 0) /// Mean under the null
ma(real 1) /// Mean under the alternative
sd(real 1) /// Standard deviation
reps(integer 100)] // Number of repetitions
// GENERATE THE RANDOM DATA AND TEST THE NULL HYPOTHESIS
quietly simulate reject=r(reject), reps(`reps'): ///
simttest, n(`n') m0(`m0') ma(`ma') sd(`sd') alpha(`alpha')
quietly summarize reject
// RETURN RESULTS
return scalar power = r(mean)
return scalar N = `n'
return scalar alpha = `alpha'
return scalar m0 = `m0'
return scalar ma = `ma'
return scalar sd = `sd'
end
power simttest, n(100) m0(70) ma(75) sd(15)
gsdesign simttest, n(100)
Andrew

Comment