R — Biostatistics

R7 — Sampling Distribution

By


This homework set is based on Lesson 7Sampling Distributions.  

You need to watch the video in Lesson 7 BEFORE you do this homework set.

 

I. Goals:

1) Create a random sample from the population:

sample()

2) Display length of an object

length()

2) Repeat sampling

replicate()

3) Display plots in a certain format on one single page

par(mfrow=c())

 

 

II. What to upload to Canvas for the R?? assigment?

You ONLY need to upload your R script to Canvas by the due date and time:

      • R script (.R)

 

Important: What the grader and I will do is to run your .R script on our computer to generate the result. So make sure your .R script works!

The best way for you is to check if your script works or not is to do the following:

    • After you have uploaded your script to Canvas, log out of Canvas and then log back into Canvas. Download your .R script and run it on your RStudio to see if it works!

 

III. What to do for this assignment

  • Create one .R script to display 4 histograms on one single page in a 2 by 2 format.

 

Here are the Details:

1) Come up with a quantitative variable and the population data different than the the example shown in the video

      • Be creative! Don’t just copy my example. Come up with something DIFFERENT than the example shown in the video — you will NOT receive full credit if your variable is TOO SIMILAR to mine — e.g. “heights of students” is TOO SIMILAR to my example!
      • Your variable can be biology-related (but it doesn’t have to be).
      • Create a set of population data with the following requirements:
        • there should be 60 to 80 individual observations (you’ll need to include the command length() in your R script so that the grader can check if you have the correct amount of observations).
        • the distribution of the data is skewed  (i.e. left-skewed or right-skewed)

 

2) Create 3 sampling distributions (each sampling distribution has 100 samples but each sampling distribution has a different sample size)

        • n = 2
        • n = 6
        • n = 30

 

3) Display the following histograms in a 2 by 2 format (i.e. 2 rows and 2 columns)

        • histogram of the population
        • histogram of the sampling distribution of sample size 2
        • histogram of the sampling distribution of sample size 6
        • histogram of the sampling distribution of sample size 30

 

4) To receive full credits, your R script needs to satisfy the following:

      • At the top of your R script, use # to:
        • Type your name 
        • Type a sentence or two to explain what the population  variable you have
        • State what the units of measurement are
        • It is optional to include other information such as assignment name, etc.
        • Show clearly how you use the following commands:
            • length()
            • sample()
            • replicate()
            • hist()
            • par()

5) Upload the following item to Canvas by the due date and time.

        • R script (.R)

-END-



Content is copyright the author. Layout is copyright Mark Ciotola. See Corsbook.com for further notices.