SlideShare une entreprise Scribd logo
1  sur  21
Télécharger pour lire hors ligne
Using R for multilevel modeling of salmon habitat
Yasmin Lucero, Statistical Consultant

Kelly Burnett, PNW Research Station, USFS
Kelly Christiansen, PNW Research Station, USFS
E. Ashley Steel, PNW Research Station, USFS
Eli Holmes, NW Fisheries Science Center, NOAA

Acknowledgements:
NRC-RAP, National Academy of Sciences
ISEMP Monitoring Program, NOAA
Outline

• Background on fish ecology and the data


• Background on multilevel modeling


• Demo of lme4 package in R
The big goal: measure effect of stream
    habitat quality on fish survival




                                                Photo by David Wolman




               Schooling Juvenile Coho Salmon
Land Area Affected by
Endangered Species
Act Listings of Salmon
& Steelhead
* 28 distinct population segments:
6 endangered, 22 threatened

* 176,000 sq. miles in Washington,
Oregon, Idaho & California                   study area
* 61% of Washington’s land area,
55% of Oregon’s, 26% of Idaho’s, &
32% of California’s


                             February 2008
The Data

  ~266 study sites
  Oregon coastal region
  juvenile coho salmon habitat
  sparsely sampled, longitudinal
study design                       Oregon
  12 year time series
  35 data layers
  ~100 landscape level variates
  ~22 habitat level variates
Abundance increases over time due to variation in
Ocean conditions (i.e. external to our analysis)

                                           coho.obs                                                                            coho.obs
                                                              ●




                                                                                              1.0
                                             ●
                                                                                                                                                 ●
                                                                          ●



              8                                                                                                                                                   ●




                                                                                              0.8
                                             ●
                                                                                                                                 ●
                                       ●
                                                                                                                                      ●
                                             ●                                                                                                         ●
              6                                                                                                                             ●
                                                          ●




                                                                                coefficient
                                  ●




                                                                                              0.6
                             ●
fs.coho.obs




                                                                                                                           ●
                                                                                                                ●     ●                                     ●
                                       ●                              ●
                                             ●
                                                          ●   ●
                                       ●
              4                        ●     ●                ●
                                                              ●
                                  ●    ●
                                       ●     ●        ●           ●       ●
                                             ●        ●




                                                                                              0.4
                                                      ●
                             ●         ●
                                  ●    ●
                                       ●     ●                    ●
                                             ●
                                  ●
                                  ●    ●                  ●
                                  ●                   ●
                                                          ●
                   ●              ●                               ●
                   ●              ●
                             ●    ●
                                  ●    ●
              2              ●         ●
                                       ●
                                       ●
                                       ●
                                                                                                     ●




                                                                                              0.2
                        ●              ●
                   ●    ●
                   ●
                   ●    ●
                        ●
                   ●    ●
                   ●                                                                                       ●
                        ●
                        ●
                        ●

              0                                                                                     1998       2000       2002       2004       2006       2008

                  1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009                                                    year
                                            fs.year
Sparsely sampled longitudinal data
 • Only fish data has time                             3.0
                                                            17100201010102                              17100202030201                              17100203020501                   17100203020902


 component                                            2.5
                                                      2.0                                                                                                            ●


 • year effects exogenous
                                                      1.5
                                                      1.0                                   ●                                                   ●                        ●   ●
                                                                    ●                                                   ●       ●                                     ●   ●
                                                      0.5                                                                               ●

 • Landscape data everywhere
                                                                                ●                             ● ● ●                 ●       ●                           ● ● ●                   ●
                                                                                ●                                           ●                                       ●
                                                                                                                                                                    ●
                                                                    ●                                   ● ●                                                                               ● ● ● ● ● ● ●
                                                      0.0                                                                                               ●           ●                ●



 • Habitat data some places
                                                            17100203040402                              17100203040602                              17100203070101                   17100203090101
                                                      3.0                                                                                                       ●

                                                      2.5
 • Fish data some places
                                                                                                                                        ●
                                                      2.0                                                                           ●
                                                                                                                                                                                 ●

                                                      1.5                                                                                                   ●


 • Not always same places
                                                                        ●
                                                                                                                                                ●
                                                      1.0                                                               ●
                                                                                                                            ●
                                                                                                                                            ●
                                        fs.coho.obs   0.5                                                     ●                 ●                   ●
                                                                            ●
                                                      0.0      ●            ●           ●           ●   ● ●       ● ●                                                                ● ● ● ● ● ● ● ● ●

                                                            17100204050303                              17100205040105                              17100205070202                   17100206010504
                                                      3.0
                                                      2.5
                                                      2.0
                                                      1.5                   ●           ● ●
                                                                                                    ●
                                                                                ●
                                                      1.0           ● ●             ●           ●
                                                               ●
                                                      0.5
                                                                                                         ●         ●                                                                      ●     ●
                                                                                                                                                                                     ●
                                                      0.0   ● ● ●                                                  ●            ●           ●       ● ● ● ● ● ● ● ● ● ● ● ●          ●

                                                            17100206010603                              17100303080202                              17100304010604                   17100305060202
                                                      3.0
                                                      2.5
                                                      2.0     ●

                                                      1.5
                                                      1.0                                                       ●
                                                      0.5         ● ● ● ● ●
