Using programming language R Question 1: Conditional Expectations 2 points possible (graded) The heights dataset from the
Question:
Using programming language R
Question 1: Conditional Expectations
2 points possible (graded)
The heights dataset from the dslabs package (available from CRAN) contains self-reported heights (in inches) for male and female students from three Harvard Biostatistics classes:
# install.packages("dslabs") if needed library(dslabs) data(heights) head(heights)
## sex height ## 1 Male 75 ## 2 Male 70 ## 3 Male 68 ## 4 Male 74 ## 5 Male 61 ## 6 Female 65
For simplicity, round heights to the nearest inch:
heights$height <- round(heights$height)
Treat these data as data for the whole population.
A. Calculate the conditional probability that a person 67 inches tall is female.
B. Calculate the conditional probability that a person is female for the vector of heights hts = 60:80. Make a plot of this conditional probability versus hts. Suppose you predict female for any height for which the conditional probability of being female E(Y=FemaleIX=xis > 0.5. What is the maximum height for which you predict a person is female?
Computer Architecture Fundamentals And Principles Of Computer Design
ISBN: 9781032097336
2nd Edition
Authors: Joseph D. Dumas II