-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path5 - Anderson MANOVA.Rmd
48 lines (40 loc) · 1.35 KB
/
5 - Anderson MANOVA.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
title: "Bits of Code"
author: "Amir Nakar"
date: "10/1/2020"
output: word_document
fontsize: 6pt
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r, include=FALSE}
load(file = "F:/MorK/R/R-environment.RData")
#### Load the data ####
library(openxlsx)
library(reshape2)
library(ggplot2)
library(Hmisc)
library(dplyr)
library(car)
library(caret)
library(readxl)
library(ggsignif)
library(tidyr)
library(vegan)
library(purrr)
```
```{r message=FALSE, warning=FALSE}
#### 2-way ANOVA on non-normal data ####
#Parameters needed from original data: Age [3], font 2 [13], Sum.new [33], Sum.old [32]
data.manova = data[,c(3,13,33,32)] #makes a new dataframe with only the relevant columns
data.manova.filtered = data.manova %>% drop_na() #removes any lines with missing data (NAs)
colnames(data.manova.filtered) = c("age", "font", "sum.new", "sum.old") #renames the colomns for easy writing downstream
res.aov.Q1 <- adonis(sum.new ~ age * font, data = data.manova.filtered, permutations = 1000) # Calculates the 2-way ANOVA with 1,000 permutations
res.aov.Q2 <- adonis(sum.old ~ age * font, data = data.manova.filtered, permutations = 1000) # Calculates the 2-way ANOVA with 1,000 permutations
```
Output:
```{r message=FALSE, warning=FALSE, echo=FALSE}
res.aov.Q1
res.aov.Q2
```