DOC PREVIEW
UW-Madison STAT 572 - Handouts - Multiple Linear Regression Case Study

This preview shows page 1-2-3 out of 8 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Case StudyBirds and BatsMultiple Linear Regression Case StudyBret LargetDepartments of Botany and of StatisticsUniversity of Wisconsin—MadisonFebruary 5, 20081 / 15Birds and BatsBirds and bats must expend considerable energy to fly.Some bats use echolocation in flight which also requires energy.Other bats eat fruit and do not have the ability to echolocate.Scientists studied energy use of several species of birds and bats toexamine the relationship between mass and energy expenditure duringflight to see if echolocating bats had a higher cost.Variables are mass (grams), type (factor with levels bird, eBat, andnBat, latter two for echolocating and non-echolocating), and theresponse energy (Watts).Case Study Birds and Bats 2 / 15Data> bats = read.table("bats.txt", header = T)> batsspecies mass type energy1 PteropusGouldi 779.0 nBat 43.702 PteropusPoliocephalus 628.0 nBat 34.803 HypsignathusMonstrosus 258.0 nBat 23.304 EidolonHelvum 315.0 nBat 22.405 MeliphagaVirescens 24.3 bird 2.466 MelipsittacusUndulatus 35.0 bird 3.937 SturmisVulgaris 72.8 bird 9.158 FalcoSpaverius 120.0 bird 13.809 FalcoTinnunculus 213.0 bird 14.6010 CorvusOssifragus 275.0 bird 22.8011 LarusAtricilla 370.0 bird 26.2012 ColumbaLivia 384.0 bird 25.9013 ColumbaLivia 442.0 bird 29.5014 ColumbaLivia 412.0 bird 43.7015 ColumbaLivia 330.0 bird 34.0016 CorvusCrytoleucos 480.0 bird 27.8017 PhyllostomasHastatus 93.0 eBat 8.8318 PlecotusAuritus 8.0 eBat 1.3519 PipistrellusPipistrellus 6.7 eBat 1.1220 PlecotusAuritus 7.7 eBat 1.02Notice that both mass andenergy span different orders ofmagnitude.The two bat types are quitedifferent in mass.Birds fill the gap.Each observation corresponds toa single study.Some studies are on the samespecies.Case Study Birds and Bats 3 / 15Box-and-Whisker Plotsmass0200400600800bird eBat nBat●●●energy010203040bird eBat nBat●●●Case Study Birds and Bats 4 / 15Scatterplotmassenergy0102030400 200 400 600 800●●●●●●●●●●●●bird eBat nBat●Case Study Birds and Bats 5 / 15ObservationsThe scatterplot reveals potential problems with fitting a standardregression model:ITwo bird observations appear to b e potential outliers;IThere is some apparent curvature;IPoints with high mass have more variable energy measurements thanpoints with low mass;We will, however, fit a few models to illustrate the method and toshow how these potential problems can be identified more readily withresidual plots.Case Study Birds and Bats 6 / 15Fitting Models> fit0 = lm(energy ~ mass,+ data = bats)> fit1 = lm(energy ~ mass ++ type, data = bats)> fit2 = lm(energy ~ mass *+ type, data = bats)fit0 is a simple linearregression of energy on massfit1 adds type as an inputvariable. This has the effect ofallowing the intercept to bedifferent for each type.fit2 has mass and type and aninteraction between them. Thishas allows each type to have itsown slope and intercept.Case Study Birds and Bats 7 / 15Plots of Fitted Modelsmassenergy0102030400 200 400 600 800●●●●●●●●●●●●bird eBat nBat●massenergy0102030400 200 400 600 800●●●●●●●●●●●●bird eBat nBat●massenergy0102030400 200 400 600 800●●●●●●●●●●●●bird eBat nBat●Case Study Birds and Bats 8 / 15Estimated Coefficients> coef(fit0)(Intercept) mass4.09991727 0.05869642fit0 shows the intercept and parameter for mass which is the slope.Case Study Birds and Bats 9 / 15Estimated Coefficients> coef(fit1)(Intercept) mass typeeBat typenBat6.02197707 0.05749542 -4.60071984 -3.43220829fit1 shows an intercept for all predictions, a parameter for masswhich is the common slope, and then adjustments to be made if thetype is eBat or nBat.In effect, these are estimated differences of the intercept relative tobird.For birds, the intercept is 6.02.For echolocating bats the intercept is 6.02 + (−4.6) = 1.42.For non-echolocating bats the intercept is 6.02 + (−3.43) = 2.59.The three lines are parallel and share the common slope 0.0575.Case Study Birds and Bats 10 / 15Estimated Coefficients> coef(fit2)(Intercept) mass typeeBat typenBat3.31674159 0.06777464 -2.82275855 7.91064213mass:typeeBat mass:typenBat0.02186199 -0.02772895fit2 shows six estimated coefficients, the intercept and slope forbird and then adjustments to each of these for the other types.For birds, the intercept is 3.32 and the slope is 0.0678.For echolocating bats the intercept is 3.32 + (−2.82) = 0.494 and theslope is 0.0678 + (0.0219) = 0.0896For non-echolocating bats the intercept is 3.32 + (7.91) = 11.2 andthe slope is 0.0678 + (−0.0277) = 0.04Case Study Birds and Bats 11 / 15Interpretation of Coefficients> coef(fit2)(Intercept) mass typeeBat typenBat3.31674159 0.06777464 -2.82275855 7.91064213mass:typeeBat mass:typenBat0.02186199 -0.02772895The intercept is the predicted energy of a bird at mass 0 — nobiological relevance.The third coefficient is the estimated difference between the predictedenergies for echolocating bats and birds at mass 0.Notice that the predicted difference is not the same at all masses.This parameter has no biological significance also.Similar comments can be made about the non-echolocating bats — inparticular, even though the intercept for non-echolocating bats ishigher than for birds, at the range of mass where there are both birdsand non-echolocating bats, the bird line is higher.Case Study Birds and Bats 12 / 15Residual Plot> plot(xyplot(residuals(fit2) ~+ fitted(fit2), pch = 16))Residual plot from last fit.Notice the fan-shaped pattern.Residuals are larger for largemass.A transformation may help.fitted(fit2)residuals(fit2)−505100 10 20 30 40●●●●●●●●●●●●●●●●●●●●Case Study Birds and Bats 13 / 15Log Transformed DataLog transformation of bothvariables leads to data thatbetter fits linear modelassumptions.log(mass)log(energy)01232 3 4 5 6●●●●●●●●●●●●bird eBat nBat●Case Study Birds and Bats 14 / 15More AnalysisDo remaining analysis live in R.Case Study Birds and Bats 15 /


View Full Document

UW-Madison STAT 572 - Handouts - Multiple Linear Regression Case Study

Download Handouts - Multiple Linear Regression Case Study
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Handouts - Multiple Linear Regression Case Study and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Handouts - Multiple Linear Regression Case Study 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?