Sie sind auf Seite 1von 2

Assignment 1

Piaomu Liu

Due 09/12/2017
Total: 100 pts

The problems should be written up neatly and any output clearly labeled-
if I cannot read them I cannot grade them. The final write up should be your
own (Good rule of thumb: If a fellow student asks you to explain a problem
to them say yes, if they ask how you approached solving the problem say
no). Please show both R commands and outputs, unless stated otherwise.
1. Read sections 1.1- 1.10 of the textbook.
2. Work through The R Worksheet uploaded on Blackboard. Please also
see the R script file Lecture 2.R for R code. To open an R script file
you have previously saved on your laptop, open R and click File
Open script .
3. (50 pts)Textbook problem 1.62 (page 51). Please write down all steps
of a hypothesis test for part (a). Hint: download the Gasturbine.csv
file and import the file into R first! Please do not show the
dataframe you create in R.
4. (40 Pts)Consider the bodyfat.csv file. Complete the following tasks in
R:
(a) (6 pts)Create a dataframe called mydat by importing body-
fat.csv into R. R code only please!
(b) (6 pts) Produce a five-number summary for variable Knee.
(c) (6 pts) Produce a histogram for Knee as well. Please label your
graph appropriately.
(d) (6 pts) The standardized score is also referred to as zscore. For
a dataset of n observations, say x1 , x2 , , xn , the standardized
zscore for any observation xi is
xi x
z= ,
s

1
where x and s are the sample mean, and sample standard devia-
tion, respectively. From Introductory Statistics course, we know
the standardized z-scores have the following properties:
i. zscores are free of units;
ii. zscores have mean equal to 0;
iii. zscores have variance equal to 1;
iv. the larger a zscore is in magnitude, the more extreme the
corresponding observation is.
Next, we are going to use to extract information from mydat.
The R function scale() produce zscores for a given column of nu-
meric values. Use scale() to produce zscores for variable Knee.
Please show R code and zscores of the first five obser-
vations.
(e) (6 pts) What are the sample mean and standard deviation of
Knee? Use mean() and sd() to produce results. Do they match
with what you obtained from scale()?
(f) (6 pts) Which one is more unusual, a guy whose Knee circumfer-
ence is 33.9 cm or a guy whose Thigh circumference is 74.0 cm?
Why?
(g) (4 pts) What is the probability of observing a Thigh circumfer-
ence that is at least 74.0 cm? Hint: you could use R function
pnorm().

5. (10 pts) Continue working on mydat. Do the following (Do not


show R output, but describe R outputs in terms of rows and
columns):

(a) What does mydat[3,] produce?


(b) What does mydat[, 2:4] produce?

Das könnte Ihnen auch gefallen