. program anova
args n1 m1 s1 n2 m2 s2 n3 m3 s3
scalar k=3
gen xbar=(n1*m1+n2*m2+n3*m3)/(n1+n2+n3)
gen s2w=((n1-1)*s1*s1+(n2-1)*s2*s2+(n3-1)*s3*s3)/(n1+n2+n3-k)
gen s2b=(n1*(m1-xbar)*(m1-xbar)+ n2*(m2-xbar)*(m2-xbar)+n3*(m3-xbar)*(m3-xbar))/(k-1)
gen F=s2b/s2w
display "F-value==" F
gen P= invF(k-1,N-k, .95)
display "P-value of the F-statistics is" P
end
I am trying to calculate P-value of F-statistics obtained by the formulas above. I want to give 9 arguments which will be scalar n1 m1 s1......n3 m3 s3. So if initiate my program and type >anova 1 2 3 4 5 6 7 8 9 it would display me the F-value and P value. This is my first time I am doing something like this and I cant figure out. Can someone help me? I can elaborate if my questions are not clear.
Related Posts with Writing a simple program to calculate ANOVA directly
r(198) programm error: code follows on th same line as open bracesI'm working on two loops, one for downloadig data from a website from stata and the other one for tr…
Meta Analysis for one group - no control group.Hi all, I am conducting a systematic review and meta analysis that will investigate health-related …
Interpretation of Adjusted Predictions Contrasts (Margins command)Dear Statalist, I am new to the Margins command and would really appreciate some help with interpre…
(I NEED HELP) How to manually compute generalized residuals and score for a right-censored Tobit model?Hello, Statalist fellows! I'm finishing my bachelor's thesis, in which I'm running a right-censored…
Regressing an interaction of two independent variables, of which one should get lower and one higher, on a dependent variableHi everyone! I want to perform a linear regression with two interacting independent variables but I…
Subscribe to:
Post Comments (Atom)
0 Response to Writing a simple program to calculate ANOVA directly
Post a Comment