Pint006

Author

Calvin Belton

Description: This is a survivorship study concerning the PiW3 strain in species Plodia interpunctella. It is specifically concerning the effects that sex has on survivorship, replication a similar study “Pint003” that found females had a significantly shorter lifespan than males. We see the same pattern here.

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.1
✔ ggplot2   3.5.1     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── 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("survival") 
library("ggfortify")
pint006 <- read.csv("/Users/chloebelton/Downloads/Pint006.csv")
pint006$AdultDays <- as.integer(pint006$AdultDays)
Warning: NAs introduced by coercion
pint006$AdultDays[pint006$AdultDays == 0] <- NA
pint006$PupalDays <- as.integer(pint006$PupalDays)
Warning: NAs introduced by coercion
pint006$PupalDays[pint006$PupalDays > 15 | pint006$PupalDays == 0] <- NA
#some individuals had no pupation date, and Excel interpretted this as having the earliest date possible, which wasn't useful.
str(pint006)
'data.frame':   120 obs. of  9 variables:
 $ Experiment  : chr  "Pint006" "Pint006" "Pint006" "Pint006" ...
 $ SampleID    : int  1 2 3 4 5 6 7 8 9 10 ...
 $ Sex         : chr  "Female" "Male" "Female" "Female" ...
 $ PupationDate: chr  "2024-04-20" "2024-04-21" "2024-04-21" "2024-04-20" ...
 $ EclosionDate: chr  "2024-04-28" "2024-04-28" "2024-04-27" "2024-04-28" ...
 $ DeathDate   : chr  "2024-05-06" "2024-05-12" "2024-05-08" "2024-05-07" ...
 $ PupalDays   : int  8 7 6 8 8 6 7 6 8 8 ...
 $ AdultDays   : int  8 14 11 9 9 NA NA 12 8 6 ...
 $ Comment     : chr  "" "" "" "" ...
boxplot(AdultDays ~ Sex, data = pint006, col = c("firebrick2", "dodgerblue"))

breaksBy1 <- 2:22
par(mfrow = c(1,2))
hist(pint006$AdultDays[pint006$Sex == "Female"], col = "firebrick2", 
     breaks = breaksBy1, xlab = "Adult Age", main = "Female")
hist(pint006$AdultDays[pint006$Sex == "Male"], col="dodgerblue", 
     breaks = breaksBy1, xlab = "Adult Age", main = "Male")

t.test(pint006$PupalDays[pint006$Sex==“Female”],pint006$PupalDays[pint006$Sex==“Male”])

boxplot(PupalDays ~ Sex, data = pint006, col = c("firebrick2", "dodgerblue"))

par(mfrow = c(1,2))
hist(pint006$PupalDays[pint006$Sex == "Female"], col = "firebrick2", 
     breaks = breaksBy1, xlab = "Pupal Age", main = "Female")
hist(pint006$PupalDays[pint006$Sex == "Male"], col="dodgerblue", 
     breaks = breaksBy1, xlab = "Pupal Age", main = "Male")

t.test(pint006$PupalDays[pint006$Sex=="Female"],pint006$PupalDays[pint006$Sex=="Male"])

    Welch Two Sample t-test

data:  pint006$PupalDays[pint006$Sex == "Female"] and pint006$PupalDays[pint006$Sex == "Male"]
t = 0.10422, df = 76.398, p-value = 0.9173
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 -0.3850600  0.4275866
sample estimates:
mean of x mean of y 
 7.435897  7.414634 
tapply(X=pint006$AdultDays, INDEX=pint006$Sex, FUN=summary) 
[[1]]
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
     NA      NA      NA     NaN      NA      NA      17 

$Female
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
      5       7       8       8       9      12       2 

$Male
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
   3.00   12.00   14.00   13.75   16.00   21.00       1 
survPint006 <- Surv(time = pint006$AdultDays, event = rep(1, nrow(pint006))) 
survPint006.diff <- survdiff(survPint006 ~ pint006$Sex)
print(survPint006.diff) 
Call:
survdiff(formula = survPint006 ~ pint006$Sex)

n=100, 20 observations deleted due to missingness.

                    N Observed Expected (O-E)^2/E (O-E)^2/V
pint006$Sex=Female 49       49     19.1      46.6      84.8
pint006$Sex=Male   51       51     80.9      11.0      84.8

 Chisq= 84.8  on 1 degrees of freedom, p= <2e-16 
survPint006.diff$pvalue 
[1] 3.299291e-20
survPint006.fit <- survfit(survPint006 ~ pint006$Sex)
print(survPint006.fit) 
Call: survfit(formula = survPint006 ~ pint006$Sex)

   20 observations deleted due to missingness 
                    n events median 0.95LCL 0.95UCL
pint006$Sex=Female 49     49      8       7       9
pint006$Sex=Male   51     51     14      13      15
autoplot(survPint006.fit) + 
scale_fill_manual(values=c("firebrick2", "dodgerblue"))+ 
theme_classic() + 
labs(title = "Plodia PiW3 Survivorship", x="Days", y="Survival")