## Unit 4 - two-factor analysis of variance, graphing the normal curve

- Setting the workspace
- Data revisited
- Two-factor Analysis of Variance without interaction

We also look at how to graph the bell-shaped curve (Normal Curve, or Gaussian Curve)

Review of and comments on the video:

Primordial in the calculations behind the Anova and lots of other tests, modelling and simulation, are the properties of means and variances of random variables, as we now see:

Remember that the mean is the average: the sum of all numbers divided by the number of numbers.

The variance of a population is the average of squares of differences from the mean. If we have a sample that is not the whole population, then instead of dividing by the number of numbers, n, we divide by n-1.

For means:

- If X is a random variable and c is a constant, the mean of cX is c times the mean of X. mean(cX)=c•mean(x)
- If X and Y are random variables, then mean(X+Y) = mean(X) + mean(Y)

For variances var(X):

- If X is a random variable and c is a constan, then var(cX)=c
^{2}var(X)
- If X and Y are random variables, then var(X+Y) = var(X) + var(Y) + 2cov(X,Y). Here, the covariance, cov, is the average of

(X-μ_{x})(Y-μ_{y}).
- If X and Y are independent, then cov(X,Y)=0, so the variance of the sum is the sum of the variances.

Here is the code that was introduced to draw the bell curve:

x <- seq(-10,10,0.05)

densities <- dnorm(x,mean=0,sd=3)

plot(x, densities, type="l", lwd=2, xlab="", ylab="Density", main="The Normal Curve", col="darkgreen")

Just to add a little something, this code also works **:**

curve(dnorm(x,0,3),from=-10, to=10)

For that matter, try out stuff like:

curve(x^{2},from=-2, to=2, col="red", lwd=2)

Don't forget to type dev.off() to turn off the print device.

We will come back to the Anova after the modeling and simulation units, but here is a preview in the form of the classical Anova table.

Looking at the last column in the table above, we see that if we divide the EMS for among by the EMS for within, the quotient is equal to 1 if and only if all the μ_{i}'s are equal to the overall mean μ (conclusion: no difference among the group means).

©
Germinal Knowledge. All rights reserved