Post Reply 
ANOVA
03-08-2015, 04:16 PM
Post: #3
RE: ANOVA
ok,
a first draft...

Input data items via Statistic 1var in groups (columns) >= 2
Then use anova(a) where a is alpha, confidence level (i.e. 0.05) with a>0 and <1
Program give a message to say if the test for H0 is to accept (estimation ST > F Fisher) or to refuse, another with degree of freedom, then the value for ST (estimation) and F (with m-1 and m(n-1) d. of fr.)

Code:

EXPORT ANOVA(a)
// ANOVA 1 factor a=α confidence level (es. 0.05)
// use Statistic 1var to input groups
// by Salvo Micciché 2015
BEGIN
local j, k, m, n, g, me:={}, mm;
local s2:={}, ss,  num, den, st, f, msg;
local DL:={eval('D1'),eval( 'D2'), eval('D3'), eval('D4'), eval('D5'), eval
('D6'), eval('D7'), eval('D8'), eval('D9'), eval('D0')};
IF (a <=0 OR a> 1) THEN RETURN("Confidence level must be > 0 AND <1"); END;
m:= 0; 
FOR j FROM 0 TO 9 DO
IF size(DL(j) <> 0) THEN  m := m+1;  END; 
END; // count groups
n:= size(D1); // numerosity

FOR j FROM 1 TO m DO
me(j):= ΣLIST(DL(j))/n; // list of means
s2(j):= ΣLIST((DL(j)-me(j))^2) / (n-1); // list of variances within groups
END; // cacl mean

mm:= ΣLIST(me)/m; // mean of means, sample mean
ss:=  ΣLIST((me - mm)^2) /(m-1); // variance between groups
num:= n*ss; // numerator of test
den:= ΣLIST(s2/m); // denominator = mean of variances
st:= num/den; // estimation
f:= fisher_icdf(m-1,m*(n-1),1-a);
IF st < f THEN MSGBOX("Estimate ST < F Fisher: H0 to accept"); END;
IF st >= f THEN MSGBOX("Estimate ST > F Fisher: H0 to refuse"); END;
msg:= "Degrees of freedom: "+ eval( '(m-1)')+ " and " + eval( 'm*(n-1)');
MSGBOX(msg);
RETURN ("ST ="+ st + " F = "+ f);
END;

I need help for beta testing and a big tip to get RETURN() with multiple values: for now program give only a string, I would like it'd give numeric values with descriptive strings for ST, F, and also others (list of means, variances...)
Thanks to the user DrD for the tip with the columns!

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
ANOVA - salvomic - 02-28-2015, 05:47 PM
RE: ANOVA - salvomic - 03-04-2015, 06:57 PM
RE: ANOVA - salvomic - 03-08-2015 04:16 PM
RE: ANOVA - Gerald H - 03-08-2015, 04:20 PM
RE: ANOVA - salvomic - 03-08-2015, 04:27 PM
RE: ANOVA - salvomic - 03-08-2015, 10:07 PM
RE: ANOVA - salvomic - 03-12-2015, 06:12 PM
RE: ANOVA - Namir - 03-13-2015, 12:44 AM
RE: ANOVA - salvomic - 03-13-2015, 09:47 AM
RE: ANOVA - salvomic - 03-17-2015, 08:01 PM
RE: ANOVA - salvomic - 03-18-2015, 06:09 PM
RE: ANOVA - peterdong - 01-07-2021, 05:22 PM



User(s) browsing this thread: 1 Guest(s)