Lab Assignment 5

Load in the required packages

library(rstatix)
## 
## Attaching package: 'rstatix'
## The following object is masked from 'package:stats':
## 
##     filter
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5     ✓ purrr   0.3.4
## ✓ tibble  3.1.5     ✓ dplyr   1.0.7
## ✓ tidyr   1.1.4     ✓ stringr 1.4.0
## ✓ readr   2.0.2     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks rstatix::filter(), stats::filter()
## x dplyr::lag()    masks stats::lag()

Load in the file titled “LabAssignment5”

lab5<-read.csv("/cloud/project/LabAssignment5.csv", stringsAsFactors = TRUE)
lab5
##    Q1   Habitat Cholesterol.Content Q2 Microbe Humidity.Level
## 1  NA    Desert                  98 NA       1            Low
## 2  NA    Desert                  85 NA       2            Low
## 3  NA    Desert                  81 NA       3            Low
## 4  NA    Desert                  99 NA       4            Low
## 5  NA    Desert                  94 NA       5            Low
## 6  NA    Desert                  98 NA       6            Low
## 7  NA    Desert                  94 NA       7            Low
## 8  NA    Desert                  85 NA       8            Low
## 9  NA Antarctic                  26 NA       1           High
## 10 NA Antarctic                  20 NA       2           High
## 11 NA Antarctic                  21 NA       3           High
## 12 NA Antarctic                  20 NA       4           High
## 13 NA Antarctic                  28 NA       5           High
## 14 NA Antarctic                  26 NA       6           High
## 15 NA Antarctic                  23 NA       7           High
## 16 NA Antarctic                  29 NA       8           High
##    Cholesterol.Content.1
## 1                     98
## 2                     85
## 3                     81
## 4                     99
## 5                     94
## 6                     98
## 7                     94
## 8                     85
## 9                     81
## 10                    76
## 11                    90
## 12                    92
## 13                    91
## 14                    86
## 15                    79
## 16                    93

Q1)

You are studying biochemical adaptations in lipid membranes of microbes in different biomes. You count the number of cholesterol molecules per 〖μm〗^2 in the membrane for microbes in 5 different biomes. Does the data below suggest that environment influences the cholesterol content in the microbe membranes?

Ho: p1=p2

Ha: p1>p2

var.test(Cholesterol.Content ~ Habitat, data = lab5)  
## 
##  F test to compare two variances
## 
## data:  Cholesterol.Content by Habitat
## F = 0.26151, num df = 7, denom df = 7, p-value = 0.0977
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##  0.05235546 1.30622266
## sample estimates:
## ratio of variances 
##          0.2615108
t.test(Cholesterol.Content~Habitat, data=lab5, paired=TRUE)
## 
##  Paired t-test
## 
## data:  Cholesterol.Content by Habitat
## t = -25.896, df = 7, p-value = 3.274e-08
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -73.79988 -61.45012
## sample estimates:
## mean of the differences 
##                 -67.625
Lab5_stats<-lab5 %>%
  group_by(Habitat) %>%
  get_summary_stats(Cholesterol.Content)
Lab5_stats
## # A tibble: 2 × 14
##   Habitat  variable     n   min   max median    q1    q3   iqr   mad  mean    sd
##   <fct>    <chr>    <dbl> <dbl> <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Antarct… Cholest…     8    20    29   24.5  20.8  26.5  5.75  5.19  24.1  3.60
## 2 Desert   Cholest…     8    81    99   94    85    98   13     6.67  91.8  7.05
## # … with 2 more variables: se <dbl>, ci <dbl>

Conclusion:

Q2)

You know that temperature can impact the cholesterol content in cell membranes, but what about humidity? You take the desert microbes and place them in a habitat with higher humidity for 1 week, and record the cholesterol content after. Is there a difference in the cholesterol content between the two treatments?

head(lab5)
##   Q1 Habitat Cholesterol.Content Q2 Microbe Humidity.Level
## 1 NA  Desert                  98 NA       1            Low
## 2 NA  Desert                  85 NA       2            Low
## 3 NA  Desert                  81 NA       3            Low
## 4 NA  Desert                  99 NA       4            Low
## 5 NA  Desert                  94 NA       5            Low
## 6 NA  Desert                  98 NA       6            Low
##   Cholesterol.Content.1
## 1                    98
## 2                    85
## 3                    81
## 4                    99
## 5                    94
## 6                    98

Ho: p1=p2

Ha: p1=/=p2

var.test(Cholesterol.Content.1 ~ Humidity.Level, data = lab5)  
## 
##  F test to compare two variances
## 
## data:  Cholesterol.Content.1 by Humidity.Level
## F = 0.86331, num df = 7, denom df = 7, p-value = 0.8512
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##  0.1728378 4.3121518
## sample estimates:
## ratio of variances 
##          0.8633094
t.test(Cholesterol.Content.1 ~ Humidity.Level, data=lab5, paired=TRUE)
## 
##  Paired t-test
## 
## data:  Cholesterol.Content.1 by Humidity.Level
## t = -1.6531, df = 7, p-value = 0.1423
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -13.974751   2.474751
## sample estimates:
## mean of the differences 
##                   -5.75
Lab51_stats<-lab5 %>%
  group_by(Humidity.Level) %>%
  get_summary_stats(Cholesterol.Content.1)
Lab51_stats
## # A tibble: 2 × 14
##   Humidity.Level variable     n   min   max median    q1    q3   iqr   mad  mean
##   <fct>          <chr>    <dbl> <dbl> <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 High           Cholest…     8    76    93     88  80.5  91.2  10.8  6.67  86  
## 2 Low            Cholest…     8    81    99     94  85    98    13    6.67  91.8
## # … with 3 more variables: sd <dbl>, se <dbl>, ci <dbl>

Conclusion: Fail to reject null hypothesis