-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThomasP - Models.R
35 lines (23 loc) · 1.28 KB
/
ThomasP - Models.R
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
library(tidyverse)
library(dplyr)
library(plotrix)
library(nlme)
library(MASS)
library(gridExtra)
#Run models testing the effect of year (factor) and transect and year*transect on phrag abundance. AND a model with the effect of year (linear) and transect and year*transect on phrag abundance
#Run models testing the effect of year (factor) and transect (and phrag abundance) and year*transect on phrag abundance. AND a model with the effect of year (linear) and transect (and phrag abundance) and year*transect on phrag abundance
phragmain <- read.csv("PhragSurvey2017to2022.csv", stringsAsFactors = TRUE)
phragx <- phragmain %>%
filter(!phragmain$Site %in% c('LUMCON 1', 'LUMCON 2', 'Fontainebleau', 'Turtle Cove'), !is.na(Phragmites.australis))
#gls with year and transect
gls.yt <- gls(Phragmites.australis ~ Year + Transect + Year*Transect, data = phragx)
summary(gls.yt)
#glm with year and transect
phragy <- read.csv("DeleteX.csv", stringsAsFactors = TRUE)
phragy <- phragy %>%
filter(!phragmain$Site %in% c('LUMCON 1', 'LUMCON 2', 'Fontainebleau', 'Turtle Cove'), !is.na(Phragmites.australis))
glm.yt <- glm(Litter ~ Year + Transect + Year*Transect,data = phragy)
summary(glm.yt)
#lm with year and transect
lm.yt <- lm(Litter ~ Year + Transect + Year*Transect,data = phragy)
summary(lm.yt)