hwk 1 - the inverse CDF solving the CDF in terms of x This...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
1) > f1<-rnorm(1000,3,2) > mean(f1) [1] 2.939143 > var(f1) [1] 4.228545 To find the mean and variance of g(x)=x^6, we find the sample mean of g(x) with x equaling the f1 values found from the random generated normal values. Using the naïve Monte Carlo simulation, we can use the sample mean of g(x) to decipher the mean and variance. R-code: > mean(f1^6) [1] 13430.96 > var(f1^6) [1] 1818601565 > mean((f1^6-mean(f1^6))^2) [1] 1816782964 2) We first generate 1000 random uniform random variables. We also are given the probability density function. We then integrate over the bounds of (0,x) to find the CDF. This integration will give us a F(x) value that equals y. Then we find
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: the inverse CDF solving the CDF in terms of x. This is then used to decipher the distribution of F. When performing the inverse CDF algorithm, we first integrate pdf to receive the CDF. We then have the CDF equal to y. We then isolate for x, so as to have an equation in terms of y. This is the inverse of CDF. This is then implemented into R to find the mean, median and variance of the x values. The work is shown below. R-code: > u=runif(1000) > x=5*((-log(1-u))^1/4) > mean(x) [1] 1.261994 > median(x) [1] 0.8143902 > var(x) [1] 1.670796...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online