Figure Legend. Mean density of coho at
                                                                                ●                     ●   ● ●
                                                                            ● ●                     ●   ●     ●           ●
                                                                ●                             ● ● ●               ● ●
                                                                                                                      ●
                                                      0.0 ●                       ● ● ● ● ● ● ●                         ●   ● ●


16 frequently visited sites for 1998–2009                1998 2002 2006 1998 2002 2006 1998 2002 2006 1998 2002 2006
                                                            2000 2004 2008 2000 2004 2008 2000 2004 2008 2000 2004 2008
                                                                                                                                        year
How the landscape data is acquired
                      summarize across area surrounding
   GIS map layers
                                 study site
habitat level data is collected by survey visits:
labor intensive to collect/therefore less abundant

  gradient
  pool density
  debris
  flow rates
  drainage area                 high structure: rocks and woody debris
  channel width
  etc.




  shallow, highly channelized
Multilevel structure for two reasons
Multi-level structure for two reasons:
(1) longitudinal sampling design
(2) varying scales of predictors

       landscape


                   habitat




                              fish
Generalized linear mixed models
(aka hierarchical, multilevel, or random effects models)


     canonical example: school test scores

       class        class        class

       class        class        class

       class        class        class

           school       school       school

                                         state




 student_score ~ class_average + school_average + state_average
state level predictors                  Norm(0, σstate )
                                                   2


                                                                                     state




school level predictors                              Norm(µstate1 , σschool )
                                                                     2


                                                 school 1               school 2               school 3               school 4




  class level predictors   Norm(µschool1 , σclass )
                                            2



                           class 1       class 2                class 3                class 4




student level predictors             Norm(µclass3 , σstudent )
                                                     2



                                     student 1              student 2              student 3              student 4
Our model structure is not so complicated
                                  global




                  landscape level predictors



         site 1          site 2               site 3      site 4




                                  habitat level predictors
                                      & year effects


                      obs 1                obs 2       obs 3       obs 4
Modeling presence/absence of fish:
logistic mixed model with site and year effects
                                        year effects
                    γ ∗ year
logit(Pr{yi = 1}) = βyear xy + β1 xh1 + β1 xh2 + αsite
                    + βh1 xh1 + βh2 xh2 + ...
                    + αsite                     habitat level
                                                 predictors
                                site effects



       αsite ∼ Norm(βl1 xl1 + βl2 xl2 + ...    , σsite )
                                                  2



                        landscape level
                           predictors
Fit a lot of models, some predictors rose to the top
      1300




             m3
             m18
              m5
              m6
             m13
             m11
              m17
             m15
             m1m4
               m9
                    m2
                         m21
                                                                                     Best predictors:
                     m8
                    m12
                        m7


                                                                                     gradient
      1250




                                                                                     debris level
                                                                                     drainage area
      1200
AIC




                                         m14
                                                                                     mean elevation
      1150




                                                      m10
                                                            m32
                                                            m30
                                                              m33
                                                              m34
      1100




                                                            m16
                                                             m29
                                                               m31
                                                                     m25
                                                                     m20
                                                                        m26
                                                                       m28
                                                                     m27
                                                                            m19
                                                                           m23 m22
                                                                               m24



                     −620      −600   −580     −560         −540       −520

                                         logLik
Overall model performance is strong at some
things, weak at others

                           fitted probabilities




                                                                                          1.0
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●




                                                                                          0.8
        800                                                                                                 ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●




                                                               fitted probability
                                                                                                            ●
                                                                                                            ●




                                                                   fitted probabilities
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●




                                                                                          0.6
        600                                                                                                 ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
                                                                                                            ●
