Test 2 review UPDATED and with added material (corrected answer sheet)

Test 2 is rescheduled for the first hour or so of class on Monday 26 March.

Test 2 review problems

Corrected answers:

MAT2572Test2ReviewAnswersSpring2018

Below the fold are worked-out solutions to the first few problems, similar to what I did in class. They use the basic counting techniques which are described in these notes: MAT2572CountingMethods-slideshow

Continue reading

Winter Storm Warning (again)

There is a winter storm warning for the region starting tonight through Thursday.

 

I recommend checking the college website to find out the status of classes. I, myself, cannot cancel class.

Also, sign up for CUNY alerts, but they seem to  run slow. Checking the college website or your City Tech email seems to be the best.

Notes for Wednesday 14 March

Math2501ExpectedValueForRVs-slideshow

 

MAT 2572                                                      Basic Histograms for PDFs in R

 

 

 

The basics: for a RV X with possible values a, b, …, n

 

Assign the values of the probabilities as a vector

(I’ll call it my_distribution, which is really not a very good name)

Then those probabilities will be the heights of the bars

The command barplot gives the bar graph

 

> my_distribution <- c(p(a), p(b), …, p(n))

> barplot(my_distribution)

 

But this gives a bar graph with space between the bars. To make it a histogram, we make the space between the bars be 0:

 

> barplot(my_distribution, space=0)

 

barplot also has a color attribute col, which can be set like this:

 

> barplot(my_distribution, space=0, col=“blue”)

 

Experiment with the col attribute to see which colors R will recognize!

(It’s not always a good idea to put colors in graphs, because of readability and psychological issues though.)

 

To put labels on the graph (for the values of X), If the values run through a consecutive sequence of integers a through n

> names(my_distribution) <- as.character(a:n)

 

 

Saving your work as a script:

menu at upper left corner

 

 

Exporting the graph to use it in a document, for example:

Plots > export…

https://support.rstudio.com/hc/en-us/articles/200484448-Editing-and-Executing-Code

Homework for Wednesday 14 March

 

Notes from Monday’s class are in this post.

• Don’t forget to keep working on your Datacamp assignments!

• Do the following from the textbook:

p. 128 #3.3.1, 3.3.2,  3.3.3, 3.3.5, 3.3.7

Note: $p_{X}(k)$ is another notation for $P(X = k)$, in other words the probability distribution function.

p. 138 # 3.4.1, 3.4.3, 3.4.5, 3.4.7, 3.4.11, 3.4.13

Note: problems 11 and 13 give you the cdf, not the pdf, so it sould be easy to compute those probabilities!

 

• There will be a Quiz on Wednesday. It will be based on one of the homework problems mentioned above.

 

Don’t forget, if you get stuck on a problem, you can post a question on Piazza. Make sure to give your question a good subject line and tell us the problem itself – we need this information in order to answer your question. And please only put one problem per posted question!

 

Monday 12 March class

Topics:

Cumulative distribution functions

Continuous random variables and their probability densities (MAT2572RVsAndTheirPDsNotesContinuousCase)

Cumulative distribution function for a continuous RV = the antiderivative of the probability density (being careful of domain)

 

Brief notes on cumulative distribution functions:

Definition: For a random variable $X$, the cumulative distribution function (cdf) $F(x)$ is a function with domain the set of all real numbers, such that

$F(x) = P(X\le x)$

Note: Capital $X$ is the name of  the random variable. Lower-case $x$ is the input to the function, that is, it represents some real number.

Facts about cdfs:

• For any type of random variable (discrete or continuous), $F(x)$ is a nondecreasing function.

• $\displaystyle \lim_{x\rightarrow -\infty}F(x) = 0$ and $\displaystyle \lim_{x\rightarrow \infty}F(x) = 1$

• If $X$ is a discrete (finite or infinite) RV, $F(x)$ is a step function with jumps at the possible values of $X$.

The use of the cdf: For any real numbers $a$ and $b$, $a\le b$,

$P(a \le X < b) = F(b) – F(a)$

Often (especially for continuous RVs) it is much easier to compute probabilities using the cdf rather than the pdf!

 

Winter Storm Warning, and which cities have the most unpredictable weather?

A winter storm warning has been issued for the region including NYC, beginning tonight and extending to Thursday. It is not clear right now (as I write) how and how badly NYC will be affected. It’s a good idea to monitor the situation – check weather forecasts as the storm approaches tonight.

Also, if you have not already done so, it’s a good idea to sign up for CUNY Alerts. You can do that here.

 

Here is an interesting application of statistical analysis: Which city has the most unpredictable weather? (from FiveThirtyEight). Spoiler alert: It’s not NYC.

Homework for Wednesday 7 March

For the notes from Monday’s class, see this post.

 

Homework:

• Don’t forget to keep working on the R assignments in Datacamp! You can keep working on them even after the due date:  just don’t let them pile up until the end of the semester!

• Make sure to do the problems assigned last time.

• For the experiment “Flip a coin until heads shows”, if the coin is unbalanced so that $P(H) = \frac{3}{5}$, find the probability distribution function for the random variable X = the number of tails, and show that the probabilities add up to 1.

Note: The sum of the geometric series $\displaystyle \sum_{k=0}^{\infty}ar^{k} = \frac{a}{1-r}$ if $|r| < 1$

• Find the probability distribution function for the random variable Y = the number of even numbers that show on the dice, for the experiment “roll two balanced dice”

• There will be a Quiz on Wednesday. It will be based on one of the homework problems mentioned above (including from last time).

 

Don’t forget, if you get stuck on a problem, you can post a question on Piazza. Make sure to give your question a good subject line and tell us the problem itself – we need this information in order to answer your question. And please only put one problem per posted question!

 

Monday 5 March class

 

Topics:

• Counting permutations when there are indistinguishable elements

• Discrete Random Variables

Here are my notes on discrete random variables:

MAT2572RVsAndTheirPDsNotesDiscreteCase

Homework will be in a separate post.

 

If you are defining a random variable, the important thing is that you should be able to look at any outcome in the sample space and say what  number goes with that outcome.

I could  define a different random variable for the example of rolling two balanced dice, as follows:

Y = the number of even numbers that show on the dice.

Then for the outcome (1,1), Y=0, and for the outcome (2,3), Y=1. The value of Y depends on the outcome of the random experiment.

The possible values of Y are 0, 1, and 2

Exercise: find the pdf for Y