Unformatted text preview:

Outline Preliminaries Proof of E S 2 2 2 2 Proof of Var X Y Var X Y X Y for X Y indep Lab Assignment 4 Due date 10 21 Email to Ms Kraus Lab4 Introduction to Statistical Simulations M George Akritas M George Akritas Lab4 Introduction to Statistical Simulations Outline Preliminaries Proof of E S 2 2 2 2 Proof of Var X Y Var X Y X Y for X Y indep Lab Assignment 4 Due date 10 21 Email to Ms Kraus Preliminaries Proof by Simulation Matrices in R The apply function Proof of E S 2 2 Proof of Var X Y Var X Y X2 Y2 for X Y indep Lab Assignment 4 Due date 10 21 Email to Ms Kraus M George Akritas Lab4 Introduction to Statistical Simulations Outline Preliminaries Proof of E S 2 2 2 2 Proof of Var X Y Var X Y X Y for X Y indep Lab Assignment 4 Due date 10 21 Email to Ms Kraus Proof by Simulation Matrices in R The apply function I A simulation consists of repeated generation of random samples and application of a statistical procedure on each sample I It is used for providing numerical evidence in support of or in contradiction to certain probabilistic statistical claims or simply for investigating properties of a statistical procedure I We will use simulations to verify that E S 2 2 while E S 6 I In the process we will also verify that 1 As the sample size n S 2 2 and S 2 For independent X1 X2 Var X1 X2 Var X1 X2 12 22 M George Akritas Lab4 Introduction to Statistical Simulations Outline Preliminaries Proof of E S 2 2 2 2 Proof of Var X Y Var X Y X Y for X Y indep Lab Assignment 4 Due date 10 21 Email to Ms Kraus Proof by Simulation Matrices in R The apply function New terminology Consistent and Unbiased estimators I I Because S 2 2 as n we say that S 2 is a consistent estimator of 2 S is also a consistent estimator of Because E S 2 2 we say that S 2 is an unbiased estimator of 2 I Because E S 6 S is a biased estimator of I All estimators used in statistics are consistent but some are biased I X is both consistent and unbiased estimator for and b p is both consistent and unbiased estimator for p M George Akritas Lab4 Introduction to Statistical Simulations Outline Preliminaries Proof of E S 2 2 2 2 Proof of Var X Y Var X Y X Y for X Y indep Lab Assignment 4 Due date 10 21 Email to Ms Kraus Proof by Simulation Matrices in R The apply function 1 The matrix command m matrix 1 10 nrow 2 ncol 5 I I I m matrix 1 10 nrow 2 m matrix 1 10 2 m matrix 1 10 ncol 2 m matrix 1 10 5 Try m 4 1 m 3 2 m 4 m 2 2 The cbind and rbind commands cbind m 1 m 2 rbind m 1 m 2 3 The transpose of a matrix t m 4 The diagonal matrix diag 1 4 or x 1 4 diag x 5 The identity matrix diag 3 diag c 1 1 1 diag rep 1 3 6 The inverse of a square matrix A solve A I I For example A matrix runif 9 1 5 3 solve A Note diag A returns the diagonal elements of the matrix A 7 Matrix multiplication A B Try A solve A M George Akritas Lab4 Introduction to Statistical Simulations Outline Preliminaries Proof of E S 2 2 2 2 Proof of Var X Y Var X Y X Y for X Y indep Lab Assignment 4 Due date 10 21 Email to Ms Kraus I I Proof by Simulation Matrices in R The apply function apply is an incredibly useful function for simulations i e for making the same calculation procedure repeatedly over many samples stored as the columns or rows of a matrix The apply function takes three arguments 1 the matrix you wish to apply the procedure to 2 either 1 or 2 depending on whether you are working on the rows or the columns and 3 the procedure you wish to apply I For example m matrix 1 10 ncol 2 m Try 1 apply m 2 sum apply m 1 sum 2 x apply m 2 sum sum x or simply sum apply m 2 sum NOTE A fundamental design feature of R is that the output from most functions can be used as input to other functions M George Akritas Lab4 Introduction to Statistical Simulations Outline Preliminaries Proof of E S 2 2 2 2 Proof of Var X Y Var X Y X Y for X Y indep Lab Assignment 4 Due date 10 21 Email to Ms Kraus I I The statement E S 2 2 allows the sample X1 Xn to come from any population distribution and n to be any integer 2 Recalling that expected values are approximated by averages numerical verification of E S 2 2 entails 1 Choosing any population distribution and any sample size n 2 Generate a large number say B of samples of size n from that distribution and calculate S 2 from each sample 3 Checking that the average of the S 2 values equals or is close to since we cannot make n the population variance 2 I Similarly E S 6 can be verified by checking that the corresponding average of the S values is not close to the population standard deviation M George Akritas Lab4 Introduction to Statistical Simulations Outline Preliminaries Proof of E S 2 2 2 2 Proof of Var X Y Var X Y X Y for X Y indep Lab Assignment 4 Due date 10 21 Email to Ms Kraus I Choose the N 0 1 distribution so that 2 1 I We will generate B 10 000 samples of size n 5 from the N 0 1 distribution m matrix rnorm 50000 ncol 10000 I Use mean apply m 2 var for the average of the 10 000 sample variances This should be close to 1 verifying the unbiasedness of S 2 I Use mean apply m 2 sd for the average of the 10 000 sample standard deviations This should not be so close to 1 verifying that S is biased M George Akritas Lab4 Introduction to Statistical Simulations Outline Preliminaries Proof of E S 2 2 2 2 Proof of Var X Y Var X Y X Y for X Y indep Lab Assignment 4 Due date 10 21 Email to Ms Kraus The five rows of the matrix m can be thought of as five samples of size n 10 000 I Use mean apply m 1 var for the average of the five sample variances This should be close to 1 verifying the consistency of S 2 I I Try also var m 1 for the sample variance of the first …


View Full Document
Loading Unlocking...
Login

Join to view Statistical Simulations and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Statistical Simulations and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?