Hi,
I'm trying to run some code to perform power calcs. I've taken this from a paper published by a well regarded econ research organisation. When running this, I get a “‘1’ invalid name” error. This relates in some way to the positional arguments. Beyond this I'm stumped.
Below is a cut down version for illustration. This produces exactly the same error I get when using the more involved programme more relevant to my work.
*Simple Binary Dependent Power Calcs
cap prog drop discretepower
program discretepower
syntax anything [,alpha(real .05) beta(real .8) pi(real .5)]
tokenize "‘0’",parse(" ,")
local rho = ‘1’
local m = ‘2’
local p 0 = ‘3’
local impact = ‘4’
local z alpha = invnormal(1-(‘alpha’/2))
local z beta = invnormal(‘beta’)
local deff = (1+‘rho’*(‘m’-1))
local p 1 =‘p 0’+‘impact’
local k =(‘deff’/‘m’)*( (‘p 1’*(1-‘p 1’)/‘pi’)+(‘p 0’*(1-‘p 0’)/(1-‘pi’)) ) *((‘z alpha’+‘z beta’)ˆ2)/‘impact’ˆ2 di
di "Total number of clusters= " ‘k’
end
*Example
discretepower .05 30 .5 .1
Grateful in advance for any pointers on where i'm going wrong. I'm using STATA 12.1.
Will
I'm trying to run some code to perform power calcs. I've taken this from a paper published by a well regarded econ research organisation. When running this, I get a “‘1’ invalid name” error. This relates in some way to the positional arguments. Beyond this I'm stumped.
Below is a cut down version for illustration. This produces exactly the same error I get when using the more involved programme more relevant to my work.
*Simple Binary Dependent Power Calcs
cap prog drop discretepower
program discretepower
syntax anything [,alpha(real .05) beta(real .8) pi(real .5)]
tokenize "‘0’",parse(" ,")
local rho = ‘1’
local m = ‘2’
local p 0 = ‘3’
local impact = ‘4’
local z alpha = invnormal(1-(‘alpha’/2))
local z beta = invnormal(‘beta’)
local deff = (1+‘rho’*(‘m’-1))
local p 1 =‘p 0’+‘impact’
local k =(‘deff’/‘m’)*( (‘p 1’*(1-‘p 1’)/‘pi’)+(‘p 0’*(1-‘p 0’)/(1-‘pi’)) ) *((‘z alpha’+‘z beta’)ˆ2)/‘impact’ˆ2 di
di "Total number of clusters= " ‘k’
end
*Example
discretepower .05 30 .5 .1
Grateful in advance for any pointers on where i'm going wrong. I'm using STATA 12.1.
Will
Comment