Docsity

Statistical Computing: Simulation Studies -Study Guide | 22S 166, Study notes of Statistics

Toggle sidebar
bg1
22S:166 Computing in Statistics
Simulation studies in statistics
Lecture 12
October 2, 2006
Based on a lecture by Marie Davidian for
ST 810A - Spring 2005
Preparation for Statistical Research
North Carolina State University
http://www4.stat.ncsu.edu/ davidian/st810a/
1
Basics
•simulation studies are commonly done to evaluate the
performance of a frequentist statistical procedure, or to
compare the performance of two or more different
procedures for the same problem
•enable us to see what happens “when many many
samples of the same size are drawn from the same
population”
•properties of estimators that are often evaluated by
simulation
–bias
–mean squared error
–coverage of confidence intervals
•properties of hypothesis tests also can be evaluated by
simulation studies
–size
–power
•simulation studies are experiments, and the things you
know about experimental design and sample size
calculation apply
2
Terminology
•simulation: a numerical technique for conducting
experiments on the computer
•Monte Carlo simulation: a computer experiment
inolving random sampling from probability
distributions
–what statisticians usually mean by “simulations”
3
Rationale
•Properties of statistical methods must be established
before the methods can safely be used in practice.
•But exact analytical derivations of properties are rarely
possible
•Large sample approximations to properties are often
possible
–evaluation of the relevance of the approximation to
(finite) sample sizes likely to be encountered in
practice is needed
•Analytical results may require assumptions such as
normality
–What happens when these assumptions are
violated? Analytical results, even large sample ones,
may not be possible
4
pf3
pf4
pf5

Partial preview of the text

Download Statistical Computing: Simulation Studies -Study Guide | 22S 166 and more Study notes Statistics in PDF only on Docsity!

22S:166 Computing in Statistics Simulation studies in statistics Lecture 12 October 2, 2006

Based on a lecture by Marie Davidian for ST 810A - Spring 2005 Preparation for Statistical Research North Carolina State University http://www4.stat.ncsu.edu/ davidian/st810a/

1

Basics

  • simulation studies are commonly done to evaluate the performance of a frequentist statistical procedure, or to compare the performance of two or more different procedures for the same problem
  • enable us to see what happens “when many many samples of the same size are drawn from the same population”
  • properties of estimators that are often evaluated by simulation - bias - mean squared error - coverage of confidence intervals
  • properties of hypothesis tests also can be evaluated by simulation studies - size - power
  • simulation studies are experiments, and the things you know about experimental design and sample size calculation apply

2

Terminology

  • simulation: a numerical technique for conducting experiments on the computer
  • Monte Carlo simulation: a computer experiment inolving random sampling from probability distributions - what statisticians usually mean by “simulations”

Rationale

  • Properties of statistical methods must be established before the methods can safely be used in practice.
  • But exact analytical derivations of properties are rarely possible
  • Large sample approximations to properties are often possible - evaluation of the relevance of the approximation to (finite) sample sizes likely to be encountered in practice is needed
  • Analytical results may require assumptions such as normality - What happens when these assumptions are violated? Analytical results, even large sample ones, may not be possible

Questions to be addressed regarding an estimator or testing procedure

  • Is an estimator biased in finite samples? What is its sampling variance?
  • How does it compare to competing estimators on the basis of bias, precision, etc.?
  • Does a procedure for constructing a confidence interval for a parameter achieve the claimed nominal level of coverage?
  • Does a hypothesis testing procedure attain the claimed level or size?
  • If so, what power is possible against different alternatives to the null hypothesis? Do different test procedures deliver different power?

5

Role of Monte Carlo simulation

  • Goal is to evaluate sampling distribution of an estimator under a particular set of conditions (sample size, error distribution, etc.)
  • Analytic derivation of exact sampling distribution is not feasible
  • Solution: Approximate the sampling distribution through simulation - Generate S independent data sets under the conditions of interest - Compute the numerical value of the estimator/test statistic T (data) for each data set, yielding T 1 ,... , TS
  • If S is large enough, summary statistics across T 1 ,... , TS should be good approximations to the true sampling properties of the estimator/test statistic under the conditions of interest

6

Simulation for properties of estimators

Simple example: Compare three estimators for the mean μ of a distribution based on i.i.d. draws Y 1 ,... , Yn

  • Sample mean T (1)
  • Sample 20% trimmed mean T (2)
  • Sample median T (3)

Remarks:

  • If the distribution of the data is symmetric, all three estimators indeed estimate the mean
  • If the distribution is skewed, they do not

Simulation procedure

For a particular choice of μ, n, and true underlying distribution

  • Generate independent draws Y 1 ,... , Yn from the distribution
  • Compute T (1), T (2), T (3)
  • Repeat S times ⇒ T 1 (1) ,... , T (^) S(1) ; T 1 (2) ,... , T (^) S(2) ; T 1 (3) ,... , T (^) S(3)
  • Compute for k = 1, 2 , 3

mean =̂ S−^1 ∑S s=1 T^ s( k)=^ T^ (k),^ bias =̂^ T^ (k)^ −^ μ

SD =̂

√√√ √√√(S − 1)− 1 ∑S s=1(T^ s( k)− T (k))^2 ,

MSE =̂ S−^1 ∑S s=1(T^ s( k)−^ μ)^2 ≈^ SD̂^2 +^ biaŝ^2

Performance of estimates of uncertainty

How well do estimated standard errors represent the true sampling variation?

  • E.g., For sample mean T (1)(Y 1 ,... , Yn) = Y SE(Y ) =

s √ n

, s^2 = (n − 1)−^1 ∑n j=

(Yj − Y )^2

  • MC standard deviation approximates the true sampling variation
  • Compare average of estimated standard errors to MC standard deviation

For sample mean: MC standard deviation

outsampmean <- apply(out$dat,1,mean)

sampmean.ses <- sqrt(apply(out$dat,1,var)/n)

ave.sampmeanses <- mean(sampmean.ses)

round(ave.sampmeanses,3) [1] 0.

13

Usual 100(1-α)% confidence interval for μ:

Based on sample mean [ Y − t 1 −α/ 2 ,n− 1

s √ n

, Y + t 1 −α/ 2 ,n− 1

s √ n

]

  • Does the interval achieve the nominal level of coverage 1 − α?
  • E.g. α = 0. 05

t05 <- qt(0.975,n-1) coverage <- sum((outsampmean-t05nsampmean.ses <= mu) & (outsampmean+t05nsampmean.ses >= mu))/S coverage [1] 0.

14

Simulations for properties of hypothesis tests

Simple example: Size and power of the usual t-test for the mean

H 0 : μ = μ 0 vs. H 1 : μ 6 = μ 0

  • To evaluate whether size/level of test achieves advertised α generate data under μ = μ 0 and calculate proportion of rejections of H 0
  • Approximates the true probability of rejecting H 0 when it is true
  • Proportion should ≈ α
  • To evaluate power, generate data under some alternative μ 6 = μ 0 and calculate proportion of rejections of H 0
  • Approximates the true probability of rejecting H 0 when the alternative is true (power)
  • If actual size is > α, then evaluation of power is flawed

Size/level of test:

set.seed(3); S <- 1000; n <- 15; sigma <- sqrt(5/3) mu0 <- 1; mu <- 1 out <- generate.normal(S,n,mu,sigma) ttests <-

  • (apply(out$dat,1,mean)-mu0)/sqrt(apply(out$dat,1,var)/n)

t05 <- qt(0.975,n-1) power <- sum(abs(ttests)>t05)/S power [1] 0.

Power of test:

set.seed(3); S <- 1000; n <- 15; sigma <- sqrt(5/3)

mu0 <- 1; mu <- 1.

out <- generate.normal(S,n,mu,sigma)

ttests <-

  • (apply(out$dat,1,mean)-mu0)/sqrt(apply(out$dat,1,var)/n)

t05 <- qt(0.975,n-1)

power <- sum(abs(ttests)>t05)/S

power [1] 0.

17

Simulation study principles

Issue: How well do the Monte Carlo quantities approximate properties of the true sampling distribution of the estimator/test statistic?

  • Is S = 1000 large enough to get a feel for the true sampling properties? How “believable” are the results?
  • A simulation is just an experiment like any other, so use statistical principles!
  • Each data set yields a draw from the true sampling distribution, so S is the “sample size” on which estimates of mean, bias, SD, etc. of this distribution are based
  • Select a “sample size” (number of data sets S) that will achieve acceptable precision of the approximation in the usual way!

18

Principle 1: A Monte Carlo simulation is just like any other experiment

  • Careful planning is required
  • Factors that are of interest to vary in the experiment: sample size n, distribution of the data, magnitude of variation,...
  • Each combination of factors is a separate simulation, so that many factors can lead to very large number of combinations and thus number of simulations - time consuming
  • Use experimental design principles
  • Results must be recorded and saved in a systematic, sensible way
  • Don’t choose only factors favorable to a method you have developed!
  • “Sample size S (number of data sets in each simulation) must deliver acceptable precision...

Choosing S: Estimator for θ (true value θ 0 )

  • Estimation of mean of sampling distribution/bias: √ var(T − θ 0 ) =

√ var(T ) =

√√√ √√var^ S− 1 ∑S s=1^ Ts

  (^) = SD( √Ts) S =^ d where d is the acceptable error

⇒ S =

{SD(Ts)}^2 d^2

  • Can “guess” SD(Ts) from asymptotic theory, preliminary runs