Checking Assumptions

Like dokumenter
Checking Assumptions

Slope-Intercept Formula

EXAMINATION PAPER. Exam in: STA-3300 Applied statistics 2 Date: Wednesday, November 25th 2015 Time: Kl 09:00 13:00 Place: Teorifagb.

Eksamensoppgave i PSY3100 Forskningsmetode - Kvantitativ

TMA4245 Statistikk Eksamen 9. desember 2013

Unit Relational Algebra 1 1. Relational Algebra 1. Unit 3.3

Generelle lineære modeller i praksis

Andrew Gendreau, Olga Rosenbaum, Anthony Taylor, Kenneth Wong, Karl Dusen

Kp. 12 Multippel regresjon

Satellite Stereo Imagery. Synthetic Aperture Radar. Johnson et al., Geosphere (2014)

Dynamic Programming Longest Common Subsequence. Class 27

Verifiable Secret-Sharing Schemes

TMA4245 Statistikk. Øving nummer 12, blokk II Løsningsskisse. Norges teknisk-naturvitenskapelige universitet Institutt for matematiske fag

Forelesning 3 STK3100

0:7 0:2 0:1 0:3 0:5 0:2 0:1 0:4 0:5 P = 0:56 0:28 0:16 0:38 0:39 0:23

FINAL EXAM. Exam in: STA-3300 Applied Statistics 2 Date: Wednesday 28. November Time: 09:00 13:00 Place: Åsgårdvegen 9. All printed and written

UNIVERSITETET I OSLO

Generalization of age-structured models in theory and practice

Perpetuum (im)mobile

Oppgave 1a Definer følgende begreper: Nøkkel, supernøkkel og funksjonell avhengighet.

Splitting the differential Riccati equation

SVM and Complementary Slackness

Neural Network. Sensors Sorter

Exploratory Analysis of a Large Collection of Time-Series Using Automatic Smoothing Techniques

Trigonometric Substitution

KROPPEN LEDER STRØM. Sett en finger på hvert av kontaktpunktene på modellen. Da får du et lydsignal.

Exercise 1: Phase Splitter DC Operation

UNIVERSITETET I OSLO

UNIVERSITY OF OSLO DEPARTMENT OF ECONOMICS

TMA4240 Statistikk 2014

UNIVERSITY OF OSLO DEPARTMENT OF ECONOMICS

Den som gjør godt, er av Gud (Multilingual Edition)

Emnedesign for læring: Et systemperspektiv

Elektronisk termostat med spareprogram. Lysende LCD display øverst på ovnen for enkel betjening.

Eksamensoppgave i PSY3100 Forskningsmetode - Kvantitativ

Stationary Phase Monte Carlo Methods

Independent Inspection

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

EXAMINATION PAPER. Exam in: STA-3300 Date: Wednesday 27. November 2013 Time: Kl 09:00 13:00 Place: Åsgårdsv All printed and written

Bioberegninger, ST november 2006 Kl. 913 Hjelpemidler: Alle trykte og skrevne hjelpemidler, lommeregner.

Lineære modeller i praksis

- All printed and written. The exam contains 16 pages included this cover page

TMA4240 Statistikk Høst 2013

UNIVERSITETET I OSLO

SOS 31 MULTIVARIAT ANALYSE

Eksamensoppgave i SOS3003 Anvendt statistisk dataanalyse i samfunnsvitenskap

Hvordan føre reiseregninger i Unit4 Business World Forfatter:

UNIVERSITY OF OSLO DEPARTMENT OF ECONOMICS

MOT310 Statistiske metoder 1, høsten 2006 Løsninger til regneøving nr. 8 (s. 1) Oppgaver fra boka:

TDT4117 Information Retrieval - Autumn 2014

Kp. 11 Enkel lineær regresjon (og korrelasjon) Kp. 11 Regresjonsanalyse; oversikt

Emneevaluering GEOV272 V17

UNIVERSITETET I OSLO

FYSMEK1110 Eksamensverksted 23. Mai :15-18:00 Oppgave 1 (maks. 45 minutt)

Moving Objects. We need to move our objects in 3D space.

Eksamensoppgave i TMA4267 Lineære statistiske modeller

