One-way anova with unequal sample sizes

I am asked to compute a MATLAB function which runs a one-way anova test on the following samples
s1=2,6,6,5,2,7,6,4,5,4,1
s2=10,6,6,6,2,11,9,6,11
s3=1,2,5,10,0,3,4,3
and s4=9,5,7,6,8,6,8,8,10
and i am told that as inputs i have to insert these four samples and the level of significance which i have chosen to be 0.05.
The issue i am facing is that I cannot compute these samples into a single matrix as they are unequal and this is giving me a lot of trouble. I also am asked to use an 'if' loop when deciding whether null hypothesis should be accepted or rejected. Can someone please help me out? I would really appreciate

9 Comments

Read the section in the documentation from the top-level <One-way-anova> "Prepare Data for One-Way ANOVA". It explains how to handle the case...the same information is also in the documentation for anova1 under the description of the y input variable;
I will take a look at that. Many thanks !
Edit: Okay i tried it out and it worked :))
I just wanted to ask if you know of any other documents regarding how to fill in the rejection region of an F distribution please? (on a function document not on the normal command window)
Thanks again :)
I don't understand the Q?, sorry...
Do you know how to shade in the rejection region of an F distribution please?
From what starting point? Show us what you've got so far...and I don't know what a "function document" is???
I'm old school; never use any of the new-fangled display stuff if it has something to do with it; you'll have to find somebody much younger than I... :)
But, from the command line using the output from anova1 for the data you had,
x = 0:0.01:10; % range for F variate
y = fpdf(x,3,33); % compute pdf of F with 3,33 num/den DOF
plot(x,y) % plot the total pdf
ylim([0 0.025]) % expand the tail region vertically to see something
Fc=6.32; % the F statistic
ixc=(x>=Fc); % indices from Fc
hA=area(x(ixc),y(ixc).',0); % fill the area to RHS
If you compute
> 1-fcdf(Fc,3,33)
ans =
0.0017
>>
you see you get same result as in the anova table....
Now, how you're supposed to turn this in to your instructor in class I've no klew, but that's the basic steps.
Interestingly, the makedist function doesn't support the F-distribution directly to make the distribution object; I've no klew about why that might be so, either.
Sorry for the misunderstanding basically "function document" is what you get when you go on 'New' and press 'New Function' and I am asking how to shade the rejection area from the critical point 6.32 as you have already pointed out by inputting commands in this 'function document' rather than if you were to input commands in the standard command window. I will try out what you have suggested
dpb
dpb on 12 Jun 2022
Edited: dpb on 12 Jun 2022
Oh. That's just the code editor for us old fogies...we didn't know anything about "documents" in the days of yore when those newfangled CRT terminals and actual disk(!!!) files(*) replaced the card decks and the <IBM 029>
(*) The <Philco 2000> I cut eye teeth on had no disk nor drum but 27(!!!) 7-track mag tape drives.
IT WORKED !! Thank you so much for your help you have no idea how much i appreciate. Hope you have a great rest of the day :))
dpb
dpb on 12 Jun 2022
Edited: dpb on 12 Jun 2022
Glad to help...teaching is part of the attraction besides just the play...you had shown enough "go get 'em" on assignment with just guidance to make the last not seem like doing too much.

Sign in to comment.

Answers (0)

Asked:

on 11 Jun 2022

Edited:

dpb
on 12 Jun 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!