-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComp. Analysis.Rmd
73 lines (55 loc) · 1.41 KB
/
Comp. Analysis.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
title: "Comp. Analysis"
author: "Marissa Douglas"
date: "2023-05-31"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
Load Packages Here:
```{r}
library(tidyverse)
library(infer)
```
Load Raw Data Here:
```{r}
raw_data <- read.csv("Competition Experiment Sp 2023 Data - Sheet1.csv")
```
Mutate Data Here:
A data table with the sums for every minute of every day per colony (how many ants are active at that minute)
```{r}
sum_data<- raw_data %>%
filter(! is.na(count)) %>%
group_by(colony, day, minute) %>%
mutate(sum = sum(count))
sum_data
```
A data table with the proportion for every observation (count/sum)
```{r}
proportion_data <- sum_data %>%
mutate(prop = count/sum)
proportion_data
```
Making a data frame that includes the mean proportion of ants at a location for each day
```{r}
mean_data <- proportion_data %>%
group_by(colony, location, day) %>%
mutate(meanInDay = mean(prop))
mean_data
```
```{r}
null_dist <- mean_data %>%
specify(meanInDay ~ colony) %>%
hypothesize(null = "independence") %>%
generate(reps = 1000, type = "permute") %>%
calculate("diff in means", order = c("c392", "c393"))
null_dist %>%
visualize()
```
```{r}
obs_mean <- mean_data %>%
specify(meanInDay ~ colony) %>%
calculate("diff in means", order = c("c392", "c393"))
obs_mean
```