Oppgave. føden)? i tråd med

Merak Un-glazed Porcelain Wall and Floor Tiles

Gir vi de resterende 2 oppgavene til én prosess vil alle sitte å vente på de to potensielt tidskrevende prosessene.

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

MOT310 Statistiske metoder 1, høsten 2006 Løsninger til regneøving nr. 7 (s. 1) Oppgaver fra boka: n + (x 0 x) 2 σ2

Gradient. Masahiro Yamamoto. last update on February 29, 2012 (1) (2) (3) (4) (5)

Dagens tema: Eksempel Klisjéer (mønstre) Tommelfingerregler

Analysis of ordinal data via heteroscedastic threshold models

TMA4240 Statistikk Høst 2015

TFY4170 Fysikk 2 Justin Wells

Dean Zollman, Kansas State University Mojgan Matloob-Haghanikar, Winona State University Sytil Murphy, Shepherd University

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Information search for the research protocol in IIC/IID

The regulation requires that everyone at NTNU shall have fire drills and fire prevention courses.

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Eksamensoppgave i PSY3100 Forskningsmetode - Kvantitativ

UNIVERSITETET I OSLO

Løsningsforslag STK1110-h11: Andre obligatoriske oppgave.

Salting of dry-cured ham

Medisinsk statistikk, KLH3004 Dmf, NTNU Styrke- og utvalgsberegning

5 E Lesson: Solving Monohybrid Punnett Squares with Coding

Level Set methods. Sandra Allaart-Bruin. Level Set methods p.1/24

Oppgave 1. X 1 B(n 1, p 1 ) X 2. Vi er interessert i forskjellen i andeler p 1 p 2, som vi estimerer med. p 1 p 2 = X 1. n 1 n 2.

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

MA2501 Numerical methods

SAS FANS NYTT & NYTTIG FRA VERKTØYKASSA TIL SAS 4. MARS 2014, MIKKEL SØRHEIM

Endringer i neste revisjon av EHF / Changes in the next revision of EHF 1. October 2015

Returns, prices and volatility

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Gol Statlige Mottak. Modul 7. Ekteskapsloven

EKSAMENSOPPGAVE I SØK3001 ØKONOMETRI I ECONOMETRICS I

Fasit og løsningsforslag STK 1110

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Eksamensoppgave i SOS3003 Anvendt statistisk dataanalyse i samfunnsvitenskap Examination paper for SOS3003 Applied Social Statistics

Smart High-Side Power Switch BTS730

Hvor finner vi flått på vårbeiter? - og betydning av gjengroing for flåttangrep på lam på vårbeite

Mathematics 114Q Integration Practice Problems SOLUTIONS. = 1 8 (x2 +5x) 8 + C. [u = x 2 +5x] = 1 11 (3 x)11 + C. [u =3 x] = 2 (7x + 9)3/2

Skog som biomasseressurs: skog modeller. Rasmus Astrup

Port of Oslo Onshore Power Supply - HVSC. Senior Adviser Per Gisle Rekdal

PSY2012 Forskningsmetodologi III: Statistisk analyse, design og måling Eksamen vår 2016

HONSEL process monitoring

Eksamen PSY2012 Forskningsmetodologi III: Statistisk analyse, design og måling Våren 2011

Kneser hypergraphs. May 21th, CERMICS, Optimisation et Systèmes

Transkript:

Checking Assumptions Merlise Clyde STA721 Linear Models Duke University November 20, 2017

Linear Model Linear Model: Y = µ + ɛ Assumptions: µ C(X) µ = Xβ ɛ N(0 n, σ 2 I n ) Focus on Wrong mean for a case or cases Wrong distribution for ɛ Cases that influence the mean If µ i x T i β then expected value of e i = Y i Ŷ i is not zero;

Standardized residuals standardized residuals r i = e i / σ 2 (1 h ii ) Under correct model have mean 0 and scale 1 Use estimate of σ 2 The distribution of r i is not a t if h ii (leverage) is close to 1, then Ŷ i is close to Y i so e i is approximately 0 Variance is also almost 0, so standardize value may not flag outliers

