Stat 6601 project linear statistical models analysis of covariance example
This presentation is the property of its rightful owner.
Sponsored Links
1 / 11

Stat 6601 project Linear Statistical Models Analysis of Covariance Example PowerPoint PPT Presentation


  • 88 Views
  • Uploaded on
  • Presentation posted in: General

Stat 6601 project Linear Statistical Models Analysis of Covariance Example. By Gadir Marian Myrna Moreno. Data.

Download Presentation

Stat 6601 project Linear Statistical Models Analysis of Covariance Example

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Stat 6601 project linear statistical models analysis of covariance example

Stat 6601 project Linear Statistical ModelsAnalysis of Covariance Example

By

Gadir Marian

Myrna Moreno


Stat 6601 project linear statistical models analysis of covariance example

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)


Stat 6601 project linear statistical models analysis of covariance example

Goal

  • Assess the effect of the insulation on gas consumption.


Plotting the data

Plotting the data


Method

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.


Method continued

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.


Codes

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 <- lm(Gas ~ Temp, whiteside, subset = Insul=="Before")

  • gasA <- update(gasB, subset = Insul=="After")

  • summary(gasB)

  • summary(gasA)

  • gasBA <- lm(Gas ~ Insul/Temp - 1, whiteside)

  • summary(gasBA)

  • gasQ <- lm(Gas ~ Insul/(Temp + I(Temp^2)) - 1, whiteside) summary(gasQ)$coef

  • gasPR <- lm(Gas ~ Insul + Temp, whiteside)

  • anova(gasPR, gasBA)

  • options(contrasts = c("contr.treatment", "contr.poly"))

  • gasBA1 <- lm(Gas ~ Insul*Temp, whiteside)

  • summary(gasBA1)$coef


Results

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(>|t|)

    InsulBefore 6.85383 0.13596 50.41 <2e-16 ***

    InsulAfter 4.72385 0.11810 40.00 <2e-16 ***

    InsulBefore:Temp -0.39324 0.02249 -17.49 <2e-16 ***

    InsulAfter:Temp -0.27793 0.02292 -12.12 <2e-16 ***

    Residual standard error: 0.323 on 52 degrees of freedom


Results continued

Results(continued)

The output by fitting quadratic regression model:

Estimate Std. Error t value Pr(>|t|)

InsulBefore 6.759215179 0.150786777 44.826312 4.854615e-42

InsulAfter 4.496373920 0.160667904 27.985514 3.302572e-32

InsulBefore:Temp -0.31765873 0.062965170 -5.044991 6.362323e-06

InsulAfter:Temp -0.137901603 0.073058019 -1.887563 6.489554e-02

InsulBefore:I(Temp^2) -0.008472572 0.006624737 -1.278930 2.068259e-01

InsulAfter:I(Temp^2) -0.014979455 0.007447107 -2.011446 4.968398e-02


Results continued1

Results(continued)

The output from the ANOVA

Estimate Std. Error t value Pr(>|t|)

(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

InsulAfter:Temp 0.1153039 0.03211212 3.590665 7.306852e-04


Summary

Summary

  • Whiteside data

  • Fitting Linear Regression Model

  • Fitting Quadratic Regression Model


  • Login