Statistics

Assignment 2: Estimating your height z-score

Instructions

Load the new data set on my website that contains information on heights and weights.

The data set has 25,000 observations of two variables:

  • height: Observed height (cm)
  • weight: Observed weight (kg)

We will only work with the variable height for this assignment.

Plot

First, generate the plot you see below. Use whatever colors you want and use the default number of bins (hint: Just remove the bins = "" command from the plot you generated in the first assignment)

Your z-score

To calculate the z-score for your height, you will first need to create objects that estimate the mean and standard deviation of the sample. You can create these by copying the following code:

mu <- mean(d$height)
sigma <- sd(d$height)

Now look in your environment (top right panel of RStudio and you will see that there are objects in the Values window for mu and sigma).

Task: Now create another object that is the z-score of your height specifically. Call the object z and you will need your height (x) to estimate it.

The z-score equation is:

\[ z = \frac{x-\mu}{\sigma} \]

and you can copy and paste the following code, and replace x with your height (in cm):

z <- (x - mu) / sigma

After you calculate your z-score, display your score in the console by using the print() command. My z-score is the following:

print(z)
## [1] 1.096729