Homework 6

My dataset is (loosely) based on an experiment I ran where I used centrifugation to get cells to uptake exogenous mitochondria. Thus, I have two groups, one that did not receive any extra mitochondria, and one that did. The metric I am using here is the total number of mitochondria per cell that were counted when the cells were imaged.

In my real dataset from this experiment, I have six replicates of each condition. The mean number of mitochondria in the the untreated cells was about 130 with a standard deviation of about 17, whereas the treated cells had about 230 mitochondria with a larger standard deviation of 54.

Using these numbers and the rnorm function, I made fake data sets for each of these conditions, then put the data into a data frame.

# make data
no_mito <- rnorm(6, mean=130, sd=17)
plus_mito <- rnorm(6, mean=230, sd=54)

# put data into a dataframe
Number_of_mitochondria <- c(no_mito,plus_mito)
Treatment_condition <- c(rep("no mito", length(no_mito)),rep("plus mito",length(plus_mito)))
mito_frame <- data.frame(Number_of_mitochondria, Treatment_condition)
print(mito_frame)
##    Number_of_mitochondria Treatment_condition
## 1                137.6602             no mito
## 2                120.9349             no mito
## 3                103.9149             no mito
## 4                126.9514             no mito
## 5                106.2629             no mito
## 6                113.0486             no mito
## 7                330.6833           plus mito
## 8                164.7005           plus mito
## 9                117.0746           plus mito
## 10               219.8968           plus mito
## 11               234.9742           plus mito
## 12               304.4414           plus mito

Next, I checked the mean and standard deviation of the data:

# find mean and standard deviation of no_mito
mean(mito_frame[1:length(no_mito),1])
## [1] 118.1288
sd(mito_frame[1:length(no_mito),1])
## [1] 12.92926
# find mean and standard deviation of plus_mito
mean(mito_frame[(length(no_mito)+1):(length(no_mito)+length(plus_mito)),1])
## [1] 228.6285
sd(mito_frame[(length(no_mito)+1):(length(no_mito)+length(plus_mito)),1])
## [1] 81.00661

Since there are only two groups her I performed a T-test, as well as making a simple box plot to visualize the data.

# Perform a T-test
stat <- t.test(Number_of_mitochondria ~ Treatment_condition, data = mito_frame)
print(stat$p.value)
## [1] 0.01996087
#Make a boxplot
boxplot(Number_of_mitochondria~Treatment_condition,data=mito_frame, main="Mito Transfer Data",
        xlab="Treatment", ylab="Number of Mitochondria")

Because I was already seeing a significant p-value at 6, I wrote a for loop to see if a lower replicate number with the same effect size would still be significant.

replicates <- 3:6

for (i in replicates){
  no_mito <- rnorm(i, mean=130, sd=17)
  plus_mito <- rnorm(i, mean=230, sd=54)
  Number_of_mitochondria <- c(no_mito,plus_mito)
  Treatment_condition <- c(rep("no mito", length(no_mito)),rep("plus mito",length(plus_mito)))
  mito_frame <- data.frame(Number_of_mitochondria, Treatment_condition)
  stat <- t.test(Number_of_mitochondria ~ Treatment_condition, data = mito_frame)
  cat("Replicates=",i,"P-value=")
  print(stat$p.value)
}
## Replicates= 3 P-value=[1] 0.06226853
## Replicates= 4 P-value=[1] 0.01317126
## Replicates= 5 P-value=[1] 0.002522646
## Replicates= 6 P-value=[1] 0.01086028

(I’m sure there is a more elegant way to do this, but this was what I was able to figure out)

After running this a few times, it appears that with this effect size, it takes at least four replicates for the data to consistently be significant, though down to 3 is occasionally significant.

Next, I wanted to check if a smaller effect size would decrease the significance. For this I decided to go back to six as the number of replicates, and keep the average number of mitochondria in the untreated the same while increasing the effect size.

mean_dif <- seq(from=10, to=100, by=10)
for (i in mean_dif){
  no_mito <- rnorm(6, mean=130, sd=17)
  plus_mito <- rnorm(6, mean=(130+i), sd=54)
  Number_of_mitochondria <- c(no_mito,plus_mito)
  Treatment_condition <- c(rep("no mito", length(no_mito)),rep("plus mito",length(plus_mito)))
  mito_frame <- data.frame(Number_of_mitochondria, Treatment_condition)
  stat <- t.test(Number_of_mitochondria ~ Treatment_condition, data = mito_frame)
  cat("Mean Difference=",i,"P-value=")
  print(stat$p.value)
}
## Mean Difference= 10 P-value=[1] 0.983247
## Mean Difference= 20 P-value=[1] 0.961367
## Mean Difference= 30 P-value=[1] 0.9027696
## Mean Difference= 40 P-value=[1] 0.0416225
## Mean Difference= 50 P-value=[1] 0.03539114
## Mean Difference= 60 P-value=[1] 0.01235739
## Mean Difference= 70 P-value=[1] 0.006163375
## Mean Difference= 80 P-value=[1] 0.005188107
## Mean Difference= 90 P-value=[1] 0.008846968
## Mean Difference= 100 P-value=[1] 0.0001799768

Running this for loop a few times suggested that the effect size must be an increase of at least 60 mitochondria per cell to be consistently significant.