Biostats lab 7

docx

School

California State University, Los Angeles *

*We aren’t endorsed by this school

Course

3000

Subject

Statistics

Date

Feb 20, 2024

Type

docx

Pages

12

Uploaded by CommodoreSeal5397

Report
LAB ASSIGNMENT #7 1. Run the Finch Beak applet (see handout), save the data in a csv file, and import the results as a data frame called finches in R. Type the name of the data frame to display the data. Copy/paste your R commands and the resulting output into the green box below. > setwd("C:/Users/Ally/Desktop") > finches=read.csv("finches.csv") > finches island depth 1 La Palma 6.83 2 La Palma 6.95 3 La Palma 6.73 4 La Palma 7.91 5 La Palma 6.54 6 La Palma 7.38 7 La Palma 7.08 8 La Gomera 7.42 9 La Gomera 7.53 10 La Gomera 7.01 11 La Gomera 6.80 12 La Gomera 6.82 13 La Gomera 7.67
14 El Hierro 8.22 15 El Hierro 6.61 16 El Hierro 6.81 17 El Hierro 6.24 18 El Hierro 7.22 19 Tenerife 8.67 20 Tenerife 6.85 21 Tenerife 8.75 22 Tenerife 7.68 23 Tenerife 8.44 24 Tenerife 8.16 25 Tenerife 8.43 26 Tenerife 8.34 27 Tenerife 7.92 28 Gran Canaria 9.47 29 Gran Canaria 6.84 30 Gran Canaria 7.72 31 Gran Canaria 7.11 32 Gran Canaria 8.40 33 Gran Canaria 7.76 34 Gran Canaria 8.28 35 Gran Canaria 7.68 2. Create a box plot comparing the finch beaks from the five islands. Copy/paste your R command and the resulting figure into the green box below
> boxplot(depth~island,data=finches) 3. Use the aggregate()function to compute the sample sizes (finchn), means
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
(finchm), and standard deviations (finchsd) for the islands, and then compute the standard errors(finchse) of finch beak depth. Make sure that the numeric values are visible in your output.Copy/paste your R commands and the resulting output into the green box below. > finchn= aggregate(depth~island, data=finches, FUN="length")> finchn island depth 1 El Hierro 5 2 Gran Canaria 8 3 La Gomera 6 4 La Palma 7 5 Tenerife 9 > finchm= aggregate(depth~island, data=finches, FUN="mean") > finchm island depth 1 El Hierro 7.020000 2 Gran Canaria 7.907500 3 La Gomera 7.208333 4 La Palma 7.060000 5 Tenerife 8.137778 > finchsd= aggregate(depth~island, data=finches, FUN="sd")> finchsd island depth 1 El Hierro 0.7583864 2 Gran Canaria 0.8200131 3 La Gomera 0.3790207 4 La Palma 0.4600000
5 Tenerife 0.5907152 > finchse=finchsd$depth/sqrt(finchn$depth) > finchse [1] 0.3391607 0.2899184 0.1547345 0.1738637 [5] 0.1969051 4. Create a bar plot of the means of finch beak depth for the five islands. Add standard error bars to the plot. Copy/paste your R commands and the resulting figure into the green box below. > barx=barplot(finchm$depth, names.arg = finchm$island, ylim =c(0,60),xlab = "Islands",ylab="Depth (mm)")> arrows(barx,finchm$depth, barx,finchm$depth+finchse, angle=90, length=0.1
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
5. Conduct an ANOVA to test the null hypothesis of no differences in mean beak depth among the five islands. Copy/paste your R commands and the resulting output into the green box below. > finchmodel=lm(depth~island, data=finches) > finchmodel Call: lm(formula = depth ~ island, data = finches) Coefficients: (Intercept) islandGran Canaria 7.0200 0.8875 islandLa Gomera islandLa Palma 0.1883 0.0400 islandTenerife 1.1178 > anova(finchmodel) Analysis of Variance Table Response: depth Df Sum Sq Mean Sq F value island 4 7.9174 1.9793 5.0378 Residuals 30 11.7870 0.3929 Pr(>F) island 0.003158 **Residuals
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 6. In your own words, write your conclusion regarding the differences in mean beak depth among the islands at the 5% level of significance. Do not just write “reject H0” or “do not reject H0.” Your conclusion must say something about the means of beak depth among the islands. Write the conclusion in the green box below. We should reject H0 as differences in mean beak depth exist among the islands 7. Conduct an Bartlett test of homogeneity of variances for beak depth among the five islands.No plots are needed. Copy/paste your R commands and the resulting output into the green box below > bartlett.test(depth~island,data=finches) Bartlett test of homogeneity of variances data: depth by island Bartlett's K-squared = 4.1154, df = 4, p-value = 0.390
8. In your own words, write your conclusion regarding the equality of variances in beak depth among the islands. Do not just write “reject H0” or “do not reject H0.” Your conclusion must say something about validity of the equality of variances assumption for the ANOVA. Write the conclusion in the green box below. We do not reject H0 as there is equality of variances in beak depth among the islands. This indicates that the assumptions of the ANOVA are being met. 9. Conduct a Tukey HSD analysis for the differences in mean beak depth among the five islands. No plots are needed. Copy/paste your R commands and the resulting output into the green box below > TukeyHSD(aov(finchmodel)) Tukey multiple comparisons of means 95% family-wise confidence level Fit: aov(formula = finchmodel) $`island` dif Gran Canaria-El Hierro 0.8875000 La Gomera-El Hierro 0.1883333 La Palma-El Hierro 0.0400000 Tenerife-El Hierro 1.1177778
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
La Gomera-Gran Canaria -0.6991667 La Palma-Gran Canaria -0.8475000 Tenerife-Gran Canaria 0.2302778 La Palma-La Gomera -0.1483333 Tenerife-La Gomera 0.9294444 Tenerife-La Palma 1.0777778 lwrGran Canaria-El Hierro -0.14900527 La Gomera-El Hierro -0.91261148 La Palma-El Hierro -1.02459993 Tenerife-El Hierro 0.10366187 La Gomera-Gran Canaria -1.68108017 La Palma-Gran Canaria -1.78848229 Tenerife-Gran Canaria -0.65318457 La Palma-La Gomera -1.15985890 Tenerife-La Gomera -0.02880502 Tenerife-La Palma 0.16151604 upr Gran Canaria-El Hierro 1.92400527 La Gomera-El Hierro 1.28927815 La Palma-El Hierro 1.10459993 Tenerife-El Hierro 2.13189368 La Gomera-Gran Canaria 0.28274684 La Palma-Gran Canaria 0.09348229 Tenerife-Gran Canaria 1.11374013 La Palma-La Gomera 0.86319223 Tenerife-La Gomera 1.88769391 Tenerife-La Palma 1.99403951 p adj
Gran Canaria-El Hierro 0.1214169 La Gomera-El Hierro 0.9871150 La Palma-El Hierro 0.9999661 Tenerife-El Hierro 0.0250802 La Gomera-Gran Canaria 0.2611267 La Palma-Gran Canaria 0.0934014 Tenerife-Gran Canaria 0.9410514 La Palma-La Gomera 0.9928038 Tenerife-La Gomera 0.0607198 Tenerife-La Palma 0.0148442 10. In your own words, write your conclusions regarding which islands, if any, differ from one another with regard to the means of finch beak depths. Write your conclusions in the green box below. Here we notice that Tenerife has the largest mean whereas La Gomera and La Palma have the smallest means. However, the Tenerife versus El Hierro comparison is significant (P= 0.0250802) and so is Tenerife versus La Palma (P= 0.0148442). Since the rest exceed 0.05 (P>a) we would consider them boring and would lead to not rejecting the null hypothesis of equality of variances.
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