Predicted Residuals Estimates without Case (i): Predicted residual with variance ˆβ (i) = (X T (i) X (i)) 1 X T (i) Y (i) = ˆβ (XT X) 1 x i e i 1 h ii e (i) = y i x T i e i ˆβ (i) = 1 h ii σ2 var(e (i) ) = 1 h ii Standardized predicted residual is e (i) var(e (i) ) = e i/(1 h ii ) σ/ 1 h ii = e i σ 1 h ii these are the same as standardized residual!

External estimate of σ 2 Estimate ˆσ 2 (i) using data with case i deleted SSE (i) = SSE e2 i 1 h ii ˆσ (i) 2 = MSE SSE (i) (i) = n p 1 Externally Standardized residuals t i = e (i) ˆσ 2 (i) /(1 h ii) ˆβ (i) = y i x T i ˆσ (i) 2 /(1 h ii) ( ) n p 1 1/2 = r i n p ri 2 May still miss extreme points with high leverage, but will pick up unusual y i s

Distribution of Externally Studentized Residual t i = e (i) ˆσ 2 (i) /(1 h ii) ˆβ (i) = y i x T i St(n p 1) ˆσ (i) 2 /(1 h ii)

Outlier Test H 0 : µ i = x T i β versus H a : µ i = x T i β + α i Show that t-test for testing H 0 : α i = 0 is equal to t i if p-value is small declare the ith case to be an outlier: E[Y i ] not given by Xβ but Xβ + δ i α i Can extend to include multiple δ i and δ j to test that case i and j are both outliers Extreme case µ = Xβ + I n α all points have their own mean! Control for multiple testing

Multiple Testing look to see if the max t i is larger than expected under the null Need distribution of the max of Student t random variables (simulate) Conservative is Bonferroni Correction: For n tests of size α the probability of falsely labeling at least one case as an outlier is no greater than nα; e.g. with 21 cases and α = 0.05, the probability is no greater than 1.05! Adjust α = α/n so that the probability of falsely labeling at least one point an outlier is α α/n =.00238 with n = 21

Cook s Distance Cook s Distance measure of how much predictions change with ith case deleted D i = Ŷ (i) Ŷ 2 pˆσ 2 = r i 2 p h ii 1 h ii = (ˆβ (i) ˆβ) T X T X(ˆβ (i) ˆβ) pˆσ 2 Flag cases where D i > 1 or large relative to other cases Influential Cases

Stackloss Data 18 20 22 24 26 10 20 30 40 Air.Flow 50 60 70 80 18 20 22 24 26 Water.Temp Acid.Conc. 75 80 85 90 10 20 30 40 stack.loss 50 60 70 80 75 80 85 90

Case 21 Leverage 0.285 (compare to p/n =.19 ) p-value t 21 is 0.0042 Bonferroni adjusted p-value is 0.0024 Cooks Distance.69 Other points? Masking? Refit without Case 21 Other analyses have suggested that cases (1, 2, 3, 4, 21) are outliers

Multiple Outliers Hoeting, Madigan and Raftery (in various permutations) consider the problem of simultaneous variable selection and outlier identification. This is implemented in the library(bma) in the function MC3.REG. This has the advantage that more than 2 points may be considered as outliers at the same time. The function uses a Markov chain to identify both important variables and potential outliers, but is coded in Fortran so should run reasonably quickly. Can also use BAS or other variable selection programs

Using BAS library(mass) data(stackloss) n = nrow(stackloss) stack.out = cbind(stackloss, diag(n)) library(bas) BAS.stack = bas.lm(stack.loss ~., data=stack.out, prior="hyper-g-n", a=3, modelprior=tr.beta.binomial(1, 1,15), method="mcmc", MCMC.it=200000)

