SPEI index calculation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

SPEI index calculation

Manuel Esteban Lucas Borja
Dear all,

I am trying to calculate SPEI index using Rstudio (please see data used below this email). First I calculated PET (latitude 40,29), and then I failed when asking for SPEI index:

 spei(SPEI$PREC-PET,1).

The only result I got is NA.

Any idea about what´s wrong?

Thanks for helping and for your time,

Manuel

Year Month TMED PREC
2010 1 0.9 59.8
2010 2 1.43 66.7
2010 3 3.3 35
2010 4 7.9 23.5
2010 5 9.58 22.9
2010 6 14.3 23.1
2010 7 20.6 0.5
2010 8 18.95 7.6
2010 9 13.94 25.6
2010 10 8.29 60
2010 11 3.14 71.2
2010 12 2.05 95.8
2011 1 1.5 35
2011 2 2.8 66
2011 3 4.8 59.8
2011 4 10.1 68.6
2011 5 12.7 24
2011 6 16.7 18.2
2011 7 18.2 12
2011 8 19.9 10.6
2011 9 15.8 1.7
2011 10 10.9 8.6
2011 11 5.9 78.6
2011 12 2.7 18.5
2012 1 1.86 10.3
2012 2 -0.89 4.2
2012 3 4.9 4.5
2012 4 5.4 119.8
2012 5 12.8 7.7
2012 6 17.6 21.7
2012 7 19.6 1.8
2012 8 20.8 1.6
2012 9 14.7 49.5
2012 10 9.64 61
2012 11 5.55 95.5
2012 12 1 46
                               
                               
                               
                               
                               
                               
                               
                               
                               
                               
                               
_______________________________________________
R-sig-ecology mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Reply | Threaded
Open this post in threaded view
|

Re: SPEI index calculation

Drew Tyre
Hi Manuel

Without a little more information about how you calculated PET it is hard to know for sure how to help. But I would take a close look at the PET object as a next step to make sure there are no NA values in there.

Which package and version are you using for spei() function?

You can see how my collaborators and I did this at
https://datadryad.org/stash/dataset/doi:10.5061/dryad.f2mp4


--
Drew Tyre
 
He/him/his
 
While I may be sending this email outside my normal office hours,
I have no expectation to receive a reply outside of yours.
 
School of Natural Resources
University of Nebraska-Lincoln
416 Hardin Hall, East Campus
3310 Holdrege Street
Lincoln, NE 68583-0974
 
phone: +1 402 472 4054
fax: +1 402 472 2946
email: [hidden email]
http://snr.unl.edu/tyre
http://drewtyre.rbind.io
 
 

On 1/27/20, 10:41 AM, "R-sig-ecology on behalf of Manuel Esteban Lucas Borja" <[hidden email] on behalf of [hidden email]> wrote:

    Dear all,
   
    I am trying to calculate SPEI index using Rstudio (please see data used below this email). First I calculated PET (latitude 40,29), and then I failed when asking for SPEI index:
   
     spei(SPEI$PREC-PET,1).
   
    The only result I got is NA.
   
    Any idea about what´s wrong?
   
    Thanks for helping and for your time,
   
    Manuel
   
    Year Month TMED PREC
    2010 1 0.9 59.8
    2010 2 1.43 66.7
    2010 3 3.3 35
    2010 4 7.9 23.5
    2010 5 9.58 22.9
    2010 6 14.3 23.1
    2010 7 20.6 0.5
    2010 8 18.95 7.6
    2010 9 13.94 25.6
    2010 10 8.29 60
    2010 11 3.14 71.2
    2010 12 2.05 95.8
    2011 1 1.5 35
    2011 2 2.8 66
    2011 3 4.8 59.8
    2011 4 10.1 68.6
    2011 5 12.7 24
    2011 6 16.7 18.2
    2011 7 18.2 12
    2011 8 19.9 10.6
    2011 9 15.8 1.7
    2011 10 10.9 8.6
    2011 11 5.9 78.6
    2011 12 2.7 18.5
    2012 1 1.86 10.3
    2012 2 -0.89 4.2
    2012 3 4.9 4.5
    2012 4 5.4 119.8
    2012 5 12.8 7.7
    2012 6 17.6 21.7
    2012 7 19.6 1.8
    2012 8 20.8 1.6
    2012 9 14.7 49.5
    2012 10 9.64 61
    2012 11 5.55 95.5
    2012 12 1 46
   
   
   
   
   
   
   
   
   
   
   
    _______________________________________________
    R-sig-ecology mailing list
    [hidden email]
    https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Decology&d=DwIGaQ&c=Cu5g146wZdoqVuKpTNsYHeFX_rg6kWhlkLF8Eft-wwo&r=aLEaSryyUcERVqcKVZl7lQ&m=7X13dMuFRoBufpNmVGN6OG2Ex1TlLBoogThOfS0djQE&s=sl2G4mgZNLLVruSfeIjLRUROuw-rpqMxi56CNk6-prA&e= 
   

