Publications by Dimple K. Patel

Chapter 15 (Part 1) Exercises

23.04.2024

15.3 Exercises 1. Suppose you poll a population in which a proportion \(𝑝\) of voters are Democrats and \(1βˆ’π‘\) are Republicans. Your sample size is \(N=25\). Consider the random variable \(S\) which is the total number of Democrats in your sample. What is the expected value of this random variable? Hint: it’s a function of \(p\). \(E...

2206 sym 4 img

HarvardX: PH125.1x

21.04.2024

14.12 Exercises 1. Create a random variable \(S\) with the earnings of your bank if you give out 10,000 loans, the default rate is 0.03, and you lose $200,000 in each foreclosure. Hint: use the code we showed in the previous section, but change the parameters. n<-10000 loss_per_foreclosure<--200000 p_default<-.03 set.seed(1) defaults<-sample...

900 sym 1 img

HarvardX: PH125.1x

21.04.2024

14.10 Exercises 1. In American Roulette you can also bet on green. There are 18 reds, 18 blacks and 2 greens (0 and 00). What are the chances the green comes out? g<-2 bl<-18 r<-18 p_green<-g/(g+bl+r) p_green ## [1] 0.05263158 2. The payout for winning on green is $17 dollars. This means that if you bet a dollar and it lands on green, you g...

2692 sym

HarvardX: PH125.1x

17.03.2024

13.13 Exercises 1. Assume the distribution of female heights is approximated by a normal distribution with a mean of 64 inches and a standard deviation of 3 inches. If we pick a female at random, what is the probability that she is 5 feet or shorter? library(tidyverse) ## ── Attaching core tidyverse packages ───────────...

2867 sym R (1134 sym/17 pcs) 1 img

HarvardX: PH125.1x

04.03.2024

13.9 Exercises 1. One ball will be drawn at random from a box containing: 3 cyan balls, 5 magenta balls, and 7 yellow balls. What is the probability that the ball will be cyan? cyan<-3 magenta<-5 yellow<-7 allballs<-cyan+magenta+yellow pr<-cyan/(cyan+magenta+yellow) 2. What is the probability that the ball will not be cyan? prnot<-1-pr 3. Ins...

2704 sym 2 img

HarvardX: PH125.1x

21.02.2024

12.10 Exercises 0. We are going to use the HistData package. If it is not installed you can install it like this: install.packages("HistData") Load the height data set and create a vector x with just the male heights used in Galton’s data on the heights of parents and their children from his historic research on heredity. library(HistData) d...

1255 sym R (5903 sym/17 pcs)

HarvardX: PH125.1x

20.02.2024

Section 12.8 1. Define variables containing the heights of males and females like below How many measurements do we have for each? library(dslabs) data(heights) male<-heights$height[heights$sex=="Male"] female<-heights$height[heights$sex=="Female"] 238 females in the female dataset; 812 males in the male dataset. 2. Suppose we can’t make ...

3163 sym R (2349 sym/14 pcs) 1 img

HarvardX: PH125.1x

20.02.2024

Section 12.3 1. In theΒ murdersΒ dataset, the region is a categorical variable and the following is its distribution. To the closest 5%, what proportion of the states are in the North Central region? 25% of states are in North Central region. 2. Which of the following is true?: B. The graph above shows only four numbers with a bar plot. 3. The...

1432 sym 6 img

HarvardX: PH125.1x

20.02.2024

Section 11.15 1. Reproduce the image plot we previously made but for smallpox. For this plot, do not include years in which cases were not reported in 10 or more weeks. library(tidyverse) ## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ── ## βœ” dplyr 1....

647 sym R (3570 sym/15 pcs) 5 img

HarvardX: PH125.1x

19.02.2024

Section 11.13 For these exercises, we will be using the vaccines data in the dslabs package: library(dslabs) library(ggplot2) library(dplyr) ## ## Attaching package: 'dplyr' ## The following objects are masked from 'package:stats': ## ## filter, lag ## The following objects are masked from 'package:base': ## ## intersect, setdiff...

1979 sym R (5517 sym/15 pcs) 8 img