BME 335 - Homework 7 - Solutions

.pdf

School

University of Texas *

*We aren’t endorsed by this school

Course

335

Subject

Mechanical Engineering

Date

Dec 6, 2023

Type

pdf

Pages

17

Uploaded by DrSteelSquid41

Report
BME 335 – HOMEWORK 7 - SOLUTIONS Due Oct 14, 2022 at 11:59 pm on Gradescope Homework should be completed individually. Homework is graded out of 60 pts. There is a total of 120 pts possible in this homework set. You may do as many problems as you want to earn as many points as possible, with a maximum score of 60 points. For example, if you earn 50 pts, your score will be 50/60. If you earn 70 pts, your score will be 60/60. If you earn 120 pts, your score will be 60/60. It is to your advantage to try as many problems as possible to maximize your score. NOTE: All problem narratives are fictitious unless otherwise indicated. 1. Dr. Amelia Shepherd is interested in how fast food eating habits affect health. She has collected the following data of weight gain over 3 months (in kg) in two random samples of people that either favored eating at Torchy’s or favored eating at Jimmy John’s. Use the data and the plot to the right to answer the following. [10 pts total] Torchy’s : 1.11, 1.34, 1.55, 1.53, 1.50, 1.71, 1.87, 1.86, 1.82, 2.01, 1.95, 2.01, 1.66, 1.49, 1.59, 1.69, 1.80, 2.00, 2.30 Jimmy John’s : 0.98, 0.88, 0.97, 0.99, 1.02, 1.03, 0.99, 0.97, 0.98, 1.03, 1.08, 1.15, 0.90, 0.95, 0.94, 0.99 1.1. List two methods that would be appropriate to test whether there was a difference in mean weight gain between the two groups. [4 pts] Both distributions are not too skewed, so could be roughly normal. However, the variance for the Torchy’s data has higher variance (the distribution is more spread). Thus, we could use Welch’s t-test (rather than a two-sample t-test). The variance increases as the mean increases, so we could try a log transformation. Finally, we might try a permutation test. 1.2. Use a transformation to test whether there is a difference in mean between these two groups. Is there a difference in weight gain between those who favored Torchy’s and those who favored Jimmy John’s? [6 pts] We try a log transformation. In this case, the log-transformed data is: Torchy’s: 0.104, 0.293, 0.438, 0.425, 0.405, 0.536, 0.626, 0.621, 0.599, 0.698, 0.668, 0.698, 0.507, 0.399, 0.464 0.525, 0.588, 0.693, 0.833 Jimmy John’s: -0.020, -0.128, -0.030, -0.010, 0.020, 0.030, -0.010, -0.030, -0.020, 0.030, 0.077, 0.140, -0.105, -0.051, -0.062, -0.010 Intuition and Comprehension [30 pts]
With the log transformation, the standard deviations are more equal (0.064 vs. 0.167), so let’s use a two-sample t-test. 𝐻𝐻 0 : The mean weight gain is the same for the two diets. 𝐻𝐻 𝐴𝐴 : The mean weight gain is not the same for the two diets. We compute the following values from the log-transformed data to perform the two-sample t- test: 𝑌𝑌 1 = 0.533 𝑌𝑌 2 = 0.011 𝑌𝑌 1 𝑌𝑌 2 = 0.544 𝑠𝑠 1 2 = 0.029 𝑠𝑠 2 2 = 0.004 𝑠𝑠 𝑝𝑝 2 = 𝑑𝑑𝑑𝑑 1 𝑠𝑠 1 2 + 𝑑𝑑𝑑𝑑 2 𝑠𝑠 2 2 𝑑𝑑𝑑𝑑 1 + 𝑑𝑑𝑑𝑑 2 = 18 0.029 + 15 0.004 18 + 15 = 0.0176 𝑆𝑆𝑆𝑆 𝑌𝑌 1 ��� −𝑌𝑌 2 ��� = �𝑠𝑠 𝑝𝑝 2 1 𝑛𝑛 1 + 1 𝑛𝑛 2 = 0.0176 ∗ � 1 19 + 1 16 = 0.045 2. The following are very small data sets of human birth weights (kg) of either singleton births or individuals born with a twin. We are interested in the difference in mean birth weight between single babies and twin babies. Singleton : 3.5, 2.7, 2.6, 4.4 Twin : 3.4, 4.2, 1.7 Using the above data, state whether each of the following sets of numbers is a possible permuted sample for use in testing the difference between the means of singleton and twin birth weights. If not, explain why. [10 pts] Singletons Twins 2.1 3.5, 2.7, 2.6, 4.4 3.4, 4.2, 1.7 [2 pts] Yes, by random chance the permutation might reassign data to correct groups 2.2 3.4, 4.2, 1.7, 3.5 2.7, 2.6, 4.4 [2 pts] Yes 2.3 2.7, 2.6, 4.4 3.4, 4.2, 1.7, 3.4 [2 pts] No, sample sizes of groups must be the same in each permutation as in the data. 2.4 2.6, 2.6, 2.6, 2.6 4.2, 4.2, 4.2 [2 pts] No, each data point can occur only in a permutation the same number of times as in the original data sample 2.5 3.5, 3.5, 3.5, 3.5 3.5, 3.5, 3.5 [2 pts] No, each data point can occur only in a permutation the same number of times as in the original data sample
3. Dr. Guo Jia studies how the exposure of a person to tobacco smoke impacts urinary cotinine-to- creatinine ratio (CCR). He conducts a study in which he measures this ratio in infants from smoking households. These households were divided according to their behavior into two groups: one group (group A) with strict controls to prevent exposure of the infant to smoke (31 babies) and another group (group B) with less strict controls (133 babies). The mean (and standard deviation) of the log- transformed CCR was 1.26 (1.58) in the babies from strict households and 2.58 (1.16) from babies from less strict households. The distribution of the log-transformed CCR was approximately normally distributed in both groups. Answer the following questions. [10 pts] 3.1. Do babies from group A households differ significantly from those from group B households in their exposure to smoke? Perform an appropriate test. [6 pts] Since the log-transformed data is approximately normally distributed, we can use a two-sample t-test: 𝐻𝐻 0 : The mean exposure is equal between group A and group B households. 𝐻𝐻 𝐴𝐴 : The mean exposure differs between group A and group B households. To compute the test statistic for the two-sample t-test, we need to compute the pooled sample variance: 𝑠𝑠 𝑝𝑝 2 = 𝑑𝑑𝑑𝑑 1 𝑠𝑠 1 2 + 𝑑𝑑𝑑𝑑 2 𝑠𝑠 2 2 𝑑𝑑𝑑𝑑 1 + 𝑑𝑑𝑑𝑑 2 = 30 1.58 2 + 132 1.16 2 30 + 132 = 1.56 Now we can compute the standard error 𝑆𝑆𝑆𝑆 𝑌𝑌 1 ��� −𝑌𝑌 2 ��� = �𝑠𝑠 𝑝𝑝 2 1 𝑛𝑛 1 + 1 𝑛𝑛 2 = 1.56 ∗ � 1 31 + 1 133 = 0.249 This gives us the test statistic 𝑡𝑡 = 𝑌𝑌 1 𝑌𝑌 2 𝑆𝑆𝑆𝑆 𝑌𝑌 1 ��� −𝑌𝑌 2 ��� = 1.26 2.58 0.249 = 5.30 We need to compare this with a critical value from a t-distribution with df = 31 + 133 – 2 = 162 degrees of freedom. From R, we find with qt(0.975,162) that 𝑡𝑡 0 . 05 ( 2 ), 162 = 1.97 Since |t| > 1.97, we reject the null hypothesis. 3.2. On the non-transformed scale, how much higher is the CCR for babies from group B households as compared to those from group A households? [2 pts] We can back-transform the means of the log-transformed value. 𝑒𝑒 1 . 26 = 3.53 𝑒𝑒 2 . 58 = 13.20 Thus, we get a ratio of 3.7 times more exposure in the less strict (Group B) households. 3.3. Is this an observational or experimental study? Why? [2 pts] This is an observational study since babies were not assigned randomly to smoking households with strict versus lax controls.
4. We want to test the difference between the medians for the following two groups. [10 pts] Group A : 2.1, 4.5, 7.8 Group B : 8.9, 10.8, 12.4 4.1. In R, write code to simulate a 6-sided die to make 10 permuted data sets suitable for testing the difference between the medians of the two groups (hint: use the sample() function). Provide your code and a table with your 10 permuted data sets. [5 pts] # Input data and compute basic values groupA <- c(2.1, 4.5, 7.8) groupB <- c(8.9, 10.8, 12.4) all_data <- c(groupA, groupB) nA <- length(groupA) nB <- length(groupB) n <- nA + nB # Make 10 permutations num_permute <- 10 permutation <- matrix(data=NA, nrow=num_permute, ncol=n) for(i in 1:num_permute) { permutation[i,1:n] <- all_data[sample(1:6,n,replace=FALSE)] } The answers will vary since they are randomly generated, but below is an equal of permutations generated. Group B: 10.8 2.1 4.5, Group A: 8.9 7.8 12.4 Group B: 2.1 8.9 10.8, Group A: 4.5 7.8 12.4 Group B: 4.5 2.1 7.8, Group A: 10.8 8.9 12.4 Group B: 10.8 7.8 2.1, Group A: 12.4 4.5 8.9 Group B: 10.8 4.5 2.1, Group A: 8.9 12.4 7.8 Group B: 7.8 12.4 10.8, Group A: 2.1 4.5 8.9 Group B: 7.8 10.8 2.1, Group A: 12.4 8.9 4.5 Group B: 7.8 8.9 2.1 , Group A: 4.5 12.4 10.8 Group B: 2.1 4.5 10.8, Group A: 8.9 12.4 7.8 Group B: 4.5 12.4 10.8, Group A: 7.8 8.9 2.1 4.2. Using just the 10 data sets you generated in 4.1, test the null hypothesis that the two groups have the same median, using 𝛼𝛼 = 0.20 for the significance level. Provide your test statistic, null distribution, approximate P-value, and conclusion. Include your code with your answer. [5 pts] # Compute test statistic med_diff <- median(groupB) - median(groupA) # 6.3 # Compute null distribution permute_med_diff <- 0 R Application [30 pts]
for (i in 1:num_permute) { permute_med_diff[i] <- median(permutation[i,1:3]) - median(permutation[i,4:6]) } # The answers will vary since they are randomly generated, but below is the null distribution that corresponds to the above 10 random permutations. null_dist <- permute_med_diff[order(permute_med_diff)] # -6.3 -4.4 -4.4 -4.4 -3.0 -1.1 -1.1 1.1 3.0 6.3 # The answers will vary since they are based on randomly generated permutations, but below is the p-value that corresponds to this particular null distribution. # Compute p-value pvalue <- 2*sum(med_diff <= null_dist)/num_permute # 0.2 Since P =0.2, we fail to reject the null hypothesis. There is not enough evidence to conclude that the medians for the two groups are the same. # The answers will vary since they are based on randomly generated permutations, but the conclusion should correspond to the reported p- value. 5. The following data from a random sample of neurons gives the z-scored firing rates (spikes/s) following injection of muscimol. The data are as follows: -10.8, -4.9, -2.6, -1.6, -3, -6.2, -6.5, -9.2, -3.6, -1.8, -1.0, 0.2, 0.2, 0.1, -0.3, -1.4, -1.5, -0.8, 0.3, 0.6, 1.0, 1.2, 2.9, 3.5, 4.3, 4.7, 2.9, 2.8, 2.5, 1.7, 2.7, 1.2, 0.1, 1.3, 2.3, 0.5 Use the data to address the following. [10 pts] 5.1. In R, make a histogram of the data (suggestion: try intervals of size 2.5). Provide the final plot and code. [4 pts] # Input data firing_rates <- c(-10.8, -4.9, -2.6, -1.6, -3, -6.2, -6.5, -9.2, -3.6, -1.8, -1.0, 0.2, 0.2, 0.1, -0.3, -1.4, -1.5, -0.8, 0.3, 0.6, 1.0, 1.2, 2.9, 3.5, 4.3, 4.7, 2.9, 2.8, 2.5, 1.7, 2.7, 1.2, 0.1, 1.3, 2.3, 0.5) # Make histogram hist(firing_rates, main= "Frequency Distribution for Z-scored Firing Rates", xlab="Z-scored firing rate (spikes/s)", ylab="Frequency", xlim = c(-12.5, 5),ylim = c(0, 15), breaks = seq(-12.5,5,by=2.5)) # Save plot dev.copy(png,'Histogram_firing_rates.png') dev.off()
5.2. Describe the way(s) that this distribution differs from a normal distribution. [1 pts] The distribution is left-skewed. 5.3. Based on the data, what test should you use to test whether there is a change in z-scored firing rate following administration of muscimol? [2 pts] Since data is not normally distributed, we cannot use a parametric test. With a single sample and a skewed distribution, a good choice is to do a sign test. A permutation test is also an appropriate alternative. 5.4. Perform the test from 5.3. Provide the P-value from your test and code. State your conclusion from this test. [3 pts] Num_plus <- sum(biomass_change > 0) # 21 Num_minus <- sum(biomass_change < 0) # 15 Num_smaller <- min(Num_plus, Num_minus) # 15 n <- Num_plus + Num_minus # 36 pvalue <- 2*pbinom(Num_smaller,n, 0.5,lower.tail = TRUE) # 0.405 6. Dr. Arjun Sumit has two groups of research mice. One group (GF) was kept free of non-pathogenic gut microbes and all pathogens. The other group (SPF) was only pathogen-free and served as controls. Dr. Sumit has collected the following data are measurements of the percentage of T cells producing the molecule, interleukin-17, in tissue samples from 16 mice in the two groups. [10 pts total] SPF: 18.87, 15.65, 13.45, 12.95, 6.01, 5.84, 3.56, 3.46 GF: 6.64, 4.51, 1.12, 0.62, 0.37, 0.61, 0.71, 0.82 6.1. In R, make a graph to visualize the data. Provide the final graph and code. [4 pts] # Input data spf <- c(18.87, 15.65, 13.45, 12.95, 6.01, 5.84, 3.56, 3.46) gf <- c(6.64, 4.51, 1.12, 0.62, 0.37, 0.61, 0.71, 0.82)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help