Guiding questions

  1. ANOVA is a type of linear model. In ANOVA, we are often interested in comparing the mean of more than two groups. Please simulate data for 4 groups under the assumptions of a linear model.

  2. Once you have simulated these data, let’s fit a linear model. To this end, we will need to create \(N_g-1\) binary covariates, where \(N_g\) is the number of groups. In our example, this means that we will need to create 3 binary covariates because we have 4 groups/treatments. Creating these 3 binary variables might seem very exoteric but this is exactly what R does when you specify a variable to be a factor with 4 levels.

  3. Fit a linear model in a frequentist framework using the “lm” function

a - What is the p-value of the model? This is shown at the very bottom together with the F-statistic and should be identical to the one we get using the “aov” function.

b - Estimate the mean of each group by summing the appropriate parameters.

  1. Fit a linear model in a Bayesian framework using our JAGS code. Do our parameter estimates from the Bayesian model match those estimated using a frequentist framework?



Back to main menu

Comments?

Send me an email at