Stat 6601 project Linear Statistical Models Analysis of Covariance Example

1 / 11
About This Presentation
Title:

Stat 6601 project Linear Statistical Models Analysis of Covariance Example

Description:

... his house during two heating seasons' one before and after cavity-wall ... Residual standard error: 0.323 on 52 degrees of freedom. Results(continued) ... –

Number of Views:68
Avg rating:3.0/5.0
Slides: 12
Provided by: MD158
Category:

less

Transcript and Presenter's Notes

Title: Stat 6601 project Linear Statistical Models Analysis of Covariance Example


1
Stat 6601 project Linear Statistical
Models Analysis of Covariance Example
  • By
  • Gadir Marian
  • Myrna Moreno

2
Data
  • Whiteside data, Mr. Derek recorded weekly gas
    consumption and average external temperature at
    his house during two heating seasons one before
    and after cavity-wall insulation was installed.
  • Variables
  • - Insul (levels before or after insulation)
  • - Temp (the average outside temperature in
  • degrees Celsius)
  • -Gas (The weekly gas consumption in 1000
  • cubic feet units)

3
Goal
  • Assess the effect of the insulation on gas
    consumption.

4
Plotting the data
5
Method
  • Linear Model for Analysis of Covariance
  • Y ? X? ?
  • Where
  • ? is a random effect due to treatment.
  • ? is a fixed effect due to covariate.
  • ? is a random error.

6
Method(continued)
  • Using R
  • -A primary model is fitted using a model
  • fitting function
  • lm (formula, data, weights, subset,
    na.action)
  • - A resulting fitted model object can be
  • analysed, interrogated or modified.

7
Codes
  • require(latice)
  • xyplot(Gas Temp Insul, whiteside, panel
  • function(x, y, ...)
  • panel.xyplot(x, y, ...)
  • panel.lmline(x, y, ...)
  • , xlab "Average external temperature (deg.
    C)",
  • ylab "Gas consumption (1000 cubic feet)",
    aspect "xy",
  • strip function(...) strip.default(..., style
    1))
  • gasB lt- lm(Gas Temp, whiteside, subset
    Insul"Before")
  • gasA lt- update(gasB, subset Insul"After")
  • summary(gasB)
  • summary(gasA)
  • gasBA lt- lm(Gas Insul/Temp - 1, whiteside)
  • summary(gasBA)
  • gasQ lt- lm(Gas Insul/(Temp I(Temp2)) - 1,
    whiteside) summary(gasQ)coef
  • gasPR lt- lm(Gas Insul Temp, whiteside)
  • anova(gasPR, gasBA)
  • options(contrasts c("contr.treatment",
    "contr.poly"))
  • gasBA1 lt- lm(Gas InsulTemp, whiteside)

8
Results
  • The output from fitting regression model
  • Residuals
  • Min 1Q Median 3Q Max
  • -0.97802 -0.18011 0.03757 0.20930 0.63803
  • Coefficients
  • Estimate Std. Error
    t value Pr(gtt)
  • InsulBefore 6.85383 0.13596
    50.41 lt2e-16
  • InsulAfter 4.72385 0.11810
    40.00 lt2e-16
  • InsulBeforeTemp -0.39324 0.02249 -17.49
    lt2e-16
  • InsulAfterTemp -0.27793 0.02292 -12.12
    lt2e-16
  • Residual standard error 0.323 on 52 degrees of
    freedom

9
Results(continued)
  • The output by fitting quadratic regression
    model

  • Estimate Std. Error
    t value Pr(gtt)
  • InsulBefore 6.759215179
    0.150786777 44.826312 4.854615e-42
  • InsulAfter 4.496373920
    0.160667904 27.985514 3.302572e-32
  • InsulBeforeTemp -0.31765873 0.062965170
    -5.044991 6.362323e-06
  • InsulAfterTemp -0.137901603 0.073058019
    -1.887563 6.489554e-02
  • InsulBeforeI(Temp2) -0.008472572 0.006624737
    -1.278930 2.068259e-01
  • InsulAfterI(Temp2) -0.014979455 0.007447107
    -2.011446 4.968398e-02

10
Results(continued)
  • The output from the ANOVA
  • Estimate Std.
    Error t value Pr(gtt)
  • (Intercept) 6.8538277 0.13596397
    50.409146 7.997414e-46
  • InsulAfter -2.1299780 0.18009172
    -11.827185 2.315921e-16
  • Temp -0.3932388 0.02248703
    -17.487358 1.976009e-23
  • InsulAfterTemp 0.1153039 0.03211212
    3.590665 7.306852e-04

11
Summary
  • Whiteside data
  • Fitting Linear Regression Model
  • Fitting Quadratic Regression Model
Write a Comment
User Comments (0)
About PowerShow.com