- 1 (85.76 KiB) Viewed 33 times
10. (6 pts) Complete the following code to calculate the z-score for an array. Z₁ = (X₁-μ)/o, where μ is the mean and is
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
10. (6 pts) Complete the following code to calculate the z-score for an array. Z₁ = (X₁-μ)/o, where μ is the mean and is
10. (6 pts) Complete the following code to calculate the z-score for an array. Z₁ = (X₁-μ)/o, where μ is the mean and is the standard deviation of X # the input is an array, and the output is an array of z-score. Please do not define it using stats.zscore(). import numpy as np def zscore(array): 11. (10 pts) Correlation: The Pearson correlation is defined based on the z-score. If we have two sets of data X= [X1, X2, X3, ..., Xn] and Y= [y₁, y2, y3, ..., yn]. Their means and standard deviations are μx, Hy, Ox, and σy. a. (4 pts) What do the values -1, 0, and 1 of the correlation coefficients p indicate? 3 b. (6 pts) Why is the Pearson correlation coefficient sensitive to outliers, but not the Spearman rank correlation coefficient? 12. Use the theorem of total probability and Bayes theorem to solve the following problem. (15 pts) Theorem of total probability: P(A)=P(A/B₁)*P(B₁)+ P(A|B₂)*P(B₂)+...+ P(A/B)*P(B₂), where the sample space S=B₁UB₂ U... B₁ and B₁, B₂2,..., B₁ are mutually exclusive. Bayes theorem: P(B|A) = P(A/B) *P(B)/P(A) A box of dices: 98% fair, 2% loaded (50% at six). If we get 5 six in a row, what's the chance that the die is loaded? (The intermediate steps are optional, but it will help you to get partial credits if your choice is wrong). A. 0.71 B. 0.21 C. 0.83 D. 0.02