This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: variance is 1.542219. 3 Problem 3 CDF: If 0 ≤ x ≤ 1, then F ( x ) = R x tdt = x 2 2 . If 1 < x ≤ 2, then F ( x ) = R 1 tdt + R x 1 2tdt = 1 2(2t ) 2 2  x 1 = 1( x2) 2 2 . Inverse CDF: If 0 ≤ u ≤ 1 2 , then u = x 2 2 ⇒ x = ± √ 2 u . Because 0 ≤ x ≤ 1, we have x = √ 2 u . If 1 2 < u ≤ 1, then u = 1( x2) 2 2 ⇒ 2 u2 =( x2) 2 ⇒ x = 2 ± √ 22 u . Because 1 < x ≤ 2, we have x = 2√ 22 u . Algorithm: Step1: generate random sample u from uniform(0,1). Step2: plug u into the inverse CDF function. R code: u=runif(1000) x=rep(0,1000) x[u<=0.5]=sqrt(2*u[u<=0.5]) x[u>0.5]=2sqrt(22*u[u>0.5]) 2...
View
Full
Document
This note was uploaded on 10/24/2010 for the course STAT 428 taught by Professor Chen during the Spring '08 term at University of Illinois, Urbana Champaign.
 Spring '08
 Chen
 Variance

Click to edit the document details