Load in the required packages:
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.2
## ✔ ggplot2 4.0.0 ✔ tibble 3.3.0
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.1.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(rstatix)
##
## Attaching package: 'rstatix'
##
## The following object is masked from 'package:stats':
##
## filter
Load in the dataset:
file.choose()
## [1] "X4S\xa6\x9ed"
project<-read.csv("/cloud/project/Christopher Bealer/Final/Wigginton_Data1.csv", stringsAsFactors = TRUE)
project
What analysis will you run? Correlation/Regression
light_reg<-lm(Invasive.Plant.Percent.Cover~Light.Penetration, data=project)
summary(light_reg)
##
## Call:
## lm(formula = Invasive.Plant.Percent.Cover ~ Light.Penetration,
## data = project)
##
## Residuals:
## Min 1Q Median 3Q Max
## -11.359 -6.714 -2.214 5.785 17.356
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 116.662 4.894 23.84 4.11e-12 ***
## Light.Penetration -120.405 8.769 -13.73 4.09e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 9.478 on 13 degrees of freedom
## Multiple R-squared: 0.9355, Adjusted R-squared: 0.9305
## F-statistic: 188.5 on 1 and 13 DF, p-value: 4.088e-09
Strong negative correlation; reject the null
light_res<-residuals(light_reg)
shapiro.test(light_res)
##
## Shapiro-Wilk normality test
##
## data: light_res
## W = 0.90463, p-value = 0.112
Report all the statistics:
p-value=4.088e-09; strong negative correlation r-squared=0.94 p-value(shapiro)=0.112, association present
What is your conclusion from the analysis?
According to the regression analysis, we reject the null hypothesis (p=4.088e-09) and conclude that there is a negative relationship between light penetration levels and the amount of invasive plant species cover. There is high amounts of variability around the model (r-squared=0.9355; y=-120.41x+166.67).
Create a data visualization and figure caption:
ggplot(project, aes(x=Light.Penetration, y=Invasive.Plant.Percent.Cover))+
geom_point()+
geom_smooth(method="lm", se=FALSE, color="black")+
theme_classic(16)+
xlab("Light Penetration")+
ylab("Plant Cover (%)")
## `geom_smooth()` using formula = 'y ~ x'
Great! Copy and paste your data visualization to your word document or save the image.