[SOLVED] 代写 R C statistic theory Question A

30 $

File Name: 代写_R_C_statistic_theory_Question_A.zip
File Size: 357.96 KB

SKU: 4857080391 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


Question A
Laboratory I
Test01 v1 Probability 2018 November 08
Theory Question
StatisticsProbability for Data Science and

Check our slideset on Conditional ProbabilityIndependence:
Mutually: PAflBflCPAPBPC;
Pairwise: PAflBPAPB,andPAflCPAPCandPBflCPBPC;
Given 3 events, A, B and C, define what does it mean for them to be mutually, pairwise and conditionally independent.
Conditionally: For example PA fl BCPACPBC.
A box contains 100 coins. 60 of these coins are balanced and the remaining 40 are not. In particular, each of the unbalanced coin will give you an Head with probability 13. We run the following experiment: extract a coin at random from the box, flip it, observe the result, and then put the coin back into the box.
1. What is the probability to observe an Head?
Lets write the solution in terms of random indicator functions instead of events. So let
BI have selected a balanced coin and XIBY1 if B occurs; Then simply by the law of total probability we get 0 otherwise.
pPHeadPHeadX1PX1PHeadX0PX01 3 1 2 13 0.43. 2 5 3 5 30
kn 2. Find the probability of observing exactly k Head in n independent replications of the experiment
k 6 n. Is it a wellknown distribution? Use R to calculate this probability for k3 and n10.

it is clear that Sn is distributed as a Binomn, p0.43. Hence
PS103dbinom3, size10, prob0.430.19
Denoting by Sn the following random variable
SnNumber of Heads in n independent replications of the experiment,
10 3
3. Let N be a discrete uniform random variable over the set U1, 2, . . . , 100, and suppose to replicate the experiment N times i.e. a random number of times. Assuming to have observed Head exactly 3 times, find the probability of having flipped the coin N10 times.
1

We can simply use Bayes Theorem to get:
where
1 1 20.19 0.002
PS 3N 10PN 10 PN10S 3q100 N ,
N 3 100 100 100
N PS n1 N
3N nPN n
PS3N10PN101102p31p1031 1 2dbinom3, size10, prob0.43
q100 PS 3N nPN n1 1 2q100 PS 3N n1 1 2q100 1n2p31 n1 1N 2 100 n3 N 100 n3 3
pn31sumdbinom3, size3:100, prob0.430.023. 100
More directly
PN10SN3dbinom3, size10, prob0.43
0.08.
4. Write a simulation in R to check or get the answer to part 4.. Meaningfully comment the result.
sumdbinom3, size3:100, prob0.43
Simulation setup
M106Simulation size
p0.43Prob of Head
For reproducibility
set.seed123
Run
n.vecsample 1:100, sizeM, replaceT
s.vecsapply n.vec, functionx rbinomn1, sizex, probp
Table of proportion
idxwhichs.vec3when weve got 3 Heads
ttprop.table table n.vecidxdistribution of NSN3approxPlot
plottt, typeh, cex.axis.5, colgray.7, lty3,
xlabN, ylabFrequency pointsas.numericnamestt, ctt, pch21, bgyellow points10, tt10, pch21, bgred
ablineh0.08, colrgb1,0,0,.4, lwd2
In particular
tt10quite close to the theoretical value of 0.08
10
0.0821231
345678910 12 14 16 18 20 22 24 26 28 30 34
N
2
Frequency 0.00 0.04 0.08 0.12

Question B
Theory Question
Random variables can be discrete, that is, taking any of a specified finite or countable list of values, endowed with a probability mass function characteristic of the random variables probability distribution; or continuous, taking any numerical value in an interval or collection of intervals, via a probability density function that is characteristic of the random variables probability distribution.
Definition: Given a probability space , P, a random vector, or pvariate random variable, is any measurable mapping
X : Rp
that assigns a pdimensional vector XE to each individual outcome E.
Assuming that X, Yis a continuous random vector with joint density function fX,Y x, y, we have that X and Y are independent if and only if fX,Y x, yfX xfY y.
Check our slideset on Correlation, Linear Dependence and the Multivariate Normal Distribution: X,Yindependent X,Yuncorrelated,
the viceversa is true only for Gaussian random vectors. In all the other cases, the fact that X, Yare uncorrelated may just mean that their dependency if any is highly nonlinear.
X and Y have the following discrete joint pmf:
p x,yYcxy forx1,0,1, andy1,0,1,
X,Y 0 otherwise.
To start with, for the sake of simplicity lets unfold the joint pmf compactly defined above:
XY 1 0 1
1 0 c 2c 3c pX,Y x, y 0 c 0 c 2c 1 2c c 0 3c
3c 2c 3c 1
1. Determine the value of the constant c that makes the previous function a true joint pmf.
Summing up all the joint masses we must get 1 or even any marginal, so
y p x,y
x, y1 … 10c2cc021 … 8c1 … c1. X,Y 8
2. Determine the conditional distribution of XY0, its expectation and variance. By simply normalizing the second column of the table we get
3