Output P(B!= 0 Y) model 1 model 2 model 3 model 4 model 5 Intercept 1.00 1.00 1.00 1.00 1.00 1.00 Air.Flow 1.00 1.00 1.00 1.00 1.00 1.00 Water.Temp 0.24 0.00 0.00 1.00 0.00 1.00 Acid.Conc. 0.04 0.00 0.00 0.00 0.00 0.00 1 0.23 0.00 0.00 1.00 0.00 0.00 2 0.07 0.00 0.00 0.00 0.00 0.00 3 0.24 0.00 0.00 1.00 0.00 0.00 4 0.75 1.00 0.00 1.00 1.00 1.00 5 0.03 0.00 0.00 0.00 0.00 0.00 6 0.03 0.00 0.00 0.00 0.00 0.00 7 0.03 0.00 0.00 0.00 0.00 0.00 8 0.03 0.00 0.00 0.00 0.00 0.00 9 0.03 0.00 0.00 0.00 0.00 0.00 10 0.03 0.00 0.00 0.00 0.00 0.00 11 0.03 0.00 0.00 0.00 0.00 0.00 12 0.04 0.00 0.00 0.00 0.00 0.00 13 0.16 0.00 0.00 0.00 1.00 0.00 14 0.08 0.00 0.00 0.00 0.00 0.00 15 0.04 0.00 0.00 0.00 0.00 0.00 16 0.03 0.00 0.00 0.00 0.00 0.00 17 0.03 0.00 0.00 0.00 0.00 0.00 18 0.03 0.00 0.00 0.00 0.00 0.00 19 0.05 0.00 0.00 0.00 0.00 0.00 20 0.05 0.00 0.00 0.00 0.00 0.00 21 0.94 1.00 1.00 1.00 1.00 1.00 BF 0.13 0.01 1.00 0.08 0.07 PostProbs 0.23 0.10 0.03 0.03 0.02 R2 0.96 0.93 0.99 0.97 0.97 dim 4.00 3.00 7.00 5.00 5.00 logmarg 22.17 19.43 24.18 21.68 21.57

BAS Residuals vs Fitted Model Probabilities Residuals 3 1 0 1 2 3 14 13 3 Cumulative Probability 0.0 0.2 0.4 0.6 0.8 1.0 10 15 20 25 30 35 40 0 1000 3000 5000 Predictions under BMA Model Search Order log(marginal) 0 5 10 15 20 25 Model Complexity Marginal Inclusion Probability 0.0 0.2 0.4 0.6 0.8 1.0 Inclusion Probabilities 2 4 6 8 10 12 14 Model Dimension Intercept Air.Flow ter.temp cid.conc. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

BAS Model Space Model Rank 1 2 3 4 5 6 7 8 9 11 13 Intercept Air.Flow Water.Temp Acid.Conc. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 3.658 2.864 1.523 1.443 1.131 1.047 0.566 Log Posterior Odds

Diagnostics pip (MCMC) 0.0 0.2 0.4 0.6 0.8 1.0 pip (MCMC) 0.00 0.05 0.10 0.15 0.20 0.0 0.2 0.4 0.6 0.8 1.0 pip (renormalized) 0.00 0.05 0.10 0.15 0.20 0.25 pip (renormalized)

To Remove or Not? For suspicious cases, check data sources for errors Check that points are not outliers because of wrong mean function or distributional assumptions Investigate need for transformations (use EDA at several stages) Influential cases - report results with and without cases (results may change - are differences meaningful?) Outlier test - suggests alternative population for the case(s); if not influential may in keep analysis, but will inflate ˆσ 2 and interval estimates Document how you handle any case deletions - reproducibility! Robust Regression Methods

Stackloss Added Variable Plot Added Variable Plots stack.loss others 5 0 5 stack.loss others 10 5 0 5 5 0 5 10 Air.Flow others 3 2 1 0 1 2 Water.Temp others stack.loss others 8 6 4 2 0 2 4 6 10 5 0 5 Acid.Conc. others

Stackloss Data Again Residuals vs Fitted Normal Q Q Residuals 5 0 5 4 21 3 Standardized residuals 2 1 0 1 2 21 4 3 5 10 15 20 25 30 35 40 Fitted values 2 1 0 1 2 Theoretical Quantiles Standardized residuals 0.0 0.5 1.0 1.5 Scale Location 21 4 3 Standardized residuals 3 2 1 0 1 2 Residuals vs Leverage 4 1 Cook's distance 21 1 0.5 0.5 1 5 10 15 20 25 30 35 40 Fitted values 0.0 0.1 0.2 0.3 0.4 Leverage