RQ1: Is there a linear relationship between the carbon dioxide concentration and the carbon dioxide uptake of plants?
RQ2: Is there a significant association between the type of plant and the treatment applied?
#data(package = .packages(all.available = TRUE))
mydata <- force(CO2)
head (mydata, 10)
## Plant Type Treatment conc uptake
## 1 Qn1 Quebec nonchilled 95 16.0
## 2 Qn1 Quebec nonchilled 175 30.4
## 3 Qn1 Quebec nonchilled 250 34.8
## 4 Qn1 Quebec nonchilled 350 37.2
## 5 Qn1 Quebec nonchilled 500 35.3
## 6 Qn1 Quebec nonchilled 675 39.2
## 7 Qn1 Quebec nonchilled 1000 39.7
## 8 Qn2 Quebec nonchilled 95 13.6
## 9 Qn2 Quebec nonchilled 175 27.3
## 10 Qn2 Quebec nonchilled 250 37.1
Description:
This is data from experiment on cold tolerance of the grass species Echinochloa crus-galli. It contains 84 observations and 5 variables:
Plant: ordered factor with levels Qn1<Qn2…<Mc – unique indentifier for each plant separately (six plants in total)
Type: origin of the plant which can be Quebec or Mississippi
Treatment: half of the plants were chilled overnight before experiment was conducted, half were not chilled.
Conc: Concentration of ambient CO2 in mL/L
Uptake: CO2 uptake rates calculated in μmol/meter(squared)sec
Source Potvin, C., Lechowicz, M. J. And Tardif, S. (1990) “The statistical analysis of ecophysiological response curves obtained from experiments involving repeated measures”, Ecology, 71, 1389–1400.
Pinheiro, J. C. And Bates, D. M. (2000) Mixed-effects Models in S and S-PLUS, Springer.
#for descriprive statistics
summary(mydata)
## Plant Type Treatment conc uptake
## Qn1 : 7 Quebec :42 nonchilled:42 Min. : 95 Min. : 7.70
## Qn2 : 7 Mississippi:42 chilled :42 1st Qu.: 175 1st Qu.:17.90
## Qn3 : 7 Median : 350 Median :28.30
## Qc1 : 7 Mean : 435 Mean :27.21
## Qc3 : 7 3rd Qu.: 675 3rd Qu.:37.12
## Qc2 : 7 Max. :1000 Max. :45.50
## (Other):42
We can see that there are 12 plants (6 from Quebec origin and 6 from Mississippi) half of them were undergone the cilltreatment and helf did not during 8 different CO2 ambient concentrations (in. total 12 plants under 8 observations- 84 observations in total). Average concentration of ambient CO2 is 435mL/L and the average CO2 uptake was 27.21μmol/m2sec.
#install.packages(“car”)
library(car)
## Loading required package: carData
scatterplotMatrix(mydata[,c(-1,-2,-3)], smooth=FALSE)
Firstly we have seen that there is positive correlation between uptake rates of CO2 and concentrations of ambient carbon dioxide. The distribution does not appear not normal but just in case the normality test will be done
shapiro.test(mydata$conc)
##
## Shapiro-Wilk normality test
##
## data: mydata$conc
## W = 0.87064, p-value = 5.146e-07
Hypothesis for Shapiro-Wilk normality test:
H0:Variable is normally distributed H1:Variable is not normally distributed
With (p<0.001) we reject Ho and conclude that this variable is not normaly distributed.
shapiro.test(mydata$uptake)
##
## Shapiro-Wilk normality test
##
## data: mydata$uptake
## W = 0.94105, p-value = 0.0007908
Moreover, also the another test for normality is indicating not normal distribution. So we can say that neither of our variables is normally distributed at statistical significance (p<0,001). Since the distributions are not normal we cannot use Pearson correlation test but Spearman correlation.
cor.test(mydata$conc, mydata$uptake,
method = "spearman",
use = "complete.obs")
## Warning in cor.test.default(mydata$conc, mydata$uptake, method = "spearman", :
## Cannot compute exact p-value with ties
##
## Spearman's rank correlation rho
##
## data: mydata$conc and mydata$uptake
## S = 41483, p-value = 7.39e-09
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
## rho
## 0.5800041
Here the hypothesis is:
H0: True rho is equal to 0 for Conc and Uptake variables H1: True rho is not equal to 0 for Conc and Uptake variables
We can reject H0 and conclude that rho of numeric vector of ambient carbon dioxide concentrations and a numeric vector of carbon dioxide uptake rates scores differ from 0 at statistical significance which means that there is correlation between variables. Furthermore, the answer to the Research Question 1: There is correlation between carbon dioxide concentration and carbon dioxide uptake of plants (p<0.001) and that there is semi-strong positive linear relationship.
For the second RQ we have to inspect if there is a significant association between the type of plant and the treatment applied?
in this case since is the research of the plant done in specific and controled conditions the association will be present but at the same amout for each of the
Assumptions that needs to be meet are:
Observations are independent-plants are not mixed during treatments
Expected frequencies are greater than 5 for all combimations
In larger contingency table up to 20% of expected frequencies are between 1 and 5, but never bellow 1.
results <- chisq.test(mydata$Plant, mydata$Treatment,
correct = FALSE)
## Warning in chisq.test(mydata$Plant, mydata$Treatment, correct = FALSE):
## Chi-squared approximation may be incorrect
results
##
## Pearson's Chi-squared test
##
## data: mydata$Plant and mydata$Treatment
## X-squared = 84, df = 11, p-value = 2.473e-13
Since i got the warrning regarding the test the check of assumptions is done:
addmargins(results$observed)
## mydata$Treatment
## mydata$Plant nonchilled chilled Sum
## Qn1 7 0 7
## Qn2 7 0 7
## Qn3 7 0 7
## Qc1 0 7 7
## Qc3 0 7 7
## Qc2 0 7 7
## Mn3 7 0 7
## Mn2 7 0 7
## Mn1 7 0 7
## Mc2 0 7 7
## Mc3 0 7 7
## Mc1 0 7 7
## Sum 42 42 84
addmargins(round(results$expected, 2))
## mydata$Treatment
## mydata$Plant nonchilled chilled Sum
## Qn1 3.5 3.5 7
## Qn2 3.5 3.5 7
## Qn3 3.5 3.5 7
## Qc1 3.5 3.5 7
## Qc3 3.5 3.5 7
## Qc2 3.5 3.5 7
## Mn3 3.5 3.5 7
## Mn2 3.5 3.5 7
## Mn1 3.5 3.5 7
## Mc2 3.5 3.5 7
## Mc3 3.5 3.5 7
## Mc1 3.5 3.5 7
## Sum 42.0 42.0 84
Above frequencies are between 1 and 5 and not even one is under 1. The connection between these variables is due nature of the dataset and the way how the whole experiment for the plant was done. There was equal amount of all types of plants in all conditions in same amounts for treatment.
round(results$res, 2)
## mydata$Treatment
## mydata$Plant nonchilled chilled
## Qn1 1.87 -1.87
## Qn2 1.87 -1.87
## Qn3 1.87 -1.87
## Qc1 -1.87 1.87
## Qc3 -1.87 1.87
## Qc2 -1.87 1.87
## Mn3 1.87 -1.87
## Mn2 1.87 -1.87
## Mn1 1.87 -1.87
## Mc2 -1.87 1.87
## Mc3 -1.87 1.87
## Mc1 -1.87 1.87
Moreover here we can see that the standard residuals are equaly distributed wich is great thing for the researchers who were coming up with this test.
For the sake of this assigment I will perform the possible proportion tables which will be same
addmargins(round(prop.table(results$observed), 2))
## mydata$Treatment
## mydata$Plant nonchilled chilled Sum
## Qn1 0.08 0.00 0.08
## Qn2 0.08 0.00 0.08
## Qn3 0.08 0.00 0.08
## Qc1 0.00 0.08 0.08
## Qc3 0.00 0.08 0.08
## Qc2 0.00 0.08 0.08
## Mn3 0.08 0.00 0.08
## Mn2 0.08 0.00 0.08
## Mn1 0.08 0.00 0.08
## Mc2 0.00 0.08 0.08
## Mc3 0.00 0.08 0.08
## Mc1 0.00 0.08 0.08
## Sum 0.48 0.48 0.96
We can say that each plant had equal chances to be chilled or not.
#install.packages("psych")
#install.packages("effectsize")
library(effectsize)
effectsize::cramers_v(mydata$Plant, mydata$Treatment)
## Cramer's V (adj.) | 95% CI
## --------------------------------
## 0.94 | [0.66, 1.00]
##
## - One-sided CIs: upper bound fixed at [1.00].
interpret_cramers_v(0.94)
## [1] "very large"
## (Rules: funder2019)