_______________________________________________
R-sig-ecology mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
Reply | Threaded
Open this post in threaded view
|

Re: SPEI index calculation

Manuel Esteban Lucas Borja
Dear Drew,
Thanks for your promt reply. I used Thorthwaite method for calculation PET. I used SPEI package. In principle, PET values are ok.
Thanks for tour time and help,
Best
Manuel
-----Mensaje original-----
De: Drew Tyre <[hidden email]>
Enviado el: lunes, 27 de enero de 2020 17:50
Para: Manuel Esteban Lucas Borja <[hidden email]>; [hidden email]
Asunto: Re: [R-sig-eco] SPEI index calculation

Hi Manuel

Without a little more information about how you calculated PET it is hard to know for sure how to help. But I would take a close look at the PET object as a next step to make sure there are no NA values in there.

Which package and version are you using for spei() function?

You can see how my collaborators and I did this at
https://datadryad.org/stash/dataset/doi:10.5061/dryad.f2mp4


--
Drew Tyre
 
He/him/his
 
While I may be sending this email outside my normal office hours,
I have no expectation to receive a reply outside of yours.
 
School of Natural Resources
University of Nebraska-Lincoln
416 Hardin Hall, East Campus
3310 Holdrege Street
Lincoln, NE 68583-0974
 
phone: +1 402 472 4054
fax: +1 402 472 2946
email: [hidden email]
http://snr.unl.edu/tyre
http://drewtyre.rbind.io
 
 

On 1/27/20, 10:41 AM, "R-sig-ecology on behalf of Manuel Esteban Lucas Borja" <[hidden email] on behalf of [hidden email]> wrote:

    Dear all,
   
    I am trying to calculate SPEI index using Rstudio (please see data used below this email). First I calculated PET (latitude 40,29), and then I failed when asking for SPEI index:
   
     spei(SPEI$PREC-PET,1).
   
    The only result I got is NA.
   
    Any idea about what´s wrong?
   
    Thanks for helping and for your time,
   
    Manuel
   
    Year Month TMED PREC
    2010 1 0.9 59.8
    2010 2 1.43 66.7
    2010 3 3.3 35
    2010 4 7.9 23.5
    2010 5 9.58 22.9
    2010 6 14.3 23.1
    2010 7 20.6 0.5
    2010 8 18.95 7.6
    2010 9 13.94 25.6
    2010 10 8.29 60
    2010 11 3.14 71.2
    2010 12 2.05 95.8
    2011 1 1.5 35
    2011 2 2.8 66
    2011 3 4.8 59.8
    2011 4 10.1 68.6
    2011 5 12.7 24
    2011 6 16.7 18.2
    2011 7 18.2 12
    2011 8 19.9 10.6
    2011 9 15.8 1.7
    2011 10 10.9 8.6
    2011 11 5.9 78.6
    2011 12 2.7 18.5
    2012 1 1.86 10.3
    2012 2 -0.89 4.2
    2012 3 4.9 4.5
    2012 4 5.4 119.8
    2012 5 12.8 7.7
    2012 6 17.6 21.7
    2012 7 19.6 1.8
    2012 8 20.8 1.6
    2012 9 14.7 49.5
    2012 10 9.64 61
    2012 11 5.55 95.5
    2012 12 1 46
   
   
   
   
   
   
   
   
   
   
   
    _______________________________________________
    R-sig-ecology mailing list
    [hidden email]
    https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Decology&d=DwIGaQ&c=Cu5g146wZdoqVuKpTNsYHeFX_rg6kWhlkLF8Eft-wwo&r=aLEaSryyUcERVqcKVZl7lQ&m=7X13dMuFRoBufpNmVGN6OG2Ex1TlLBoogThOfS0djQE&s=sl2G4mgZNLLVruSfeIjLRUROuw-rpqMxi56CNk6-prA&e= 
   

_______________________________________________
R-sig-ecology mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology