To submit this assignment, upload the full document on blackboard, including the original questions, your code, and the output. Submit your assignment as a knitted .pdf (preferred) or .html file.

  1. In this exercise, we will once again use the data of Santangelo et al. (In press) that you used in assignment 5. Let’s go ahead and load in the data.

    1. Create a mixed-effects model with banner petal length (Avg.Bnr.Ht) as the response variable and HCN, Pollination, and their interaction as fixed-effect predictors. Be sure to account for variation due to Genotype, Block and the Genotype by Pollination interactions by including these terms as random effects. This will be our saturated model. Hint: Take a look at lecture 8 for a reminder on how to code random effects using lmer(), especially how interation (i.e. crossed) random-effects are coded. (0.5 marks)

    2. We will generate a reduced model from the saturated model in (a). Should we use AIC or AICc. Why? Show your calculation. (0.5 marks)

    3. Using the approach described in lecture 11, optimize the random effect structure of this model. Show the AIC/AICc output for each model of varying random effect strucure. Describe in one sentence what the optimal random effect structure of the model is and why. Hint: Think carefully about which random effects should and should not be removed from the model. See lecture 11 for the logic behind this decision and assignment 5 for a description of the dataset that will help guide this decision. (1 mark)

    4. Using the model with the optimal random-effect structure identified in (c), find the optimal fixed-effect structure. Be sure to show all the models and their AIC/AICc scores (1 mark)

    5. Based on the AIC/AICc output from (d), generate a your final model with both optimized fixed and random effects. Summarize the model and interpret its output. Is there a significant effect of any treatment? If so, which one(s) and in which direction (i.e. larger or smaller banner petals in which treatment factor level?). Use the model’s output to support your answer. You only need to interpret significant main effects here (i.e. not interactions). (0.5 marks)

    6. Use dplyr and ggplot2 to plot the banner petal length of plants by the main effect that showed a significant effect in the optimized model above. The figure should show the mean plus and minus a single standard error of the mean. Suggest one biological interpretation of the pattern you see in the figure and in the model (i.e. why do you think this would happen). Hint: geom_errorbar(). (0.25 marks)

    7. Do you think we were justified in interpreting a single model? Why or why not? What alternative approach could we have used? (0.25 marks).

  2. Install thecluster package so we can use the dataset “animals”. Use the ?animals to look at the documentation for the dataset, and load the packages below:

    1. First, clean the data so that there are no missing values (recall: the principal() function does not handle NA’s well). Then, create a correlation matrix and create an inital principal components matrix without rotation and with the full number of possible factors. Create a scree plot. Based on the eigenvalues and scree plot, decide on an appropriate number of components for your model and justify your decision. (1 mark)

    2. Run your principal components analysis using the number of factors/components you have selected. Interpret the output using the psych package we used in class. Assign each variable to a component. Do the components you’ve come up with make sense to you? What do they have in common, if anything (1 mark)?

    3. Let’s go back to our survey data. If you need to re-download it, use the code below:

      Choose two appropriate variables to run MANOVA on. Choose two categorical predictor variables. Run the analysis (without follow-up analyses), interpret the results, and explain your choice of variables. (1 mark).

    4. When would we prefer to use MANOVA over ANOVA? When is it not appropriate to use MANOVA? List one example each (1 mark).

This work is licensed under a Creative Commons Attribution 4.0 International License. See the licensing page for more details about copyright information.