PX1Y 0p
PX0Y 0pX,Y0,000,
1,0 1 1, X,Y 8
p0 2 2 Y8
p0 2 Y8
PX1Y 0pEXY 011 0011 0
1,0 1 1. X,Y 8
p0 2 2 Y8
Hence
VarXY 0EX2Y 0121 020121 1.
22 22
3. Find the covariance of X and Y .
We know that CovX, Y EXY EXEY , where
EXEY13 02 13 0; 888
EXY11pX,Y1,110pX,Y1,011pX,Y1,1 112 112 1.
882
Hence,
CovX, Y EXY1 . 2
4. Find the distribution of the random variable ZY 4 and calculate its median. Since Y1,0,1Z0,1 with pmf pZ given by
p 0PZ 0PY 0p 0 1; ZY4
p 1PZ1P1Y 1fiY 12p 1p 13. Z YY4
In other symbols, we can simply say that Z is Bernoulli with probability of success equal to p30.75. 4
Consequently its median, that is the value that cuts at its left at least 50 of the probability mass, is equal to 0.
Take a quick look
zc0,1
pzc14, 34
parmfrowc1,2
Plot PMF
plotz, pz, typeh, axesF,
colrgb0,0,0,.2, xlabz, ylabPMF axis1, z, c0, 1, cex.axis.75
pointsz, pz, pch19, colorange
Plot CDF
plotstepfunz, c0, cumsumpz, rightF,
xlimc1,2, axesFALSE,
do.pointsT, verticalsT, col.horblack, col.verrgb0,0,0,.2, col.pointsorange, pch19,
main, xlabz, ylabCDF
4

axis1, c1, z, 2, c, 0, 1, , cex.axis.75 axis2, c0, 12, 1, c0, 0.50, 1, cex.axis.75 ablineh.5, colrgb1,0,0,.4, lwd3
0101
zz
5
PMF
CDF
0 0.50 1

Question C
This is essentially Exercise 6 from the Exercises from remote corners of the multiverse section of
TrainSetP102.
Hence, suppose that a married couple is selected at random from a certain population married couples. . .and that the joint distribution of Wthe height of the wife and Hthe height of her husband is a bivariate normal distribution.
Suppose that the heights of the wives have a mean of W170 cm and a standard deviation of W4 cm, the heights of the husbands have a mean of H178 cm and a standard deviation of H2 cm, and the correlation between these two heights is fl0.68.
1. If I tell you that, in our randomly selected couple, the wife is 173 cm tall, what is the best mse prediction for the height of her husband? What about the reliability of this prediction? Explain and, possibly, quantify.
From the set of notes on conditional expectation, we know the optimal predictor is the conditional mean of X given Y , but they are bivariate Normal so from the cheatsheet we get
EH W173cm H fl173cm 178cm2cm 0.68173cm178cm176.3cm H W 4cm
2. What is the probability that, in the randomly chosen couple, the wife is taller than the husband?
We must determine the value of PWH0. Since W and H have a bivariate Normal distribution, it follows that the distribution of WH will be univariate Normal, with mean
EW HEWEH170cm178cm8cm
2VarWHVarWVarH2CovW,HW2 H2 2flWH
and variance
42 22 20.68429.12cm2.
Hence the standard deviation ofis O9.123.02 cm. So, N,2 , and the probability we are looking for is given by
P01P01pnorm0, 8, 3.020.004, . . . quite rare indeed.
. . . of
W
6

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 代写 R C statistic theory Question A
30 $