count




                                                                                          0.4
                                                                                                            ●
                                                                                                            ●
        400                                                                                                 ●




                                                                                          0.2
                                                                                                            ●
                                                                                                            ●
        200                                                                                                 ●

                                                                                                            ●

                                                                                          0.0
          0
                                                                                                   0        1
              0.0    0.2       0.4        0.6      0.8   1.0
                           fitted(models.ls$m24)
                                                                                                absence   presence
                histogram of fitted probabilities
Another look at model fit: some heavy outliers
                                         ~
                                     pa.obs
s.year + (fs.grad.rs + fs.cfs.down.rs + fs.vol.len.rs + el.mean.rs | catchment
     p/a of coho obs (data)

                              0.8




                                                                           1998   2004
                                                                           1999   2005
                                                                           2000   2006
                                                                           2001   2007
                              0.4




                                                                           2002   2008
                                                                           2003   2009
                              0.0




                                    0.0   0.2   0.4            0.6   0.8          1.0

                                                      fitted
conclusions

• site matters


• we can explain about half of the variation in why site matters
  with 4-5 predictors


• habitat data more valuable than landscape data


• small number of predictions are very wrong, and we can’t seem
  to improve them
Thanks.   yasmin.lucero@gmail.com
Model predicted probabilities given presence/
absence with and without site effects

                                        m0                                                      m1
                      1.0




                                                                              1.0
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                      ●                      ●
                                                                                      ●                      ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                      ●
                                                                                      ●                      ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                      0.8




                                                                              0.8
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
   Pr{coho present}




                                                           Pr{coho present}
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                      0.6




                                                                              0.6
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                      0.4




                                                                              0.4
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                                                                                                             ●
                      0.2




                                                                              0.2
                                                                                                             ●
                                                                                                             ●
                      0.0




                                                                              0.0
                            FALSE                   TRUE                            FALSE                   TRUE

                                    coho presence                                           coho presence

Contenu connexe

En vedette

LA R meetup - Nov 2013 - Eric Klusman
LA R meetup - Nov 2013 - Eric KlusmanLA R meetup - Nov 2013 - Eric Klusman
LA R meetup - Nov 2013 - Eric Klusmanrusersla
 
Statistical Modeling: The Two Cultures
Statistical Modeling: The Two CulturesStatistical Modeling: The Two Cultures
Statistical Modeling: The Two CulturesChristoph Molnar
 
Parent information handout 2014
Parent information handout 2014Parent information handout 2014
Parent information handout 2014Kate Todd
 
Measurement Homework 2
Measurement Homework 2Measurement Homework 2
Measurement Homework 2Kate Todd
 
Questionnaire results
Questionnaire resultsQuestionnaire results
Questionnaire resultsabsallen
 
Gw miller powerpoint
Gw miller powerpointGw miller powerpoint
Gw miller powerpointGeorge Miller
 
O net การงานอาชีพและเทคโนโลยี 50
O net การงานอาชีพและเทคโนโลยี 50O net การงานอาชีพและเทคโนโลยี 50
O net การงานอาชีพและเทคโนโลยี 50Cake WhiteChocolate
 
Los Angeles R users group - Dec 14 2010 - Part 1
Los Angeles R users group - Dec 14 2010 - Part 1Los Angeles R users group - Dec 14 2010 - Part 1
Los Angeles R users group - Dec 14 2010 - Part 1rusersla
 
Kazantzakhs 2
Kazantzakhs 2Kazantzakhs 2
Kazantzakhs 2nikseis
 
基础 02-如何学习《医学英语术语教程》第2版
基础 02-如何学习《医学英语术语教程》第2版基础 02-如何学习《医学英语术语教程》第2版
基础 02-如何学习《医学英语术语教程》第2版ymsyixueyingyu
 

En vedette (10)

LA R meetup - Nov 2013 - Eric Klusman
LA R meetup - Nov 2013 - Eric KlusmanLA R meetup - Nov 2013 - Eric Klusman
LA R meetup - Nov 2013 - Eric Klusman
 
Statistical Modeling: The Two Cultures
Statistical Modeling: The Two CulturesStatistical Modeling: The Two Cultures
Statistical Modeling: The Two Cultures
 
Parent information handout 2014
Parent information handout 2014Parent information handout 2014
Parent information handout 2014
 
Measurement Homework 2
Measurement Homework 2Measurement Homework 2
Measurement Homework 2
 
Questionnaire results
Questionnaire resultsQuestionnaire results
Questionnaire results
 
Gw miller powerpoint
Gw miller powerpointGw miller powerpoint
Gw miller powerpoint
 
O net การงานอาชีพและเทคโนโลยี 50
O net การงานอาชีพและเทคโนโลยี 50O net การงานอาชีพและเทคโนโลยี 50
O net การงานอาชีพและเทคโนโลยี 50
 
Los Angeles R users group - Dec 14 2010 - Part 1
Los Angeles R users group - Dec 14 2010 - Part 1Los Angeles R users group - Dec 14 2010 - Part 1
Los Angeles R users group - Dec 14 2010 - Part 1
 
Kazantzakhs 2
Kazantzakhs 2Kazantzakhs 2
Kazantzakhs 2
 
基础 02-如何学习《医学英语术语教程》第2版
基础 02-如何学习《医学英语术语教程》第2版基础 02-如何学习《医学英语术语教程》第2版
基础 02-如何学习《医学英语术语教程》第2版
 

Similaire à Los Angeles R users group - July 12 2011 - Part 1

Model Visualisation (with ggplot2)
Model Visualisation (with ggplot2)Model Visualisation (with ggplot2)
Model Visualisation (with ggplot2)Hadley Wickham
 
About Vision, Mission And Strategy
About Vision, Mission And StrategyAbout Vision, Mission And Strategy
About Vision, Mission And StrategyGuus Vos
 
Over Visie, Missie En Strategie
Over Visie, Missie En StrategieOver Visie, Missie En Strategie
Over Visie, Missie En StrategieGuus Vos
 
How People Use Facebook -- And Why It Matters
How People Use Facebook -- And Why It MattersHow People Use Facebook -- And Why It Matters
How People Use Facebook -- And Why It MattersMat Morrison
 
研修企画書11 12term voda-カヤック
研修企画書11 12term voda-カヤック研修企画書11 12term voda-カヤック
研修企画書11 12term voda-カヤックaiesecsfc_icx2011
 
研修企画書11-12term voda-カヤック
研修企画書11-12term voda-カヤック研修企画書11-12term voda-カヤック
研修企画書11-12term voda-カヤックaiesecsfc_icx2011
 
Modul mulus bahagian c sjk (modul murid)
Modul mulus bahagian c sjk (modul murid)Modul mulus bahagian c sjk (modul murid)
Modul mulus bahagian c sjk (modul murid)Anparasu
 

Similaire à Los Angeles R users group - July 12 2011 - Part 1 (20)

04 Wrapup
04 Wrapup04 Wrapup
04 Wrapup
 
02 Large
02 Large02 Large
02 Large
 
02 large
02 large02 large
02 large
 
08 Continuous
08 Continuous08 Continuous
08 Continuous
 
08 Continuous
08 Continuous08 Continuous
08 Continuous
 
Model Visualisation (with ggplot2)
Model Visualisation (with ggplot2)Model Visualisation (with ggplot2)
Model Visualisation (with ggplot2)
 
21 Ml
21 Ml21 Ml
21 Ml
 
13 Bivariate
13 Bivariate13 Bivariate
13 Bivariate
 
About Vision, Mission And Strategy
About Vision, Mission And StrategyAbout Vision, Mission And Strategy
About Vision, Mission And Strategy
 
Over Visie, Missie En Strategie
Over Visie, Missie En StrategieOver Visie, Missie En Strategie
Over Visie, Missie En Strategie
 
1 basics
1 basics1 basics
1 basics
 
01 Intro
01 Intro01 Intro
01 Intro
 
How People Use Facebook -- And Why It Matters
How People Use Facebook -- And Why It MattersHow People Use Facebook -- And Why It Matters
How People Use Facebook -- And Why It Matters
 
14 case-study
14 case-study14 case-study
14 case-study
 
17 polishing
17 polishing17 polishing
17 polishing
 
研修企画書11 12term voda-カヤック
研修企画書11 12term voda-カヤック研修企画書11 12term voda-カヤック
研修企画書11 12term voda-カヤック
 
01 intro
01 intro01 intro
01 intro
 
17 Sampling Dist
17 Sampling Dist17 Sampling Dist
17 Sampling Dist
 
研修企画書11-12term voda-カヤック
研修企画書11-12term voda-カヤック研修企画書11-12term voda-カヤック
研修企画書11-12term voda-カヤック
 
Modul mulus bahagian c sjk (modul murid)
Modul mulus bahagian c sjk (modul murid)Modul mulus bahagian c sjk (modul murid)
Modul mulus bahagian c sjk (modul murid)
 

Dernier

Hire 💕 8617697112 Champawat Call Girls Service Call Girls Agency
Hire 💕 8617697112 Champawat Call Girls Service Call Girls AgencyHire 💕 8617697112 Champawat Call Girls Service Call Girls Agency
Hire 💕 8617697112 Champawat Call Girls Service Call Girls AgencyNitya salvi
 
BERMUDA Triangle the mystery of life.pptx
BERMUDA Triangle the mystery of life.pptxBERMUDA Triangle the mystery of life.pptx
BERMUDA Triangle the mystery of life.pptxseri bangash
 
💕📲09602870969💓Girl Escort Services Udaipur Call Girls in Chittorgarh Haldighati
💕📲09602870969💓Girl Escort Services Udaipur Call Girls in Chittorgarh Haldighati💕📲09602870969💓Girl Escort Services Udaipur Call Girls in Chittorgarh Haldighati
💕📲09602870969💓Girl Escort Services Udaipur Call Girls in Chittorgarh HaldighatiApsara Of India
 
08448380779 Call Girls In Chirag Enclave Women Seeking Men
08448380779 Call Girls In Chirag Enclave Women Seeking Men08448380779 Call Girls In Chirag Enclave Women Seeking Men
08448380779 Call Girls In Chirag Enclave Women Seeking MenDelhi Call girls
 
Visa Consultant in Lahore || 📞03094429236
Visa Consultant in Lahore || 📞03094429236Visa Consultant in Lahore || 📞03094429236
Visa Consultant in Lahore || 📞03094429236Sherazi Tours
 
Book Cheap Flight Tickets - TraveljunctionUK
Book  Cheap Flight Tickets - TraveljunctionUKBook  Cheap Flight Tickets - TraveljunctionUK
Book Cheap Flight Tickets - TraveljunctionUKTravel Juncation
 
Hire 💕 8617697112 Chamba Call Girls Service Call Girls Agency
Hire 💕 8617697112 Chamba Call Girls Service Call Girls AgencyHire 💕 8617697112 Chamba Call Girls Service Call Girls Agency
Hire 💕 8617697112 Chamba Call Girls Service Call Girls AgencyNitya salvi
 
08448380779 Call Girls In Bhikaji Cama Palace Women Seeking Men
08448380779 Call Girls In Bhikaji Cama Palace Women Seeking Men08448380779 Call Girls In Bhikaji Cama Palace Women Seeking Men
08448380779 Call Girls In Bhikaji Cama Palace Women Seeking MenDelhi Call girls
 
🔥HOT🔥📲9602870969🔥Prostitute Service in Udaipur Call Girls in City Palace Lake...
🔥HOT🔥📲9602870969🔥Prostitute Service in Udaipur Call Girls in City Palace Lake...🔥HOT🔥📲9602870969🔥Prostitute Service in Udaipur Call Girls in City Palace Lake...
🔥HOT🔥📲9602870969🔥Prostitute Service in Udaipur Call Girls in City Palace Lake...Apsara Of India
 
Top 10 Traditional Indian Handicrafts.pptx
Top 10 Traditional Indian Handicrafts.pptxTop 10 Traditional Indian Handicrafts.pptx
Top 10 Traditional Indian Handicrafts.pptxdishha99
 
visa consultant | 📞📞 03094429236 || Best Study Visa Consultant
visa consultant | 📞📞 03094429236 || Best Study Visa Consultantvisa consultant | 📞📞 03094429236 || Best Study Visa Consultant
visa consultant | 📞📞 03094429236 || Best Study Visa ConsultantSherazi Tours
 
9 Days Kenya Ultimate Safari Odyssey with Kibera Holiday Safaris
9 Days Kenya Ultimate Safari Odyssey with Kibera Holiday Safaris9 Days Kenya Ultimate Safari Odyssey with Kibera Holiday Safaris
9 Days Kenya Ultimate Safari Odyssey with Kibera Holiday SafarisKibera Holiday Safaris Safaris
 
best weekend places near delhi where you should visit.pdf
best weekend places near delhi where you should visit.pdfbest weekend places near delhi where you should visit.pdf
best weekend places near delhi where you should visit.pdftour guide
 
Experience the Magic of Saint Martin and Sint Maarten with Find American Rent...
Experience the Magic of Saint Martin and Sint Maarten with Find American Rent...Experience the Magic of Saint Martin and Sint Maarten with Find American Rent...
Experience the Magic of Saint Martin and Sint Maarten with Find American Rent...Find American Rentals
 
Study Consultants in Lahore || 📞03094429236
Study Consultants in Lahore || 📞03094429236Study Consultants in Lahore || 📞03094429236
Study Consultants in Lahore || 📞03094429236Sherazi Tours
 
DARK TRAVEL AGENCY presented by Khuda Bux
DARK TRAVEL AGENCY presented by Khuda BuxDARK TRAVEL AGENCY presented by Khuda Bux
DARK TRAVEL AGENCY presented by Khuda BuxBeEducate
 
08448380779 Call Girls In Chhattarpur Women Seeking Men
08448380779 Call Girls In Chhattarpur Women Seeking Men08448380779 Call Girls In Chhattarpur Women Seeking Men
08448380779 Call Girls In Chhattarpur Women Seeking MenDelhi Call girls
 

Dernier (20)

Hire 💕 8617697112 Champawat Call Girls Service Call Girls Agency
Hire 💕 8617697112 Champawat Call Girls Service Call Girls AgencyHire 💕 8617697112 Champawat Call Girls Service Call Girls Agency
Hire 💕 8617697112 Champawat Call Girls Service Call Girls Agency
 
BERMUDA Triangle the mystery of life.pptx
BERMUDA Triangle the mystery of life.pptxBERMUDA Triangle the mystery of life.pptx
BERMUDA Triangle the mystery of life.pptx
 
💕📲09602870969💓Girl Escort Services Udaipur Call Girls in Chittorgarh Haldighati
💕📲09602870969💓Girl Escort Services Udaipur Call Girls in Chittorgarh Haldighati💕📲09602870969💓Girl Escort Services Udaipur Call Girls in Chittorgarh Haldighati
💕📲09602870969💓Girl Escort Services Udaipur Call Girls in Chittorgarh Haldighati
 
08448380779 Call Girls In Chirag Enclave Women Seeking Men
08448380779 Call Girls In Chirag Enclave Women Seeking Men08448380779 Call Girls In Chirag Enclave Women Seeking Men
08448380779 Call Girls In Chirag Enclave Women Seeking Men
 
Visa Consultant in Lahore || 📞03094429236
Visa Consultant in Lahore || 📞03094429236Visa Consultant in Lahore || 📞03094429236
Visa Consultant in Lahore || 📞03094429236
 
Book Cheap Flight Tickets - TraveljunctionUK
Book  Cheap Flight Tickets - TraveljunctionUKBook  Cheap Flight Tickets - TraveljunctionUK
Book Cheap Flight Tickets - TraveljunctionUK
 
Hire 💕 8617697112 Chamba Call Girls Service Call Girls Agency
Hire 💕 8617697112 Chamba Call Girls Service Call Girls AgencyHire 💕 8617697112 Chamba Call Girls Service Call Girls Agency
Hire 💕 8617697112 Chamba Call Girls Service Call Girls Agency
 
08448380779 Call Girls In Bhikaji Cama Palace Women Seeking Men
08448380779 Call Girls In Bhikaji Cama Palace Women Seeking Men08448380779 Call Girls In Bhikaji Cama Palace Women Seeking Men
08448380779 Call Girls In Bhikaji Cama Palace Women Seeking Men
 
🔥HOT🔥📲9602870969🔥Prostitute Service in Udaipur Call Girls in City Palace Lake...
🔥HOT🔥📲9602870969🔥Prostitute Service in Udaipur Call Girls in City Palace Lake...🔥HOT🔥📲9602870969🔥Prostitute Service in Udaipur Call Girls in City Palace Lake...
🔥HOT🔥📲9602870969🔥Prostitute Service in Udaipur Call Girls in City Palace Lake...
 
Top 10 Traditional Indian Handicrafts.pptx
Top 10 Traditional Indian Handicrafts.pptxTop 10 Traditional Indian Handicrafts.pptx
Top 10 Traditional Indian Handicrafts.pptx
 
Call Girls Service !! New Friends Colony!! @9999965857 Delhi 🫦 No Advance VV...
Call Girls Service !! New Friends Colony!! @9999965857 Delhi 🫦 No Advance  VV...Call Girls Service !! New Friends Colony!! @9999965857 Delhi 🫦 No Advance  VV...
Call Girls Service !! New Friends Colony!! @9999965857 Delhi 🫦 No Advance VV...
 
visa consultant | 📞📞 03094429236 || Best Study Visa Consultant
visa consultant | 📞📞 03094429236 || Best Study Visa Consultantvisa consultant | 📞📞 03094429236 || Best Study Visa Consultant
visa consultant | 📞📞 03094429236 || Best Study Visa Consultant
 
Call Girls Service !! Indirapuram!! @9999965857 Delhi 🫦 No Advance VVVIP 🍎 S...
Call Girls Service !! Indirapuram!! @9999965857 Delhi 🫦 No Advance  VVVIP 🍎 S...Call Girls Service !! Indirapuram!! @9999965857 Delhi 🫦 No Advance  VVVIP 🍎 S...
Call Girls Service !! Indirapuram!! @9999965857 Delhi 🫦 No Advance VVVIP 🍎 S...
 
9 Days Kenya Ultimate Safari Odyssey with Kibera Holiday Safaris
9 Days Kenya Ultimate Safari Odyssey with Kibera Holiday Safaris9 Days Kenya Ultimate Safari Odyssey with Kibera Holiday Safaris
9 Days Kenya Ultimate Safari Odyssey with Kibera Holiday Safaris
 
best weekend places near delhi where you should visit.pdf
best weekend places near delhi where you should visit.pdfbest weekend places near delhi where you should visit.pdf
best weekend places near delhi where you should visit.pdf
 
Experience the Magic of Saint Martin and Sint Maarten with Find American Rent...
Experience the Magic of Saint Martin and Sint Maarten with Find American Rent...Experience the Magic of Saint Martin and Sint Maarten with Find American Rent...
Experience the Magic of Saint Martin and Sint Maarten with Find American Rent...
 
Call Girls In Munirka 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Munirka 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In Munirka 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Munirka 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
Study Consultants in Lahore || 📞03094429236
Study Consultants in Lahore || 📞03094429236Study Consultants in Lahore || 📞03094429236
Study Consultants in Lahore || 📞03094429236
 
DARK TRAVEL AGENCY presented by Khuda Bux
DARK TRAVEL AGENCY presented by Khuda BuxDARK TRAVEL AGENCY presented by Khuda Bux
DARK TRAVEL AGENCY presented by Khuda Bux
 
08448380779 Call Girls In Chhattarpur Women Seeking Men
08448380779 Call Girls In Chhattarpur Women Seeking Men08448380779 Call Girls In Chhattarpur Women Seeking Men
08448380779 Call Girls In Chhattarpur Women Seeking Men
 

Los Angeles R users group - July 12 2011 - Part 1

  • 1. Using R for multilevel modeling of salmon habitat Yasmin Lucero, Statistical Consultant Kelly Burnett, PNW Research Station, USFS Kelly Christiansen, PNW Research Station, USFS E. Ashley Steel, PNW Research Station, USFS Eli Holmes, NW Fisheries Science Center, NOAA Acknowledgements: NRC-RAP, National Academy of Sciences ISEMP Monitoring Program, NOAA
  • 2. Outline • Background on fish ecology and the data • Background on multilevel modeling • Demo of lme4 package in R
  • 3. The big goal: measure effect of stream habitat quality on fish survival Photo by David Wolman Schooling Juvenile Coho Salmon
  • 4. Land Area Affected by Endangered Species Act Listings of Salmon & Steelhead * 28 distinct population segments: 6 endangered, 22 threatened * 176,000 sq. miles in Washington, Oregon, Idaho & California study area * 61% of Washington’s land area, 55% of Oregon’s, 26% of Idaho’s, & 32% of California’s February 2008
  • 5. The Data ~266 study sites Oregon coastal region juvenile coho salmon habitat sparsely sampled, longitudinal study design Oregon 12 year time series 35 data layers ~100 landscape level variates ~22 habitat level variates
  • 6. Abundance increases over time due to variation in Ocean conditions (i.e. external to our analysis) coho.obs coho.obs ● 1.0 ● ● ● 8 ● 0.8 ● ● ● ● ● ● 6 ● ● coefficient ● 0.6 ● fs.coho.obs ● ● ● ● ● ● ● ● ● ● 4 ● ● ● ● ● ● ● ● ● ● ● ● ● 0.4 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 2 ● ● ● ● ● ● 0.2 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0 1998 2000 2002 2004 2006 2008 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 year fs.year
  • 7. Sparsely sampled longitudinal data • Only fish data has time 3.0 17100201010102 17100202030201 17100203020501 17100203020902 component 2.5 2.0 ● • year effects exogenous 1.5 1.0 ● ● ● ● ● ● ● ● ● 0.5 ● • Landscape data everywhere ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0.0 ● ● ● • Habitat data some places 17100203040402 17100203040602 17100203070101 17100203090101 3.0 ● 2.5 • Fish data some places ● 2.0 ● ● 1.5 ● • Not always same places ● ● 1.0 ● ● ● fs.coho.obs 0.5 ● ● ● ● 0.0 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 17100204050303 17100205040105 17100205070202 17100206010504 3.0 2.5 2.0 1.5 ● ● ● ● ● 1.0 ● ● ● ● ● 0.5 ● ● ● ● ● 0.0 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 17100206010603 17100303080202 17100304010604 17100305060202 3.0 2.5 2.0 ● 1.5 1.0 ● 0.5 ● ● ● ● ● Figure Legend. Mean density of coho at ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0.0 ● ● ● ● ● ● ● ● ● ● ● 16 frequently visited sites for 1998–2009 1998 2002 2006 1998 2002 2006 1998 2002 2006 1998 2002 2006 2000 2004 2008 2000 2004 2008 2000 2004 2008 2000 2004 2008 year
  • 8. How the landscape data is acquired summarize across area surrounding GIS map layers study site
  • 9. habitat level data is collected by survey visits: labor intensive to collect/therefore less abundant gradient pool density debris flow rates drainage area high structure: rocks and woody debris channel width etc. shallow, highly channelized
  • 11. Multi-level structure for two reasons: (1) longitudinal sampling design (2) varying scales of predictors landscape habitat fish
  • 12. Generalized linear mixed models (aka hierarchical, multilevel, or random effects models) canonical example: school test scores class class class class class class class class class school school school state student_score ~ class_average + school_average + state_average
  • 13. state level predictors Norm(0, σstate ) 2 state school level predictors Norm(µstate1 , σschool ) 2 school 1 school 2 school 3 school 4 class level predictors Norm(µschool1 , σclass ) 2 class 1 class 2 class 3 class 4 student level predictors Norm(µclass3 , σstudent ) 2 student 1 student 2 student 3 student 4
  • 14. Our model structure is not so complicated global landscape level predictors site 1 site 2 site 3 site 4 habitat level predictors & year effects obs 1 obs 2 obs 3 obs 4
  • 15. Modeling presence/absence of fish: logistic mixed model with site and year effects year effects γ ∗ year logit(Pr{yi = 1}) = βyear xy + β1 xh1 + β1 xh2 + αsite + βh1 xh1 + βh2 xh2 + ... + αsite habitat level predictors site effects αsite ∼ Norm(βl1 xl1 + βl2 xl2 + ... , σsite ) 2 landscape level predictors
  • 16. Fit a lot of models, some predictors rose to the top 1300 m3 m18 m5 m6 m13 m11 m17 m15 m1m4 m9 m2 m21 Best predictors: m8 m12 m7 gradient 1250 debris level drainage area 1200 AIC m14 mean elevation 1150 m10 m32 m30 m33 m34 1100 m16 m29 m31 m25 m20 m26 m28 m27 m19 m23 m22 m24 −620 −600 −580 −560 −540 −520 logLik
  • 17. Overall model performance is strong at some things, weak at others fitted probabilities 1.0 ● ● ● ● ● ● ● ● ● ● ● 0.8 800 ● ● ● ● ● ● ● ● ● ● ● ● ● fitted probability ● ● fitted probabilities ● ● ● 0.6 600 ● ● ● ● ● ● ● ● ● ● ● ● count 0.4 ● ● 400 ● 0.2 ● ● 200 ● ● 0.0 0 0 1 0.0 0.2 0.4 0.6 0.8 1.0 fitted(models.ls$m24) absence presence histogram of fitted probabilities
  • 18. Another look at model fit: some heavy outliers ~ pa.obs s.year + (fs.grad.rs + fs.cfs.down.rs + fs.vol.len.rs + el.mean.rs | catchment p/a of coho obs (data) 0.8 1998 2004 1999 2005 2000 2006 2001 2007 0.4 2002 2008 2003 2009 0.0 0.0 0.2 0.4 0.6 0.8 1.0 fitted
  • 19. conclusions • site matters • we can explain about half of the variation in why site matters with 4-5 predictors • habitat data more valuable than landscape data • small number of predictions are very wrong, and we can’t seem to improve them
  • 20. Thanks. yasmin.lucero@gmail.com
  • 21. Model predicted probabilities given presence/ absence with and without site effects m0 m1 1.0 1.0 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0.8 0.8 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Pr{coho present} Pr{coho present} ● ● ● 0.6 0.6 ● ● ● ● ● ● ● ● ● ● ● 0.4 0.4 ● ● ● ● ● ● ● ● ● 0.2 0.2 ● ● 0.0 0.0 FALSE TRUE FALSE TRUE coho presence coho presence