Homework-3.pdf - Homework 3 Stats 20 Lec 1 and 2 Fall 2019 General Guidelines Please use R Markdown for your submission Include the following files •

# Homework-3.pdf - Homework 3 Stats 20 Lec 1 and 2 Fall 2019...

• Homework Help
• 5

This preview shows page 1 - 2 out of 5 pages.

Homework 3 Stats 20 Lec 1 and 2 Fall 2019 General Guidelines Please use R Markdown for your submission. Include the following files: Your .Rmd file The compiled/knitted HTML or PDF document (do not knit to Word). The knitted document should be clear, be well-formatted, and contain all relevant R code, output, and explanations. Please read and review the Bowdoin Computer Science Department collaboration policy: Collaboration on this homework must adhere to the Level 1 collaboration policy described at the above link. EVERYTHING you submit MUST be 100% your original work product. Any student suspected of plagiarizing, in whole or in part, any portion of this assignment, will be immediately referred to the Dean of Students office without warning. Question 1 Suppose Andy Dwyer tracks his commute time to his women’s studies class for ten days and records the following times (in minutes): 17 16 20 24 22 15 21 15 17 22 (a) On which days did Andy have a commute time that was more than one standard deviation away (longer or shorter) from the average (mean) commute time? What were those commute times? (b) On which days did Andy have a commute time that within one standard deviation (longer or shorter) of the mean commute time? What were those commute times? (c) What proportion of days did Andy have a commute time that was within one standard deviation of the mean commute time? Hint : Can arithmetic operators/functions for numeric vectors work for logical vectors? What do sum() and mean() compute for logical vectors? Question 2 Using seq() and rep() as needed, create the following vectors in R. (a) 0 0 0 0 0 0 1 1 1 1 1 1 2 2 2 2 2 2 3 3 3 3 3 3 4 4 4 4 4 4 (b) 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 (c) 1 2 3 4 5 6 2 3 4 5 6 7 3 4 5 6 7 8 4 5 6 7 8 9 5 6 7 8 9 10 (d) Write two functions, each with two arguments x and n , that will extend the patterns in (a) and (b). In particular, the argument x should specify the maximum number in the sequence, and n should specify the number of times each number is repeated. Verify that your functions work to generate the sequences in (a) and (b).

#### You've reached the end of your free preview.

Want to read all 5 pages?

• Summer '15
• ALMOHALWAS

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern