model checking
play

Model checking Dr. Jarad Niemi STAT 544 - Iowa State University - PowerPoint PPT Presentation

Model checking Dr. Jarad Niemi STAT 544 - Iowa State University February 28, 2019 Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 1 / 23 Outline We assume p ( y | ) and p ( ) , so it would be prudent to determine if these


  1. Model checking Dr. Jarad Niemi STAT 544 - Iowa State University February 28, 2019 Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 1 / 23

  2. Outline We assume p ( y | θ ) and p ( θ ) , so it would be prudent to determine if these assumptions are reasonable. (Prior) sensitivity analysis Posterior predictive checks Graphical checks Posterior predictive pvalues Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 2 / 23

  3. Prior sensitivity analysis Prior sensitivity analysis Since a prior specifies our prior belief, we may want to check to determine whether our conclusions would change if we held different prior beliefs. Suppose a particular scientific question can be boiled down to ind Y i ∼ Ber ( θ ) and that there is wide disagreement about the value for θ such that the following might reasonably characterize different individual beliefs before the experiment is run: Skeptic: θ ∼ Be (1 , 100) Agnostic: θ ∼ Be (1 , 1) Believer: θ ∼ Be (100 , 1) An experiment is run and the posterior under these different priors are compared. Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 3 / 23

  4. Prior sensitivity analysis Posteriors n=10 n=100 n=1000 40 40 20 30 30 20 20 10 10 10 0 0 0 p( θ |y) 0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00 n=10000 n=1e+05 n=1e+06 400 100 1000 300 200 50 500 100 0 0 0 0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00 θ type skeptic agnostic believer Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 4 / 23

  5. Prior sensitivity analysis Hierarchical variance prior Recall the normal hierarchical model ind ind ∼ N ( θ i , s 2 ∼ N ( µ, τ 2 ) y i i ) , θ i which results in the posterior distribution for τ of I µ ) 2 � − ( y i − ˆ � i + τ 2 ) − 1 / 2 exp p ( τ | y ) ∝ p ( τ ) V 1 / 2 � ( s 2 µ 2( s 2 i + τ 2 ) i =1 As an attempt to be non-informative, consider an IG ( ǫ, ǫ ) prior for τ 2 . As an alternative, consider τ ∼ Unif (0 , C ) or τ ∼ Ca + (0 , C ) where C is problem specific, but is chosen to be relatively large for the particular problem. The 8-schools example has the following data: 1 2 3 4 5 6 7 8 y 28 8 -3 7 -1 1 18 12 s 15 10 16 11 9 11 10 18 Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 5 / 23

  6. Prior sensitivity analysis Posterior for 8-schools example Reproduction of Gelman 2006: IG(1,1) IG(e,e) 0.8 2 0.6 0.4 1 0.2 0.0 0 density 0 5 10 15 20 0 5 10 15 20 Unif(0,20) Ca^*(0,5) 0.15 0.100 0.075 0.10 0.050 0.05 0.025 0.00 0 5 10 15 20 0 5 10 15 20 x variable prior posterior Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 6 / 23

  7. Prior sensitivity analysis Summary For a default prior on a variance ( σ 2 ) or standard deviation ( σ ), use 1. Easy to remember. Half-Cauchy on the standard deviation ( σ ∼ Ca + (0 , C ) ). 2. Harder to remember Data-level variance Use default prior ( p ( σ 2 ) ∝ 1 /σ 2 ) Hierarchical standard deviation Use uniform prior (Unif (0 , C ) ) if there are enough reps (5 or more) of that parameter. Use half-Cauchy prior ( Ca + (0 , C ) ) otherwise. When assigning the values for C For a uniform prior (Unif (0 , C ) ) make sure C is large enough to capture any reasonable value for the standard deviation. For a half-Cauchy prior ( Ca + (0 , C ) ) err on the side of making C too small since the heavy tails will let the data tell you if the standard deviation needs to be larger whereas a value of C that is too large will put too much weight toward large values of the standard deviation and make the prior more informative. Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 7 / 23

  8. Posterior predictive checks Posterior predictive checks Let y rep be a replication of y , then � � p ( y rep | y ) = p ( y rep | θ, y ) p ( θ | y ) dθ = p ( y rep | θ ) p ( θ | y ) dθ. where y is the observed data and θ are the model parameters. To simulate a full replication: 1. Simulate θ ( j ) ∼ p ( θ | y ) and 2. Simulate y rep,j ∼ p ( y | θ ( j ) ) . To assess model adequacy: Compare plots of replicated data to the observed data. Calculate posterior predictive pvalues. Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 8 / 23

  9. Posterior predictive checks Airline example Airline accident data Let y i be the number of fatal accidents in year i x i be the number of 100 million miles flown in year i Consider the model √ ind Y i ∼ Po ( x i λ ) p ( λ ) ∝ 1 / λ. year fatal accidents passenger deaths death rate miles flown 1 1976 24 734 0 3863 2 1977 25 516 0 4300 3 1978 31 754 0 5027 4 1979 31 877 0 5481 5 1980 22 814 0 5814 6 1981 21 362 0 6033 7 1982 26 764 0 5877 8 1983 20 809 0 6223 9 1984 16 223 0 7433 10 1985 22 1066 0 7107 Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 9 / 23

  10. Posterior predictive checks Airline example Posterior replications of the data Under Jeffreys prior, the posterior is λ | y ∼ Ga (0 . 5 + ny, nx ) . So to obtain a replication of the data, do the following 1. λ ( j ) ∼ Ga (0 . 5 + ny, nx ) and 2. y rep,j ind ∼ Po ( x i λ ( j ) ) for i = 1 , . . . , n . i Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 10 / 23

  11. Posterior predictive checks Airline example 1 2 3 4 5 3 2 1 0 6 7 8 9 10 3 2 1 0 count 11 12 13 14 15 3 2 1 0 16 17 18 19 20 3 2 1 0 10 20 30 40 10 20 30 40 10 20 30 40 10 20 30 40 10 20 30 40 fatal_accidents Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 11 / 23

  12. Posterior predictive checks Airline example 1 2 3 4 5 3 2 1 0 6 7 8 9 10 3 2 1 0 count 11 12 13 14 15 3 2 1 0 16 17 18 19 20 3 2 1 0 10 20 30 40 10 20 30 40 10 20 30 40 10 20 30 40 10 20 30 40 fatal_accidents Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 12 / 23

  13. Posterior predictive checks Airline example How might this model not accurately represent the data? Let y i be the number of fatal accidents in year i x i be the number of 100 million miles flown in year i Consider the model √ ind Y i ∼ Po ( x i λ ) p ( λ ) ∝ 1 / λ. year fatal accidents passenger deaths death rate miles flown .n 1 1976 24 734 0 3863 9 2 1977 25 516 0 4300 9 3 1978 31 754 0 5027 9 4 1979 31 877 0 5481 9 5 1980 22 814 0 5814 9 6 1981 21 362 0 6033 9 7 1982 26 764 0 5877 9 8 1983 20 809 0 6223 9 9 1984 16 223 0 7433 9 10 1985 22 1066 0 7107 9 Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 13 / 23

  14. Posterior predictive checks Airline example 1 2 3 4 5 40 30 20 10 6 7 8 9 10 40 30 fatal_accidents 20 10 11 12 13 14 15 40 30 20 10 16 17 18 19 20 40 30 20 10 1977.5 1980.0 1982.5 1985.0 1977.5 1980.0 1982.5 1985.0 1977.5 1980.0 1982.5 1985.0 1977.5 1980.0 1982.5 1985.0 1977.5 1980.0 1982.5 1985.0 year Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 14 / 23

  15. Posterior predictive checks Airline example 1 2 3 4 5 40 30 20 10 6 7 8 9 10 40 30 20 fatal_accidents 10 11 12 13 14 15 40 30 20 10 16 17 18 19 20 40 30 20 10 1977.5 1980.0 1982.5 1985.0 1977.5 1980.0 1982.5 1985.0 1977.5 1980.0 1982.5 1985.0 1977.5 1980.0 1982.5 1985.0 1977.5 1980.0 1982.5 1985.0 year Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 15 / 23

  16. Posterior predictive checks Airline example 1 2 3 4 5 40 30 20 10 6 7 8 9 10 40 30 20 fatal_accidents 10 11 12 13 14 15 40 30 20 10 16 17 18 19 20 40 30 20 10 1977.5 1980.0 1982.5 1985.0 1977.5 1980.0 1982.5 1985.0 1977.5 1980.0 1982.5 1985.0 1977.5 1980.0 1982.5 1985.0 1977.5 1980.0 1982.5 1985.0 year Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 16 / 23

  17. Posterior predictive checks Posterior predictive pvalues Posterior predictive pvalues To quantify the discrepancy between observed and replicated data: 1. Define a test statistic T ( y, θ ) . 2. Define the posterior predictive pvalue p B = P ( T ( y rep , θ ) ≥ T ( y, θ ) | y ) where y rep and θ are random. Typically this pvalue is calculated via simulation, i.e. = E y rep ,θ [I( T ( y rep , θ ) ≥ T ( y, θ )) | y ] p B I( T ( y rep , θ ) ≥ T ( y, θ )) p ( y rep | θ ) p ( θ | y ) dy rep dθ � � = � J ≈ 1 j =1 I( T ( y rep,j , θ ( j ) ) ≥ T ( y, θ ( j ) )) J where θ ( j ) ∼ p ( θ | y ) and y rep,j ∼ p ( y | θ ( j ) ) . Small or large pvalues are (possible) cause for concern. Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 17 / 23

  18. Posterior predictive checks Posterior predictive pvalues Posterior predictive pvalue for slope Let Y obs = β obs + β obs i i 0 1 where Y obs is the observed number of fatal accidents in year i and i β obs be the test statistic. 1 Now, generate replicate data y rep and fit Y rep = β rep + β rep i. i 0 1 to the distribution of β rep Now compare β obs . 1 1 Jarad Niemi (STAT544@ISU) Model checking February 28, 2019 18 / 23

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend