[Solved] AMS 597 Homework 5

$25

File Name: AMS_597_Homework_5.zip
File Size: 169.56 KB

SKU: [Solved] AMS 597 Homework 5 Category: Tag:
5/5 - (1 vote)

AMS597

  1. Using only random uniform generator, generate a random sample of size 1000 from the F distribution with 5 and 10 degrees of freedom. (Hint: If X 2a and Y 2b, X and Y are independent, then follows F distribution with a and b degrees of freedom.)
  2. One disadvantage of Box-Muller algorithm is that it requires computing sine and cosine functions. By some transformation, one can show that the following closely related algorithm also generates independent standard normal random variables X and Y .
    • Generate U1 U(0,1) and U2 U(0,1)
    • Set V1 = 2U1 1 and.
    • If S > 1, return to (a).
    • Otherwise,

This method is called the polar method. Use this method to generate 10000 standard normal random variables.

  1. A t-distributed random variable of k degrees of freedom is defined as

where Z N(0,1) and W 2k, Z and W are independent. Using only the uniform number generator in R (runif), generate 100 random samples X, where X is a mixture t distribution, i.e., X 0.3t3 + 0.35t5 + 0.35t7.

  1. Write your function rmultivarNorm(n,mu,Sigma) which will generate n multivariate normal random variables using only runif.
  2. Write your own function ls() which performs the least square estimation for a continuous response variable y regressed on two predictors x1 which is a numeric predictor and x2 which is a categorical predictor. You may assume that your model contains an intercept. Test your function on the ChickWeight dataset in R, where y is weight, x1 is

Time (assumed to be continuous) and x2 is Diet, i.e., check if your function can reproduce the estimated beta coefficients from

data(ChickWeight) fit <- lm(ChickWeight$weight~ChickWeight$Time+ChickWeight$Diet) fit$coef

  1. Use the mcycle data in the MASS package for this problem (see Homework 3 Qn 5).

Instead of fitting polynomial regression, fit an additive model using splines to this dataset.

Compare the MSE of the spline model to the polynomial regression model, where MSE = is the observed response variable and Yi is the predicted response

variable.

Reviews

There are no reviews yet.

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

Shopping Cart
[Solved] AMS 597 Homework 5
$25