## [answered] Microsoft Word - 420HwIV.doc 1.

Microsoft Word - 420HwIV.doc

1.

Suppose that the height ( X ) ( in inches ) and the weight ( Y ) ( in pounds ) of female students at Anytown State University follows a bivariate normal distribution with

? 1 = 65, ? 1 = 2, ? 2 = 130, ? 2 = 12, ? = 0.60.
Suppose also that the height ( X ) ( in inches ) and the weight ( Y ) ( in pounds ) of male

students at Anytown State University follows a bivariate normal distribution with ? 1 = 69, ? 1 = 2.5, ? 2 = 170, ? 2 = 15, ? = 0.60.

Write your own R function that simulates a Bivariate Normal distribution. ( There are R functions that do that, for example, mvrnorm from MASS or rmvnorm from mvtnorm. Do NOT use these, write your own! ) The input should be a positive integer n, and five real numbers ?1, ?2, ?1, ?2, ? (?1, ?2 > 0). The output should be a data frame with two variables, x and y. The function should be called yourNetID. For example, mine would be called stepanov:

a)

Hint1:

Hint 2:

11 2?1()2 1

> stepanov = function(n,m1,m2,s1,s2,r) { ? ? ? }
If X~N(? ,?2 ), then Y~N(? + ??2 (x?? ), 1??2 ??2 ).

OR If Y~N(? ,?2 ), then X~N(? + ??1 (y?? ), 1??2 ??2 ). 22 1?2()1

2
To create a data frame: data.frame(x,y).

b) Simulate heights and weights of 100 female students and heights and weights of 100 male students.

`> par(mfrow=c(2,2)) `

c) Make four probability histograms: female height female weight male height male weight

For each probability histogram, overlay the corresponding normal distribution density function.

d) Combine the heights of female students and the heights of male students into height. Combine the weights of female students and the weights of male students into weight. Create a dummy variable gender ( 1 for females, 0 for males ) that matches height and weight.

`> par(mfrow=c(1,1))`
1. e) ?Plot weight ( y ) vs height ( x ) using different symbols for females and males.
2. f) ?Fit a linear model that predicts a student?s weight using student?s height and gender as the predictors.
1. i) ?Test H0: ?gender=0 vs H0: ?gender?0 at ?=0.05.
2. ii) ?Add the two parallel lines representing the model fit to the plot from part (e).
3. g) ?Fit a linear model that predicts a student?s weight using student?s height as the predictor.

i) ii)

Add the thin dashed least squares regression line to the plot from part (e).

Compute the sample correlation coefficient between the students? heights and weights. (Doestheanswersurpriseyou?)

cor( ... , ... ).

1. h) ?Fit a logistic regression model to predict the student?s gender using student?s height and weight as the predictors.
2. i) ?Suppose that Pat is 67 inches tall and weighs 145 pounds. What is the ( predicted ) probability that Pat is a female?
3. j) ?Fit a logistic regression model to predict the student?s gender using student?s height as as the predictor.

?Hint?:

1. k) ?Use part (j) to plot the estimated logistic mean response function ( the relationship between the predicted probability of a student being a female and a student?s height ) on the range from 55 to 75 inches. ( Obviously, the range on the y-axis is from 0 to 1. )
2. l) ?Fit a logistic regression model to predict the student?s gender using student?s weight as as the predictor.
3. m) ?Use part (l) to plot the estimated logistic mean response function ( the relationship between the predicted probability of a student being a female and a student?s weight ) on the range from 100 to 200 pounds.
4. n) ?Which model ( out of part (h) model, part (j) model, and part (l) model ) do you prefer? Justify your answer.

Solution details:
STATUS
QUALITY
Approved

This question was answered on: Sep 18, 2020 Solution~0001013841.zip (25.37 KB)

This attachment is locked

We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free copy from our tutoring website www.aceyourhomework.com (Deadline assured. Flexible pricing. TurnItIn Report provided)

##### Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .

STATUS

QUALITY

Approved

Sep 18, 2020

EXPERT

Tutor 