statistics multi-part question and need the explanation and answer to help me learn.
please use R for questions asked for
5 questions with parts
please show all work for each part
and circle answer for each question
you must have R to complete this assigement
Lecture/text homework assignment # 9Note: Please circle your answers when appropriate!1) You measure the height of 10 male and 13 female hippopotamuses and get the following results. Is there a difference in weight? Use a Mann-Whitney U test with α = 0.05 (do NOT use R):Males: 986 1517 1524 1583 1620 1472 1552 1173 1748 1315Females:1412 1377 1289 1114 1157 869 1340 1094 1250 1409 1175 1176 12682) Now read the following data into R. Use R for all statistical procedures. Sample Sample A B 0.7969 1.4731 1.2669 3.2137 1.5856 2.2486 0.4959 1.1156 0.5022 10.6207 0.5524 1.983510.3060 31.2243 0.6244 3.7984 1.9789 1.4710 1.6788 9.0351(a) Make q-q plots of both samples.(b) Perform a t-test (Welch’s t-test).(c) Perform a MWU test.(d) Which test gave you the better p-value now? Why? (e) What is a “better” p-value? Why?
3) You measure the length of 5 radish seedlings at 7 days and 10 days and get the following results in mm (do NOT use R except for part (d)):seedling #:12345¯ys5 days:302038493233.810.6867 days:37 24 45 52 373910.464difference:-7 -4 -7 -3 -5-5.2 1.789(a) Is there a difference in length?(b) Repeat (a), but now use a regular (unpaired) t-test.(c) What happened in (b)?(d) Verify the normal distribution assumption for the paired t-test you did in (a). (You may use R for this part).4) Here are data on the lengths of male and female roaches (in mm). Your job is to find out if there is a difference between male and female roaches.males 9.8 16.1 15.0 20.2 12.5 9.8 6.2 18.8 12.4 10.3 14.3 14.0 12.8females16.7 16.3 12.8 16.9 15.1 12.8 18.7 18.3 8.6 13.6 15.3 16.2 13.4It’s up to you to figure out what the best procedure is, what kind of hypotheses to use, which α to use, what test to use, and so on. Make sure you follow all the appropriate steps. You should probably use R as you’ll get done much quicker. Remember to very clearly state your results in writing. Never turn in just an R printout.Hint: how do you decide which test to use? What kind of distributions do the data have?
5) You want to determine the effect of soap on bacterial colonies. In order to make sure that the environment does not affect your experiment, you divide 13 different petri dishes in half – one side is exposed to soap, the other is a control.You measure the number of colonies that grow in each petri dish and come up with the following results:petri dish 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15soap10 8 7 5 17 11 13 17 19 8 11 10 16 18 10 control18 17 11 17 26 18 21 25 24 17 17 17 21 24 20Perform a complete hypothesis test to see if there is a difference in bacterial colonies between the soap and control dishes.Again – notice that you are given no advice. You need to figure this out on your own, although this one should be a bit easier than (4). Feel free to use R to solve this problem, just make sure you don’t just hand in a printout. Be prepared to discuss these problems in recitation the week of October 30th.
Notes on using R.1) t-tests:Enter your data. If you don’t remember how to enter your data, check a previous homework or look at the R-notes posted on the 214 web page. Also remember that depending on how you’ve read your data into R, you may have to add “dataset$” in front of the examples below.The easiest way to do a t-test is as follows:t.test(y,x)where y is your first variable and x is your second variable. R defaults to Welch’s t-test.If, for some reason, you want to do an equal variance (classic) t-test, you can do:t.test(y,x, var.equal = TRUE)To do a paired t-test (make sure your data in y and x are paired appropriately:t.test(y,x, paired = TRUE)*************Next week you’ll be doing some one-sided tests (you can ignore this section until next week):To do a one sided test, you do:t.test(y,x, alternative = “less”)(obviously, you can also use “greater”)This option works with all of the above examples.*************2) q-q plotsJust give R the name of your variable you want to check. For example, if you’re doing a two sample testcomparing men vs. women, you would do:qqnorm(men)andqqnorm(women) (Aassuming your heights for men are in a variable named “men” and your heights for women are in a variable named “women”)
If you want to add a line to your qq plots, just repeat the above instructions exactly but change qqnorm to qqline. You need to do qqnorm first, and then qqline, for example:qqnorm(men)qqline(men)Remember that for a paired t-test you need to do one plot of the differences. Assuming your data are correctly arranged (paired) in two columns you can do:diff <- varname1 - varname2qqnorm(diff)qqline(diff)3) Mann-Whitney U tests:This is very similar to the t.test syntax above: wilcox.test(y,x)Where y is your response or measured variable, and x is your identifying variable.If R prints a warning message about not being able to print exact p-values, you can safely ignore it.If you want to do a one sided test, the syntax is exactly the same as for the t-test:wilcox.test(y,x, alternative = “less”)(or “greater”, of course)A comment about your test statistic (U*):For the Mann-Whitney U-test, R will not always give you the larger of the two values (K1 or K2). It'll always give you K1. If you want to get the actual U* (remember U* = max(K1,K2)), it's not difficult. You just need to remember that n1 x n2 = K1 + K2. So here's a summary:1) Calculate n1 x n22) Subtract “W” (what R gives you as a test statistic)3) pick the larger of W or what you got in # 2 - that's U*Okay, so it's not as easy as having U* printed out, but other programs (e.g., Minitab) don't even give you U* (it's not at all clear what Mintab gives you!).