The structural model for ANOVA with one fixed factor and one random factor is similar to that for the two fixed factor model.
We assume that Factor A is the fixed factor and Factor B is the random factor. Thus μ and the αi are constants while the βj, (αβ)ij and εijk are variables. We assume that for all i, j and k, βj, (αβ)ij and εijk are pairwise independent, and
Thus we have
The definitions of  SSA, SSB, SAB, SSE and similarly for the MS and df terms are exactly the same as for the two fixed factor model described in Two Random Factor ANOVA.  We also have
The null and alternative hypotheses as well as the test statistics are similar to that used in the two random factor case (with the exception of the main factor A case) as summarized in the following table:
Test Desired | Null Hyp H0 | Alt Hyp H1 | Statistical Test |
Fixed Factor A Effect |  αi = 0 for all i |  αi ≠ 0 for some I | |
Random Factor B Effect | Â | Â | |
Interaction Effect | Â | Â |
Observation: The mixed factor model given here is called the restricted version. There is an unrestricted version where the test for factor B is done via
Observation: Estimates of the population variances and confidence intervals corresponding to the random effects, and , are calculated as in the two random factor model.
Example 1: A research group wants to study the effectiveness of three types of training programs (Conflict Management, Psychology and Negotiation) for FBI agents’ preparedness for dealing with local youth who may become involved in terrorist attacks.
Throughout the country, local FBI field offices have conducted one or more of these types of training. The research group decides to randomly select three field offices that have conducted all three types of training. It then selected 15 FBI agents at random from each of the four field offices, 5 of whom took only the Conflict Management training, 5 of whom took only the Psychology training and 5 of whom took only the Negotiation training. Each person in the sample was then given a test to assess their skills in dealing with local youth who were at risk of becoming involved in terrorist attacks. The results are shown in Figure 1.
Determine whether there is a significant difference between the three training courses in preparing agents for dealing with youths susceptible to becoming involved in terrorism.
Figure 1 – Data for anti-terrorism training
To perform this analysis you can execute Excel’s Anova: Two Factor with Replication data analysis. You will get similar results by using the Real Statistics Anova: two-factor data analysis, as shown in Figure 2.
Figure 2 – Two Fixed Factor ANOVA
You can now modify the analysis in Figure 2 to obtain the mixed factor analysis as displayed in Figure 3.
Figure 3 – Two Mixed Factor ANOVA
The only changes that need to be made to Figure 2 to obtain the analysis shown in Figure 3 is to replace the formula in cell R17 by =Q17/Q19, instead of =Q17/Q20, and the formula in cell S17 by =F.DIST.RT(R17,P17,P19), instead of =F.DIST.RT(R17,P17,P20).
The factor of interest is the fixed factor (Rows), and we see from cell T17 of Figure 3 that there is no significant difference between the training courses. Note that this is a different result from that obtained erroneously from cell T7 of Figure 2.
Note too that it is important not to simply disregard the Office factors and perform a one-way ANOVA. The one-factor analysis can be performed using the Real Statistics One-Factor ANOVA data analysis tool (as described in ANOVA Confidence Interval) on the data in range B29:D49 on the left side of Figure 4. The resulting analysis is shown on the right side of Figure 4.
Figure 4 – One-way ANOVA
This test shows, erroneously, that there is a significant difference between the training courses (cell K39 of Figure 4).
Note that we were able to obtain the data in range A29:D49 in Figure 4 from the data in Figure 1 by checking the Display input flipping rows and columns field (as shown in Figure 5) when performing the two-factor analysis shown in Figure 2.
Real Statistics Data Analysis Tool: You can also perform the analysis for Example 1 directly (without having to modify the output as we did in Figure 3), since the Real Statistics Resource Pack provides an option to the Two Factor ANOVA data analysis tool which supports mixed models.
To use the tool for the analysis of Example 1, click on cell N13 (where the output will start), enter Ctrl-m and double click on Analysis of Variance. Next select Two Factor Anova from the dialog box that appears. Next fill in the dialog box that appears as shown in Figure 5 and click on the OK button.
Figure 5 – Dialog box for Two Mixed Factors ANOVA
The output consists of some descriptive statistics plus the ANOVA table shown in Figure 3.
Good afternoon Charles, we are conducting a study in which we want to describe the differences in ocular biometric parameters before and after treatment. As we do not have access to a lot of patients we are using both eyes of some patients. As you can see, we have two levels of correlation, same eye before and after treatment and two eyes for each patient. Can you please describe how can we use mixed models to compare the variables after treatment?
Thank you in advance.
Hello Martin,
I understand the following:
1. For some number of patients, you have before/after data for one eye. Is it always the right eye? How many such patients are in this category?
2. For some number of patients, you have data for both eyes. Do you have both before and after data for these patients? How many patients are in this category?
Charles
Hello Charles,
Thank you for your reply.
We have 253 eyes of 146 patients.
We have before and after treatment for all eyes.
Of those 107 “single” eyes we have some right and some left eyes.
Thank you again!
Hello Martin,
On approach is to only include patients for which you have both eyes. This is appealing since you seem to have a lot of data for this case.
Another approach is to include patients for which you have the right eye (ignore the left eye).
Another approach is to include patients for which you have the left eye (ignore the right eye).
Mixing patients where you have data for both eyes with those that you have data for one eye doesn’t seem right. If you knew that there is no different between eyes in general, then you could randomly select one eye from each patient.
Perhaps there are other approaches, but these are the ones that I have thought of.
Charles
Dear Charles,
I would like to ask if I have to see effect of temperature (20,40,60,80) to antioxidant level by time (0,2,4,6,8 days). Which statistical analysis should I perform?
Thank you
What hypothesis or hypotheses are you trying to test?
Charles
Dear Charles,
Each time I use your app I am more happy with it… It can make fantastic think in a simple way and understand much better the statistic process than other softwares.
I want to use a two way ANOVA with level as a between subject factor and type of stroke as a within subject factor. I have performed the two way mixed ANOVA with your app but I have some doubts. I would be very grateful if someone could help me with those doubts:
1) How could I assess the homogeneity of variances and covariances (Box M test)?
2) How could I check the condition of sphericity? I do not see the results of the Mauchly test.
3) What to do if there is not homogeneity of covariances.
4)For the contrast I should use the follow up with replications or without replications? (i suposse that with replications)
5) What is the number of coefficients of the contrast of the interactions?
Thanks a lot,
Gabriel
Charles,
I have one more question regarding the 2 factor mixed model. The analysis of the 2 factor random and mixed models gives the same F statistic values for the factors, and therefore the sample p-value and conclusion. If I understood correctly, the Ho and Hi statements are not the same for the random factor and fixed factor between the two models. But, both models are to determine the effect difference among the levels of the factors. If so, then what is the advantage to run the 2 factor mixed model over the 2 factor random model in reducing variances as they give the exactly same F statistic values for all factors in both models?
Kind Regards,
-Sun
Hello Sun,
I previously used the unrestricted version of the Two Mixed Factor ANOVA model. This was changed in the Real Statistics Resource pack a few releases ago to the restricted version of the model. Unfortunately, I forgot to update the website. I have now done this, and so you will see that the Two Mixed Factor ANOVA will give different results from the Two Random Factor ANOVA model as well as the Two Fixed Factor ANOVA model.
Thank you for catching this error and for your careful reading of the website. You have found quite a few errors already and so have really helped improve the website.
Charles
Charles, I have 2 items to bring your attention on Example 1.
First, all numbers of the sample sizes described in the example should be reduced to the half of what were written to correctly denote Figure 1. For example, there should be 15 FBI agents instead of 30.)
Second, when I ran the 2 mixed factor model option in the Real Stat Analysis Tool, F statistic for the column factor was calculated using the denominator of the MS(within) rather than MS(interaction) as if it is done for the fixed factor case. Would you please check the tool set up so that the correct denominator term can be picked.
Thanks,
-Sun
Dear Charles:
Frequently, in complete randomized block design, you have one experimental unit in each block for each treatment (like an two way anova without replication) and no interaction between treatments and blocks is considered. I tried to analyze an example considering blocks as a random effect, using Data Analysis Tool, Two Factor Anova, Anova-Mixed analysis type (ver 5.8). I got a wrong output. I would appreciate your help on this issue.
Data Follows (Tra: Treatments; GE (age group: blocks)
GE1 GE2 GE3 GE4 GE5
TraA 7 8 9 10 11
TraB 9 9 9 9 12
TraC 10 10 12 12 14
Jorge,
I believe that you should use the (1) Randomized Complete Block data analysis tool or the (2) One Factor ANOVA Repeated Measures data analysis tool, and not the tool that you selected. Assuming that your data is in the range A1:F4 (including headings), then you should choose A1:F4 as the Input Range if you use (1), but B1:F4 if you use (2).
Charles
I have correctly installed the RealStat pack, but when I try to perform a Two Mixed Factors ANOVA, after entering the data table, doing the follwing:
” To use the tool for the analysis of Example 1, click on cell N13 (where the output will start), enter Ctrl-m and double click on Analysis of Variance. ” nothing happens, that is, I enter Ctrl-m and nothing appears.
Thanks!
Carlos,
What do you see when you put the formula =VER() in any cell?
When you press the key sequence Alt-TI do you see RealStat and Solver in the list of addins with checkmarks next to them?
Charles
First, thanks for some great tools, really helpful to have and using it extensively right now.
Shouldn’t the F-ratio for the random factor (Factor B in the example above) be caluclated as the MeanSquareB/MeanSquareWithin? Just looking over Zar’s Biostatistical Analysis and that is what he reports.
Tim,
Great to read that you are finding the tools to be useful.
As described on the referenced webpage, there are two versions of the mixed factors model. I present the “unrestricted” version. You are referring to the “restricted” version.
Charles