STAT 571A Advanced Statistical Regression Analysis. Chapter 8 NOTES Quantitative and Qualitative Predictors for MLR
|
|
- Antony Campbell
- 5 years ago
- Views:
Transcription
1 STAT 571A Advanced Statistical Regression Analysis Chapter 8 NOTES Quantitative and Qualitative Predictors for MLR 2015 University of Arizona Statistics GIDP. All rights reserved, except where previous rights exist. No part of this material may be reproduced, stored in a retrieval system, or transmitted in any form or by any means electronic, online, mechanical, photoreproduction, recording, or scanning without the prior written consent of the course instructor.
2 8.1: Polynomial Regression Mentioned in passing in 6.1, we now study polynomial regression in more detail. This is technically a special form of MLR, since it has more than one β k parameter. Simplest case: 2nd-order/single predictor model: Y i = β 0 + β 1 (X i X) + β 2 (X i X) 2 + ε i (i = 1,...,n) with ε i ~ i.i.d.n(0,σ 2 ).
3 Polynomial Regression (cont d) For simplicity, write x i = (X i X): Y i = β 0 + β 1 x i + β 2 x i 2 + ε i (Why? Centering usually reduces multicollinearity with 2nd-order, and higher, predictors. Just do it.) This quadratic regression can be a useful approximation to data that deviate from strict linearity. See Fig. 8.1
4 Quadratic Regression
5 Cubic Regression (Fig Examples of 3rd-order, cubic regression polynomials.)
6 2nd-Order Response Surface (Fig Examples of 2nd-order response surface, as in 6.1.)
7 Testing Polynomial Models Sequential testing: for testing purposes, we start with the highest-order term and work down the order ( up the ladder ). Suppose E{Y i } = β 0 + β 1 x i + β 11 x i2 + β 111 x i 3 First test H o :β 111 =0 via partial F-test and SSR(x 3 x 1,x 2 ). If signif., STOP and conclude cubic polynomial is significant. If H o :β 111 =0 is NOT signif., drop β 111 and go up ladder to test H o: β 11 =0 via SSR(x 2 x 1 ).
8 Polynomial Regression (cont d) E{Y i } = β 0 + β 1 x i + β 11 x i2 + β 111 x i 3 (cont d) If H o :β 11 =0 is signif., STOP and conclude quadratic polynomial is significant. If H o :β 11 =0 is NOT signif., drop β 11 and go up ladder to test H o: β 1 =0 via SSR(x 1 ). If H o :β 1 =0 is signif., STOP and conclude simple linear model is significant. Etc. Once sequential testing is complete, we usually go back and fit the final model in terms of the orig. X k s to get cleaner b k s and std. errors.
9 Example: Power Cell Data (CH08TA01) Power Cell Data example: Y = {# cycles} and we have 2 predictors (X 1 = charge rate & X2 = temp.); see Table 8.1. Consider a 2nd-order response surface MLR: > Y = c(150, 86, 49,..., 279, 235, 224) > X1 = c(0.6, 1.0, 1.4,..., 0.6, 1.0, 1.4) > X2 = c( rep(10,3), rep(20,5), rep(30,3) ) > x1 = (X1 - mean(x1))/0.4 > x2 = (X2 - mean(x2))/min(x2) > > x1sq = x1*x1 > x2sq = x2*x2 > x1x2 = x1*x2
10 Power Cell Data (CH08TA01) (cont d) Selection of X 1 and X 2 was controlled. note the zero/near-zero correlations among the (transformed) x-variables: > cor( cbind(x1, x2, x1sq, x2sq, x1x2) ) x1 x2 x1sq x2sq x1x2 x1 1.00e e e e e+00 x2 0.00e e e e e-17 x1sq -4.04e e e e e+00 x2sq -1.99e e e e e+00 x1x2 0.00e e e e e+00
11 Power Cell Data (CH08TA01) (cont d) Compare this to (non-trivial) correlations among orig. X k s, etc : > cor( cbind(x1, X2, X1sq, X2sq, X1X2) ) X1 X2 X1sq X2sq X1X2 X1 1.00e e X2 0.00e X1sq 9.91e X2sq -4.16e e X1X2 6.05e e
12 Power Cell Data (CH08TA01) (cont d) Full 2nd-order model fit with transfrm d x s: > summary( lm(y ~ x1 + x2 + x1sq + x2sq + x1x2) ) Call: lm(formula = Y ~ x1 + x2 + x1sq + x2sq + x1x2) Coefficients: Estimate Std.Error t value Pr(> t ) (Intercept) x x x1sq x2sq x1x
13 Power Cell Data (CH08TA01) (cont d) Residual analysis shows no serious issues: > plot( resid(ch08ta01.lm) ~ fitted(ch08ta01.lm) ) > abline( h=0 ) > qqnorm( resid(ch08ta01.lm) )
14 Power Cell Data (CH08TA01) (cont d) Lack of Fit test. Only joint replication is at x 1 =x 2 =0, so need to set up the factor term carefully in R: > LOFfactor = factor( c(seq(-4,-1), rep(0,3), seq(1,4)) ) > anova( CH08TA01.lm, lm(y ~ LOFfactor) ) Analysis of Variance Table Model 1: Y ~ x1 + x2 + x1sq + x2sq + x1x2 Model 2: Y ~ LOFfactor Res.Df RSS Df Sum of Sq F Pr(>F) LOF stat. is F* = 1.82 (P = 0.374). No signif. lack of fit.
15 Power Cell Data (CH08TA01) (cont d) Partial F-test of 2nd-order terms (H o :β 11 = β 22 = β 12 = 0): > anova( lm(y ~ x1+x2), CH08TA01.lm ) Analysis of Variance Table Model 1: Y ~ x1 + x2 Model 2: Y ~ x1 + x2 + x1sq + x2sq + x1x2 Res.Df RSS Df Sum of Sq F Pr(>F) Partial 3 df F-statistic is F* = 0.78 (P = 0.553). No signif. deviation from 0 seen in 2nd-order terms.
16 Power Cell Data (CH08TA01) (cont d) Fit reduced 1st-order model: > summary( lm(y ~ x1+x2) ) Call: lm(formula = Y ~ x1 + x2) Coefficients: Estimate Std.Error t value Pr(> t ) (Intercept) e-08 x x Multiple R-squared: Adjusted R-squared: F-stat.: on 2 and 8 DF, p-val.:
17 Power Cell Data (CH08TA01) (cont d) Bonferroni-adjusted simultaneous conf. intervals on 1st-order β-parameters (using original X-variables): > g = length( coef(lm(y ~ X1+X2)) ) - 1 > confint( lm(y ~ X1+X2), level = 1-(.10/g) ) X X (cf. Textbook p. 305)
18 Interaction Terms Interaction cross-product terms can be included in any MLR to allow for interactions between the X k -variables. E.g., E{Y} = β 0 + β 1 X 1 + β 2 X 2 + β 3 X 1 X 2 The cross-product creates a departure from additivity in the mean response. If β 3 = 0, the mean response is strictly additive in X 1 and X 2.
19 Interaction Terms (cont d) Notice that the usual interpretation for the β k parameters is muddied here. What does it mean to increase X 1 by +1 unit while holding X 1 X 2 fixed?!? Alt. interpretation: cross-product terms allow for synergistic or antagonistic interactions between the X k -variables. It s a special kind of departure from additivity: synergy occurs for β 3 > 0, antagonism for β 3 < 0.
20 Figure 8.8 Graphics for (a) additive, (b) synergistic, or (c) antagonistic response surfaces.
21 Interaction Caveats Need to be careful with interactions. If they exist and they are ignored, very poor inferences on E{Y} will result. On the other hand, adding a kitchen sink of all possible interactions can overwhelm the MLR. With 3 X k -variables there are 3 possible pairwise interactions (not incl. the tri-way!) With 8 X k -variables there are 28 possible pairwise interactions (not incl. multi-ways!) Things get unwieldy fast...
22 Body Fat Data (CH07TA01) (cont d) To the 3 original X k -variables now include all pairwise interactions. Center each X-variable (about its mean) first to assuage problems with multicollinearity: x ik = X ik X k (k = 1,2,3) MLR now has six predictor terms and p=7 β-parameters: E{Y} = β 0 + β 1 x 1 + β 2 x 2 + β 3 x 3 + β 4 x 1 x 2 + β 5 x 1 x 3 + β 6 x 2 x 3
23 Body Fat Data (CH07TA01) (cont d) R can fit interaction terms using a special * operator: e.g., x1*x2 fits x1 and x2 and x1:x2 all with just 1 term. For the Body Fat data, construct centered x-variables as x1 = X1 mean(x1), etc. Then call > anova( lm(y ~ x1 + x2 + x3), lm(y ~ x1*x2 + x1*x3 + x2*x3) ) Output follows
24 Body Fat Data (CH07TA01) (cont d) Output from partial F-test of all pairwise interactions: Analysis of Variance Table Model 1: Y ~ x1 + x2 + x3 Model 2: Y ~ x1 * x2 + x1 * x3 + x2 * x3 Res.Df RSS Df Sum of Sq F Pr(>F) Partial 3 df F-statistic is F* = 0.53 (P = 0.670). No signif. pairwise interactions are seen.
25 Body Fat Data (CH07TA01) (cont d) Can also include tri-way interactions: > anova( lm(y ~ x1+x2+x3), lm(y ~ x1*x2*x3) ) Analysis of Variance Table Model 1: Y ~ x1 + x2 + x3 Model 2: Y ~ x1 * x2 * x3 Res.Df RSS Df Sum of Sq F Pr(>F) d.f. partial F-statistic is F* = 0.45 (P = 0.771). no signif. pairwise or tri-way interactions.
26 Qualitative Predictors We ve seen cases where the X-variable was either 0 or 1 (called a binary indicator). If this indicated a qualitative state (say, 1 = or 0 = ) then the numbering is arbitrary. The predictor is actually qualitative, not quantitative. (Still 0 vs. 1 is usually as good a pseudoquantification as any.) Question: What happens when binary indicators are combined with true quantitative predictors?
27 Example: Insur. Innov n Data Suppose we study Y = Insurance method adoption time (mos.) in insurance companies, with X 1 = size of firm (quantitative) X 2 = type of firm: 1 = stock, 0 otherwise X 3 = type of firm: 1 = mutual, 0 otherwise Design matrix is (n = 4): X 0 X 1 X 2 X 3 X = 1 X X X X
28 Design Matrix Problem But wait, there s a problem with this design matrix X. Notice that X 0 = X 2 + X 3 so the predictors are not linearly independent: rank(x X) = 3 < 4 = p. (See p. 314.) The MLR will fail! Solution is (usually) to eliminate X 3 and model E{Y} = β 0 + β 1 X 1 + β 2 X 2. Model interpretation here is actually sorta intriguing
29 Two Straight Lines For E{Y} = β 0 + β 1 X 1 + β 2 X 2, with X 1 quantitative and X 2 a 0-1 indicator, consider: When X 2 = 0 (mutual firm), E{Y} = β 0 + β 1 X 1, an SLR on X 1 with slope β 1 and Y-intercept β 0. When X 2 = 1 (stock firm), E{Y} = (β 0 + β 2 ) + β 1 X 1, an SLR on X 1 with same slope β 1 but new Y-intercept (β 0 + β 2 ). So we have two parallel straight lines each with same σ 2 one for stock firms (X 2 = 1) and one for mutual firms (X 2 = 0).
30 ANCOVA Graphic
31 Tests in Equal-Slopes ANCOVA For this equal-slopes ANCOVA model, some obvious hypotheses are (first) H o : β 2 = 0 (i.e., no diff. between type lines are same) (next) H o : β 1 = 0 (i.e., no effect of size lines are flat) Data are in Table 8.2; n = 20. R code/analysis follows
32 Insur. Innov n Data (CH08TA02) Y = Insurance method adoption time X 1 =size of firm X 2 = type of firm (mutual vs. stock) > Y = c(17, 26,..., 30, 14) > X1 = c(151, 92,..., 124, 246) > X2 = c( rep(0,10), rep(1,10) ) Scatterplot using > plot( Y ~ X1, pch=1+(18*x2) ) (next slide ) shows two separate scatterlines, one for each type of firm.
33 Plot shows dual linear relationship, indexed by type of firm Insur. Innov n Data (CH08TA02) Scatterplot
34 Insur. Innov n (CH08TA02) (cont d) Equal-slopes ANCOVA in R: > CH08TA02.lm = lm( Y ~ X1 + X2 ) > summary( CH08TA02.lm ) Call: lm(formula = Y ~ X1 + X2) Coefficients: Estimate Std. Error t value Pr(> t ) (Intercept) e-13 X e-09 X e-05 Multiple R-squared: , Adjusted R-squ.: F-statistic: 72.5 on 2 and 17 DF, p-value: 4.77e-09
35 Insur. Innov n (CH08TA02) (cont d) ANOVA table (with sequential SSRs): > CH08TA02.lm = lm( Y ~ X1 + X2 ) > anova( CH08TA02.lm ) Analysis of Variance Table Response: Y Df Sum Sq Mean Sq F value Pr(>F) X e-09 X e-05 Resid Partial F* = for X 2 (P = ), so the two types are signif. different (cf. Table 8.3).
36 Insur. Innov n (CH08TA02) (cont d) Pointwise conf. intervals from ANCOVA: > CH08TA02.lm = lm( Y ~ X1 + X2 ) > confint( CH08TA02.lm ) 2.5 % 97.5 % (Intercept) X X So, e.g., if interest is in effect of type of firm (X 2 ), we see stock firms take between 4.98 β months longer to adopt the innovation.
37 Insur. Innov n Data (CH08TA02) (cont d) Scatterplot with separate, equal-slope lines overlaid (cf. Fig. 8.12)
38 If more than 2 levels are represented by the qualitative factor, just include more (parallel) lines: one line for each level of the factor. See, e.g., Fig Multiple-Level ANCOVA
39 Unequal-Slopes ANCOVA How to incorporate differential slopes in a (two-factor/two-level) ANCOVA? Easy! Just add an X 1 X 2 interaction term: E{Y} = β 0 + β 1 X 1 + β 2 X 2 + β 3 X 1 X 2. When X 2 = 0, E{Y} = β 0 + β 1 X 1, an SLR on X 1 with slope β 1 and Y-intercept β 0. When X 2 = 1, E{Y} = (β 0 + β 2 ) + (β 1 + β 3 )X 1, an SLR on X 1 with new slope (β 1 + β 3 ) and new Y-intercept (β 0 + β 2 ).
40 Unequal-Slopes ANCOVA For instance, with the Insur. Innov n Data (CH08TA02), Fig conceptualizes the unequal-slopes model
41 Insur. Innov n (CH08TA02) (cont d) Unequal-slopes ANCOVA in R, via interaction term and * operator: > summary( lm(y ~ X1*X2) ) Call: lm(formula = Y ~ X1 * X2) Coefficients: Estimate Std. Error t value Pr(> t ) (Intercept) e-10 X e-07 X X1:X Multiple R-squared: , Adjusted R-squ.: F-statistic: on 3 and 16 DF, p-val.: 4.68e-08
42 Insur. Innov n (CH08TA02) (cont d) ANOVA table (with sequential SSRs) for unequalslopes ANCOVA model: > anova( lm(y ~ X1*X2) ) Analysis of Variance Table Response: Y Df Sum Sq Mean Sq F value Pr(>F) X e-09 X e-05 X1:X Resid X1*X2 interaction P-value >.05, so no signif. departure from equal slopes is indicated (cf. Table 8.4)
43 8.6: Multi-Factor ANCOVA The ANCOVA model can be extended to more than one quantitative X-variable. The concepts are essentially unchanged, just in a higher-dimensional space: the hyperplanes are all parallel and the qualitative predictor changes locations of the hyper-intercepts. Sounds trickier, but not really that different and not much harder to program.
44 Only Qualitative Predictors What if all the predictor variables are qualitative (0-1) indicators? In effect, the model structure is more circumspect, since we are now just comparing the mean responses across the levels of each qualitative factor. This is known as ANOVA modeling, and is studied in STAT 571B.
45 8.7: Comparing Multiple Regression Curves Let s do a fully coordinated example of how to compare two regression functions. Example: Production Line Data (CH08TA05) with Y = Soap Production Scrap X 1 = Product n Line Speed X 2 = Line Indicator (Line 1 vs. Line 2) Start with a scatterplot
46 Plot shows dual linear relationship, indexed by prod n line Sec. 8.7: Product n Line Data (CH08TA05) Scatterplot
47 Product n Line Data (CH08TA05) (cont d) Unequal-slopes ANCOVA in R, via interaction term and * operator: > summary( lm(y ~ X1*X2) ) Call: lm(formula = Y ~ X1 * X2) Coefficients: Estimate Std. Error t value Pr(> t ) (Intercept) X e-13 X X1:X Multiple R-squ.: , Adjusted R-squ.: F-statistic: on 3 and 23 DF, p-val.: 1.34e-14
48 Product n Line Data (CH08TA05) (cont d) Per-line residual plots (cf. Fig. 8.17):
49 Product n Line Data (CH08TA05) (cont d) Brown-Forsythe test for equal σ 2 between the two product n lines shows insignif. P = 0.53: > library( lawstat ) > BF.htest = levene.test( resid( CH08TA05.lm ), group=x2, location= median ) modified robust Brown-Forsythe Levene-type test based on the absolute deviations from the median data: ei Test Statistic = , p-value = > sqrt( BF.htest$statistic ) Test Statistic #BF t*-stat. (cf. p.333)
50 Product n Line Data (CH08TA05) (cont d) ANOVA table (with sequential SSRs) for unequalslopes model: > anova( lm(y ~ X1*X2) ) Analysis of Variance Table Response: Y Df Sum Sq Mean Sq F value Pr(>F) X e-15 X e-06 X1:X Residuals (cf. Table 8.6)
51 Product n Line Data (CH08TA05) (cont d) ANOVA partial F-test for identity of lines (H o :β 2 =β 3 =0): > anova( lm(y ~ X1), lm(y ~ X1*X2) ) Analysis of Variance Table Model 1: Y ~ X1 Model 2: Y ~ X1 * X2 Res.Df RSS Df Sum of Sq F Pr(>F) e-06 2 d.f. partial F* = (P = ), so two lines are significantly different (somehow).
52 Product n Line Data (CH08TA05) (cont d) ANOVA partial F-test for identity of slopes (H o :β 3 = 0): > anova( lm(y ~ X1+X2), lm(y ~ X1*X2) ) Analysis of Variance Table Model 1: Y ~ X1 + X2 Model 2: Y ~ X1 * X2 Res.Df RSS Df Sum of Sq F Pr(>F) d.f. partial F* = 1.88 (P = ), so two lines have insignificantly different slopes. (NB: Should adjust the 2 inferences on β 2 and β 3 for multiplicity.)
STAT 571A Advanced Statistical Regression Analysis. Chapter 3 NOTES Diagnostics and Remedial Measures
STAT 571A Advanced Statistical Regression Analysis Chapter 3 NOTES Diagnostics and Remedial Measures 2015 University of Arizona Statistics GIDP. All rights reserved, except where previous rights exist.
More informationDiagnostics and Transformations Part 2
Diagnostics and Transformations Part 2 Bivariate Linear Regression James H. Steiger Department of Psychology and Human Development Vanderbilt University Multilevel Regression Modeling, 2009 Diagnostics
More information1 Multiple Regression
1 Multiple Regression In this section, we extend the linear model to the case of several quantitative explanatory variables. There are many issues involved in this problem and this section serves only
More informationMODELS WITHOUT AN INTERCEPT
Consider the balanced two factor design MODELS WITHOUT AN INTERCEPT Factor A 3 levels, indexed j 0, 1, 2; Factor B 5 levels, indexed l 0, 1, 2, 3, 4; n jl 4 replicate observations for each factor level
More informationRegression and the 2-Sample t
Regression and the 2-Sample t James H. Steiger Department of Psychology and Human Development Vanderbilt University James H. Steiger (Vanderbilt University) Regression and the 2-Sample t 1 / 44 Regression
More informationChapter 8 Quantitative and Qualitative Predictors
STAT 525 FALL 2017 Chapter 8 Quantitative and Qualitative Predictors Professor Dabao Zhang Polynomial Regression Multiple regression using X 2 i, X3 i, etc as additional predictors Generates quadratic,
More informationLecture 18 Miscellaneous Topics in Multiple Regression
Lecture 18 Miscellaneous Topics in Multiple Regression STAT 512 Spring 2011 Background Reading KNNL: 8.1-8.5,10.1, 11, 12 18-1 Topic Overview Polynomial Models (8.1) Interaction Models (8.2) Qualitative
More informationRecall that a measure of fit is the sum of squared residuals: where. The F-test statistic may be written as:
1 Joint hypotheses The null and alternative hypotheses can usually be interpreted as a restricted model ( ) and an model ( ). In our example: Note that if the model fits significantly better than the restricted
More informationTests of Linear Restrictions
Tests of Linear Restrictions 1. Linear Restricted in Regression Models In this tutorial, we consider tests on general linear restrictions on regression coefficients. In other tutorials, we examine some
More informationStatistics GIDP Ph.D. Qualifying Exam Methodology
Statistics GIDP Ph.D. Qualifying Exam Methodology January 9, 2018, 9:00am 1:00pm Instructions: Put your ID (not your name) on each sheet. Complete exactly 5 of 6 problems; turn in only those sheets you
More informationRegression, Part I. - In correlation, it would be irrelevant if we changed the axes on our graph.
Regression, Part I I. Difference from correlation. II. Basic idea: A) Correlation describes the relationship between two variables, where neither is independent or a predictor. - In correlation, it would
More informationAnalysis of variance. Gilles Guillot. September 30, Gilles Guillot September 30, / 29
Analysis of variance Gilles Guillot gigu@dtu.dk September 30, 2013 Gilles Guillot (gigu@dtu.dk) September 30, 2013 1 / 29 1 Introductory example 2 One-way ANOVA 3 Two-way ANOVA 4 Two-way ANOVA with interactions
More information1 Use of indicator random variables. (Chapter 8)
1 Use of indicator random variables. (Chapter 8) let I(A) = 1 if the event A occurs, and I(A) = 0 otherwise. I(A) is referred to as the indicator of the event A. The notation I A is often used. 1 2 Fitting
More informationMATH 644: Regression Analysis Methods
MATH 644: Regression Analysis Methods FINAL EXAM Fall, 2012 INSTRUCTIONS TO STUDENTS: 1. This test contains SIX questions. It comprises ELEVEN printed pages. 2. Answer ALL questions for a total of 100
More information36-707: Regression Analysis Homework Solutions. Homework 3
36-707: Regression Analysis Homework Solutions Homework 3 Fall 2012 Problem 1 Y i = βx i + ɛ i, i {1, 2,..., n}. (a) Find the LS estimator of β: RSS = Σ n i=1(y i βx i ) 2 RSS β = Σ n i=1( 2X i )(Y i βx
More informationStat 5303 (Oehlert): Analysis of CR Designs; January
Stat 5303 (Oehlert): Analysis of CR Designs; January 2016 1 > resin
More informationLecture 10 Multiple Linear Regression
Lecture 10 Multiple Linear Regression STAT 512 Spring 2011 Background Reading KNNL: 6.1-6.5 10-1 Topic Overview Multiple Linear Regression Model 10-2 Data for Multiple Regression Y i is the response variable
More informationInference for Regression
Inference for Regression Section 9.4 Cathy Poliak, Ph.D. cathy@math.uh.edu Office in Fleming 11c Department of Mathematics University of Houston Lecture 13b - 3339 Cathy Poliak, Ph.D. cathy@math.uh.edu
More informationStat 5102 Final Exam May 14, 2015
Stat 5102 Final Exam May 14, 2015 Name Student ID The exam is closed book and closed notes. You may use three 8 1 11 2 sheets of paper with formulas, etc. You may also use the handouts on brand name distributions
More informationMultiple Linear Regression. Chapter 12
13 Multiple Linear Regression Chapter 12 Multiple Regression Analysis Definition The multiple regression model equation is Y = b 0 + b 1 x 1 + b 2 x 2 +... + b p x p + ε where E(ε) = 0 and Var(ε) = s 2.
More informationExample: 1982 State SAT Scores (First year state by state data available)
Lecture 11 Review Section 3.5 from last Monday (on board) Overview of today s example (on board) Section 3.6, Continued: Nested F tests, review on board first Section 3.4: Interaction for quantitative
More informationChapter 8: Regression Models with Qualitative Predictors
Chapter 8: Regression Models with Qualitative Predictors Some predictors may be binary (e.g., male/female) or otherwise categorical (e.g., small/medium/large). These typically enter the regression model
More informationMultiple Regression: Example
Multiple Regression: Example Cobb-Douglas Production Function The Cobb-Douglas production function for observed economic data i = 1,..., n may be expressed as where O i is output l i is labour input c
More informationStat 412/512 TWO WAY ANOVA. Charlotte Wickham. stat512.cwick.co.nz. Feb
Stat 42/52 TWO WAY ANOVA Feb 6 25 Charlotte Wickham stat52.cwick.co.nz Roadmap DONE: Understand what a multiple regression model is. Know how to do inference on single and multiple parameters. Some extra
More informationNature vs. nurture? Lecture 18 - Regression: Inference, Outliers, and Intervals. Regression Output. Conditions for inference.
Understanding regression output from software Nature vs. nurture? Lecture 18 - Regression: Inference, Outliers, and Intervals In 1966 Cyril Burt published a paper called The genetic determination of differences
More informationR Output for Linear Models using functions lm(), gls() & glm()
LM 04 lm(), gls() &glm() 1 R Output for Linear Models using functions lm(), gls() & glm() Different kinds of output related to linear models can be obtained in R using function lm() {stats} in the base
More informationLecture 2. The Simple Linear Regression Model: Matrix Approach
Lecture 2 The Simple Linear Regression Model: Matrix Approach Matrix algebra Matrix representation of simple linear regression model 1 Vectors and Matrices Where it is necessary to consider a distribution
More informationGeneral Linear Statistical Models - Part III
General Linear Statistical Models - Part III Statistics 135 Autumn 2005 Copyright c 2005 by Mark E. Irwin Interaction Models Lets examine two models involving Weight and Domestic in the cars93 dataset.
More informationInferences for Regression
Inferences for Regression An Example: Body Fat and Waist Size Looking at the relationship between % body fat and waist size (in inches). Here is a scatterplot of our data set: Remembering Regression In
More informationCategorical Predictor Variables
Categorical Predictor Variables We often wish to use categorical (or qualitative) variables as covariates in a regression model. For binary variables (taking on only 2 values, e.g. sex), it is relatively
More informationDensity Temp vs Ratio. temp
Temp Ratio Density 0.00 0.02 0.04 0.06 0.08 0.10 0.12 Density 0.0 0.2 0.4 0.6 0.8 1.0 1. (a) 170 175 180 185 temp 1.0 1.5 2.0 2.5 3.0 ratio The histogram shows that the temperature measures have two peaks,
More informationLab 3 A Quick Introduction to Multiple Linear Regression Psychology The Multiple Linear Regression Model
Lab 3 A Quick Introduction to Multiple Linear Regression Psychology 310 Instructions.Work through the lab, saving the output as you go. You will be submitting your assignment as an R Markdown document.
More informationWeek 7 Multiple factors. Ch , Some miscellaneous parts
Week 7 Multiple factors Ch. 18-19, Some miscellaneous parts Multiple Factors Most experiments will involve multiple factors, some of which will be nuisance variables Dealing with these factors requires
More information1 The Classic Bivariate Least Squares Model
Review of Bivariate Linear Regression Contents 1 The Classic Bivariate Least Squares Model 1 1.1 The Setup............................... 1 1.2 An Example Predicting Kids IQ................. 1 2 Evaluating
More informationRegression. Bret Hanlon and Bret Larget. December 8 15, Department of Statistics University of Wisconsin Madison.
Regression Bret Hanlon and Bret Larget Department of Statistics University of Wisconsin Madison December 8 15, 2011 Regression 1 / 55 Example Case Study The proportion of blackness in a male lion s nose
More informationSTA 4210 Practise set 2a
STA 410 Practise set a For all significance tests, use = 0.05 significance level. S.1. A multiple linear regression model is fit, relating household weekly food expenditures (Y, in $100s) to weekly income
More informationBiostatistics 380 Multiple Regression 1. Multiple Regression
Biostatistics 0 Multiple Regression ORIGIN 0 Multiple Regression Multiple Regression is an extension of the technique of linear regression to describe the relationship between a single dependent (response)
More informationSTAT Checking Model Assumptions
STAT 704 --- Checking Model Assumptions Recall we assumed the following in our model: (1) The regression relationship between the response and the predictor(s) specified in the model is appropriate (2)
More informationSTAT5044: Regression and Anova
STAT5044: Regression and Anova Inyoung Kim 1 / 25 Outline 1 Multiple Linear Regression 2 / 25 Basic Idea An extra sum of squares: the marginal reduction in the error sum of squares when one or several
More informationLinear Regression Model. Badr Missaoui
Linear Regression Model Badr Missaoui Introduction What is this course about? It is a course on applied statistics. It comprises 2 hours lectures each week and 1 hour lab sessions/tutorials. We will focus
More informationVariance Decomposition in Regression James M. Murray, Ph.D. University of Wisconsin - La Crosse Updated: October 04, 2017
Variance Decomposition in Regression James M. Murray, Ph.D. University of Wisconsin - La Crosse Updated: October 04, 2017 PDF file location: http://www.murraylax.org/rtutorials/regression_anovatable.pdf
More informationStat 5303 (Oehlert): Models for Interaction 1
Stat 5303 (Oehlert): Models for Interaction 1 > names(emp08.10) Recall the amylase activity data from example 8.10 [1] "atemp" "gtemp" "variety" "amylase" > amylase.data
More informationBIOSTATS 640 Spring 2018 Unit 2. Regression and Correlation (Part 1 of 2) R Users
BIOSTATS 640 Spring 08 Unit. Regression and Correlation (Part of ) R Users Unit Regression and Correlation of - Practice Problems Solutions R Users. In this exercise, you will gain some practice doing
More informationIntroduction to the Analysis of Hierarchical and Longitudinal Data
Introduction to the Analysis of Hierarchical and Longitudinal Data Georges Monette, York University with Ye Sun SPIDA June 7, 2004 1 Graphical overview of selected concepts Nature of hierarchical models
More informationStatistics - Lecture Three. Linear Models. Charlotte Wickham 1.
Statistics - Lecture Three Charlotte Wickham wickham@stat.berkeley.edu http://www.stat.berkeley.edu/~wickham/ Linear Models 1. The Theory 2. Practical Use 3. How to do it in R 4. An example 5. Extensions
More informationMultiple Regression Part I STAT315, 19-20/3/2014
Multiple Regression Part I STAT315, 19-20/3/2014 Regression problem Predictors/independent variables/features Or: Error which can never be eliminated. Our task is to estimate the regression function f.
More informationNC Births, ANOVA & F-tests
Math 158, Spring 2018 Jo Hardin Multiple Regression II R code Decomposition of Sums of Squares (and F-tests) NC Births, ANOVA & F-tests A description of the data is given at http://pages.pomona.edu/~jsh04747/courses/math58/
More informationPart II { Oneway Anova, Simple Linear Regression and ANCOVA with R
Part II { Oneway Anova, Simple Linear Regression and ANCOVA with R Gilles Lamothe February 21, 2017 Contents 1 Anova with one factor 2 1.1 The data.......................................... 2 1.2 A visual
More informationDealing with Heteroskedasticity
Dealing with Heteroskedasticity James H. Steiger Department of Psychology and Human Development Vanderbilt University James H. Steiger (Vanderbilt University) Dealing with Heteroskedasticity 1 / 27 Dealing
More informationVariance Decomposition and Goodness of Fit
Variance Decomposition and Goodness of Fit 1. Example: Monthly Earnings and Years of Education In this tutorial, we will focus on an example that explores the relationship between total monthly earnings
More informationST430 Exam 2 Solutions
ST430 Exam 2 Solutions Date: November 9, 2015 Name: Guideline: You may use one-page (front and back of a standard A4 paper) of notes. No laptop or textbook are permitted but you may use a calculator. Giving
More informationNonlinear Regression
Nonlinear Regression James H. Steiger Department of Psychology and Human Development Vanderbilt University James H. Steiger (Vanderbilt University) Nonlinear Regression 1 / 36 Nonlinear Regression 1 Introduction
More informationExplanatory Variables Must be Linear Independent...
Explanatory Variables Must be Linear Independent... Recall the multiple linear regression model Y j = β 0 + β 1 X 1j + β 2 X 2j + + β p X pj + ε j, i = 1,, n. is a shorthand for n linear relationships
More informationNo other aids are allowed. For example you are not allowed to have any other textbook or past exams.
UNIVERSITY OF TORONTO SCARBOROUGH Department of Computer and Mathematical Sciences Sample Exam Note: This is one of our past exams, In fact the only past exam with R. Before that we were using SAS. In
More informationSCHOOL OF MATHEMATICS AND STATISTICS
RESTRICTED OPEN BOOK EXAMINATION (Not to be removed from the examination hall) Data provided: Statistics Tables by H.R. Neave MAS5052 SCHOOL OF MATHEMATICS AND STATISTICS Basic Statistics Spring Semester
More informationSTAT 572 Assignment 5 - Answers Due: March 2, 2007
1. The file glue.txt contains a data set with the results of an experiment on the dry sheer strength (in pounds per square inch) of birch plywood, bonded with 5 different resin glues A, B, C, D, and E.
More informationExample: Poisondata. 22s:152 Applied Linear Regression. Chapter 8: ANOVA
s:5 Applied Linear Regression Chapter 8: ANOVA Two-way ANOVA Used to compare populations means when the populations are classified by two factors (or categorical variables) For example sex and occupation
More informationGeneral Linear Model (Chapter 4)
General Linear Model (Chapter 4) Outcome variable is considered continuous Simple linear regression Scatterplots OLS is BLUE under basic assumptions MSE estimates residual variance testing regression coefficients
More information> modlyq <- lm(ly poly(x,2,raw=true)) > summary(modlyq) Call: lm(formula = ly poly(x, 2, raw = TRUE))
School of Mathematical Sciences MTH5120 Statistical Modelling I Tutorial 4 Solutions The first two models were looked at last week and both had flaws. The output for the third model with log y and a quadratic
More informationLinear Regression. In this lecture we will study a particular type of regression model: the linear regression model
1 Linear Regression 2 Linear Regression In this lecture we will study a particular type of regression model: the linear regression model We will first consider the case of the model with one predictor
More informationChapter 3 - Linear Regression
Chapter 3 - Linear Regression Lab Solution 1 Problem 9 First we will read the Auto" data. Note that most datasets referred to in the text are in the R package the authors developed. So we just need to
More informationRegression Analysis IV... More MLR and Model Building
Regression Analysis IV... More MLR and Model Building This session finishes up presenting the formal methods of inference based on the MLR model and then begins discussion of "model building" (use of regression
More information6. Multiple Linear Regression
6. Multiple Linear Regression SLR: 1 predictor X, MLR: more than 1 predictor Example data set: Y i = #points scored by UF football team in game i X i1 = #games won by opponent in their last 10 games X
More informationLast updated: Oct 18, 2012 LINEAR REGRESSION PSYC 3031 INTERMEDIATE STATISTICS LABORATORY. J. Elder
Last updated: Oct 18, 2012 LINEAR REGRESSION Acknowledgements 2 Some of these slides have been sourced or modified from slides created by A. Field for Discovering Statistics using R. Simple Linear Objectives
More informationFormal Statement of Simple Linear Regression Model
Formal Statement of Simple Linear Regression Model Y i = β 0 + β 1 X i + ɛ i Y i value of the response variable in the i th trial β 0 and β 1 are parameters X i is a known constant, the value of the predictor
More informationActivity #12: More regression topics: LOWESS; polynomial, nonlinear, robust, quantile; ANOVA as regression
Activity #12: More regression topics: LOWESS; polynomial, nonlinear, robust, quantile; ANOVA as regression Scenario: 31 counts (over a 30-second period) were recorded from a Geiger counter at a nuclear
More informationMATH 423/533 - ASSIGNMENT 4 SOLUTIONS
MATH 423/533 - ASSIGNMENT 4 SOLUTIONS INTRODUCTION This assignment concerns the use of factor predictors in linear regression modelling, and focusses on models with two factors X 1 and X 2 with M 1 and
More information13 Simple Linear Regression
B.Sc./Cert./M.Sc. Qualif. - Statistics: Theory and Practice 3 Simple Linear Regression 3. An industrial example A study was undertaken to determine the effect of stirring rate on the amount of impurity
More informationCAS MA575 Linear Models
CAS MA575 Linear Models Boston University, Fall 2013 Midterm Exam (Correction) Instructor: Cedric Ginestet Date: 22 Oct 2013. Maximal Score: 200pts. Please Note: You will only be graded on work and answers
More informationBooklet of Code and Output for STAC32 Final Exam
Booklet of Code and Output for STAC32 Final Exam December 7, 2017 Figure captions are below the Figures they refer to. LowCalorie LowFat LowCarbo Control 8 2 3 2 9 4 5 2 6 3 4-1 7 5 2 0 3 1 3 3 Figure
More informationMcGill University. Faculty of Science. Department of Mathematics and Statistics. Statistics Part A Comprehensive Exam Methodology Paper
Student Name: ID: McGill University Faculty of Science Department of Mathematics and Statistics Statistics Part A Comprehensive Exam Methodology Paper Date: Friday, May 13, 2016 Time: 13:00 17:00 Instructions
More informationR Demonstration ANCOVA
R Demonstration ANCOVA Objective: The purpose of this week s session is to demonstrate how to perform an analysis of covariance (ANCOVA) in R, and how to plot the regression lines for each level of the
More informationUNIVERSITY OF TORONTO SCARBOROUGH Department of Computer and Mathematical Sciences Midterm Test, October 2013
UNIVERSITY OF TORONTO SCARBOROUGH Department of Computer and Mathematical Sciences Midterm Test, October 2013 STAC67H3 Regression Analysis Duration: One hour and fifty minutes Last Name: First Name: Student
More informationACOVA and Interactions
Chapter 15 ACOVA and Interactions Analysis of covariance (ACOVA) incorporates one or more regression variables into an analysis of variance. As such, we can think of it as analogous to the two-way ANOVA
More informationRegression and Models with Multiple Factors. Ch. 17, 18
Regression and Models with Multiple Factors Ch. 17, 18 Mass 15 20 25 Scatter Plot 70 75 80 Snout-Vent Length Mass 15 20 25 Linear Regression 70 75 80 Snout-Vent Length Least-squares The method of least
More informationInference with Heteroskedasticity
Inference with Heteroskedasticity Note on required packages: The following code requires the packages sandwich and lmtest to estimate regression error variance that may change with the explanatory variables.
More informationStat 401B Final Exam Fall 2015
Stat 401B Final Exam Fall 015 I have neither given nor received unauthorized assistance on this exam. Name Signed Date Name Printed ATTENTION! Incorrect numerical answers unaccompanied by supporting reasoning
More informationFigure 1: The fitted line using the shipment route-number of ampules data. STAT5044: Regression and ANOVA The Solution of Homework #2 Inyoung Kim
0.0 1.0 1.5 2.0 2.5 3.0 8 10 12 14 16 18 20 22 y x Figure 1: The fitted line using the shipment route-number of ampules data STAT5044: Regression and ANOVA The Solution of Homework #2 Inyoung Kim Problem#
More informationSTAT 3022 Spring 2007
Simple Linear Regression Example These commands reproduce what we did in class. You should enter these in R and see what they do. Start by typing > set.seed(42) to reset the random number generator so
More informationFinal Review. Yang Feng. Yang Feng (Columbia University) Final Review 1 / 58
Final Review Yang Feng http://www.stat.columbia.edu/~yangfeng Yang Feng (Columbia University) Final Review 1 / 58 Outline 1 Multiple Linear Regression (Estimation, Inference) 2 Special Topics for Multiple
More informationRegression. Marc H. Mehlman University of New Haven
Regression Marc H. Mehlman marcmehlman@yahoo.com University of New Haven the statistician knows that in nature there never was a normal distribution, there never was a straight line, yet with normal and
More informationMODULE 4 SIMPLE LINEAR REGRESSION
MODULE 4 SIMPLE LINEAR REGRESSION Module Objectives: 1. Describe the equation of a line including the meanings of the two parameters. 2. Describe how the best-fit line to a set of bivariate data is derived.
More informationRegression with Polynomials and Interactions
Regression with Polynomials and Interactions Nathaniel E. Helwig Assistant Professor of Psychology and Statistics University of Minnesota (Twin Cities) Updated 04-Jan-2017 Nathaniel E. Helwig (U of Minnesota)
More informationStats fest Analysis of variance. Single factor ANOVA. Aims. Single factor ANOVA. Data
1 Stats fest 2007 Analysis of variance murray.logan@sci.monash.edu.au Single factor ANOVA 2 Aims Description Investigate differences between population means Explanation How much of the variation in response
More informationApplied Regression Modeling: A Business Approach Chapter 3: Multiple Linear Regression Sections
Applied Regression Modeling: A Business Approach Chapter 3: Multiple Linear Regression Sections 3.4 3.6 by Iain Pardoe 3.4 Model assumptions 2 Regression model assumptions.............................................
More informationStatistics 5100 Spring 2018 Exam 1
Statistics 5100 Spring 2018 Exam 1 Directions: You have 60 minutes to complete the exam. Be sure to answer every question, and do not spend too much time on any part of any question. Be concise with all
More informationAcknowledgements. Outline. Marie Diener-West. ICTR Leadership / Team INTRODUCTION TO CLINICAL RESEARCH. Introduction to Linear Regression
INTRODUCTION TO CLINICAL RESEARCH Introduction to Linear Regression Karen Bandeen-Roche, Ph.D. July 17, 2012 Acknowledgements Marie Diener-West Rick Thompson ICTR Leadership / Team JHU Intro to Clinical
More informationMultiple Predictor Variables: ANOVA
What if you manipulate two factors? Multiple Predictor Variables: ANOVA Block 1 Block 2 Block 3 Block 4 A B C D B C D A C D A B D A B C Randomized Controlled Blocked Design: Design where each treatment
More informationBIOL 933!! Lab 10!! Fall Topic 13: Covariance Analysis
BIOL 933!! Lab 10!! Fall 2017 Topic 13: Covariance Analysis Covariable as a tool for increasing precision Carrying out a full ANCOVA Testing ANOVA assumptions Happiness Covariables as Tools for Increasing
More informationR 2 and F -Tests and ANOVA
R 2 and F -Tests and ANOVA December 6, 2018 1 Partition of Sums of Squares The distance from any point y i in a collection of data, to the mean of the data ȳ, is the deviation, written as y i ȳ. Definition.
More informationInference. ME104: Linear Regression Analysis Kenneth Benoit. August 15, August 15, 2012 Lecture 3 Multiple linear regression 1 1 / 58
Inference ME104: Linear Regression Analysis Kenneth Benoit August 15, 2012 August 15, 2012 Lecture 3 Multiple linear regression 1 1 / 58 Stata output resvisited. reg votes1st spend_total incumb minister
More informationChaper 5: Matrix Approach to Simple Linear Regression. Matrix: A m by n matrix B is a grid of numbers with m rows and n columns. B = b 11 b m1 ...
Chaper 5: Matrix Approach to Simple Linear Regression Matrix: A m by n matrix B is a grid of numbers with m rows and n columns B = b 11 b 1n b m1 b mn Element b ik is from the ith row and kth column A
More informationWorkshop 7.4a: Single factor ANOVA
-1- Workshop 7.4a: Single factor ANOVA Murray Logan November 23, 2016 Table of contents 1 Revision 1 2 Anova Parameterization 2 3 Partitioning of variance (ANOVA) 10 4 Worked Examples 13 1. Revision 1.1.
More informationStat 411/511 ESTIMATING THE SLOPE AND INTERCEPT. Charlotte Wickham. stat511.cwick.co.nz. Nov
Stat 411/511 ESTIMATING THE SLOPE AND INTERCEPT Nov 20 2015 Charlotte Wickham stat511.cwick.co.nz Quiz #4 This weekend, don t forget. Usual format Assumptions Display 7.5 p. 180 The ideal normal, simple
More informationUNIVERSITY OF MASSACHUSETTS Department of Mathematics and Statistics Basic Exam - Applied Statistics January, 2018
UNIVERSITY OF MASSACHUSETTS Department of Mathematics and Statistics Basic Exam - Applied Statistics January, 2018 Work all problems. 60 points needed to pass at the Masters level, 75 to pass at the PhD
More informationFACTORIAL DESIGNS and NESTED DESIGNS
Experimental Design and Statistical Methods Workshop FACTORIAL DESIGNS and NESTED DESIGNS Jesús Piedrafita Arilla jesus.piedrafita@uab.cat Departament de Ciència Animal i dels Aliments Items Factorial
More informationSTK4900/ Lecture 3. Program
STK4900/9900 - Lecture 3 Program 1. Multiple regression: Data structure and basic questions 2. The multiple linear regression model 3. Categorical predictors 4. Planned experiments and observational studies
More informationLecture 10. Factorial experiments (2-way ANOVA etc)
Lecture 10. Factorial experiments (2-way ANOVA etc) Jesper Rydén Matematiska institutionen, Uppsala universitet jesper@math.uu.se Regression and Analysis of Variance autumn 2014 A factorial experiment
More informationSTAT 3900/4950 MIDTERM TWO Name: Spring, 2015 (print: first last ) Covered topics: Two-way ANOVA, ANCOVA, SLR, MLR and correlation analysis
STAT 3900/4950 MIDTERM TWO Name: Spring, 205 (print: first last ) Covered topics: Two-way ANOVA, ANCOVA, SLR, MLR and correlation analysis Instructions: You may use your books, notes, and SPSS/SAS. NO
More informationDesign of Engineering Experiments Chapter 5 Introduction to Factorials
Design of Engineering Experiments Chapter 5 Introduction to Factorials Text reference, Chapter 5 page 170 General principles of factorial experiments The two-factor factorial with fixed effects The ANOVA
More information