Skip to content

Latest commit

 

History

282 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pspforecast

Shellfish toxicity (PSP) forecast serving package

For the current 2026 Maine PSP predictions, click here

For past season results, check out this shiny application

Installation

remotes::install_github("BigelowLab/pspforecast")

Reading the forecast database

library(pspforecast)
fc = read_forecast()
glimpse(fc)
## Rows: 673
## Columns: 20
## $ version             �[3m�[38;5;246m<chr>�[39m�[23m "v0.4.0"�[38;5;246m, �[39m"v0.4.0"�[38;5;246m, �[39m"v0.4.0"�[38;5;246m, �[39m"v0.4.0"�[38;5;246m, �[39m"v0.4.0"�[38;5;246m, �[39m"v0.4.0"�[38;5;246m, �[39m"v0.4.0"�[38;5;246m, �[39m"v0.4.0"�[38;5;246m, �[39m"v0.4.0"�[38;5;246m, �[39m"v0.4.0"�[38;5;246m, �[39m"v0.4.0"�[38;5;246m, �[39m"v0.4.0"�[38;5;246m, �[39m"v0.4.0"�[38;5;246m, �[39m"v0.4.0"�[38;5;246m, �[39m"v0.4.0"�[38;5;246m, �[39m"v0.4.0"�[38;5;246m, �[39m…
## $ ensemble_n          �[3m�[38;5;246m<dbl>�[39m�[23m 10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m10�[38;5;246m, �[39m…
## $ location            �[3m�[38;5;246m<chr>�[39m�[23m "PSP10.11"�[38;5;246m, �[39m"PSP10.33"�[38;5;246m, �[39m"PSP12.01"�[38;5;246m, �[39m"PSP12.03"�[38;5;246m, �[39m"PSP12.13"�[38;5;246m, �[39m"PSP12.28"�[38;5;246m, �[39m"PSP12.34"�[38;5;246m, �[39m"PSP21.09"�[38;5;246m, �[39m"PSP26.07"�[38;5;246m, �[39m"PSP27.05"�[38;5;246m, �[39m"PSP27.46"�[38;5;246m, �[39m"PSP19.15"�[38;5;246m, �[39m"PSP23.07"�[38;5;246m, �[39m"PSP…
## $ date                �[3m�[38;5;246m<date>�[39m�[23m 2026-04-13�[38;5;246m, �[39m2026-04-13�[38;5;246m, �[39m2026-04-14�[38;5;246m, �[39m2026-04-14�[38;5;246m, �[39m2026-04-14�[38;5;246m, �[39m2026-04-14�[38;5;246m, �[39m2026-04-14�[38;5;246m, �[39m2026-04-14�[38;5;246m, �[39m2026-04-14�[38;5;246m, �[39m2026-04-14�[38;5;246m, �[39m2026-04-14�[38;5;246m, �[39m2026-04-15�[38;5;246m, �[39m2026-04-15�[38;5;246m, �[39m202…
## $ species             �[3m�[38;5;246m<chr>�[39m�[23m "mytilus"�[38;5;246m, �[39m"mytilus"�[38;5;246m, �[39m"mytilus"�[38;5;246m, �[39m"mytilus"�[38;5;246m, �[39m"mytilus"�[38;5;246m, �[39m"mytilus"�[38;5;246m, �[39m"mytilus"�[38;5;246m, �[39m"mytilus"�[38;5;246m, �[39m"mytilus"�[38;5;246m, �[39m"mytilus"�[38;5;246m, �[39m"mytilus"�[38;5;246m, �[39m"mytilus"�[38;5;246m, �[39m"mytilus"�[38;5;246m, �[39m"mytilus"�[38;5;246m, �[39m"mytil…
## $ name                �[3m�[38;5;246m<chr>�[39m�[23m "Ogunquit River"�[38;5;246m, �[39m"Spurwink River"�[38;5;246m, �[39m"Basin Pt."�[38;5;246m, �[39m"Potts Pt."�[38;5;246m, �[39m"Lumbos Hole"�[38;5;246m, �[39m"Bear Island"�[38;5;246m, �[39m"Head Beach"�[38;5;246m, �[39m"Bass Hbr."�[38;5;246m, �[39m"Cutler Hbr."�[38;5;246m, �[39m"Gove Pt."�[38;5;246m, �[39m"Gleason Cove"…
## $ lat                 �[3m�[38;5;246m<dbl>�[39m�[23m 43.25030�[38;5;246m, �[39m43.56632�[38;5;246m, �[39m43.73848�[38;5;246m, �[39m43.73064�[38;5;246m, �[39m43.79553�[38;5;246m, �[39m43.78556�[38;5;246m, �[39m43.71711�[38;5;246m, �[39m44.23824�[38;5;246m, �[39m44.65701�[38;5;246m, �[39m44.90545�[38;5;246m, �[39m44.97084�[38;5;246m, �[39m44.15419�[38;5;246m, �[39m44.39319�[38;5;246m, �[39m44.52198�[38;5;246m, �[39m44.53205�[38;5;246m, �[39m44.39319�[38;5;246m, �[39m…
## $ lon                 �[3m�[38;5;246m<dbl>�[39m�[23m -70.59540�[38;5;246m, �[39m-70.27305�[38;5;246m, �[39m-70.04343�[38;5;246m, �[39m-70.02556�[38;5;246m, �[39m-69.94557�[38;5;246m, �[39m-69.87415�[38;5;246m, �[39m-69.84999�[38;5;246m, �[39m-68.34792�[38;5;246m, �[39m-67.20525�[38;5;246m, �[39m-67.05621�[38;5;246m, �[39m-67.05254�[38;5;246m, �[39m-68.65947�[38;5;246m, �[39m-67.97628�[38;5;246m, �[39m-67.79233�[38;5;246m, �[39m-67.56…
## $ class_bins          �[3m�[38;5;246m<chr>�[39m�[23m "0,10,30,80"�[38;5;246m, �[39m"0,10,30,80"�[38;5;246m, �[39m"0,10,30,80"�[38;5;246m, �[39m"0,10,30,80"�[38;5;246m, �[39m"0,10,30,80"�[38;5;246m, �[39m"0,10,30,80"�[38;5;246m, �[39m"0,10,30,80"�[38;5;246m, �[39m"0,10,30,80"�[38;5;246m, �[39m"0,10,30,80"�[38;5;246m, �[39m"0,10,30,80"�[38;5;246m, �[39m"0,10,30,80"�[38;5;246m, �[39m"0,10,…
## $ forecast_start_date �[3m�[38;5;246m<date>�[39m�[23m 2026-04-17�[38;5;246m, �[39m2026-04-17�[38;5;246m, �[39m2026-04-18�[38;5;246m, �[39m2026-04-18�[38;5;246m, �[39m2026-04-18�[38;5;246m, �[39m2026-04-18�[38;5;246m, �[39m2026-04-18�[38;5;246m, �[39m2026-04-18�[38;5;246m, �[39m2026-04-18�[38;5;246m, �[39m2026-04-18�[38;5;246m, �[39m2026-04-18�[38;5;246m, �[39m2026-04-19�[38;5;246m, �[39m2026-04-19�[38;5;246m, �[39m202…
## $ forecast_end_date   �[3m�[38;5;246m<date>�[39m�[23m 2026-04-23�[38;5;246m, �[39m2026-04-23�[38;5;246m, �[39m2026-04-24�[38;5;246m, �[39m2026-04-24�[38;5;246m, �[39m2026-04-24�[38;5;246m, �[39m2026-04-24�[38;5;246m, �[39m2026-04-24�[38;5;246m, �[39m2026-04-24�[38;5;246m, �[39m2026-04-24�[38;5;246m, �[39m2026-04-24�[38;5;246m, �[39m2026-04-24�[38;5;246m, �[39m2026-04-25�[38;5;246m, �[39m2026-04-25�[38;5;246m, �[39m202…
## $ p_0                 �[3m�[38;5;246m<dbl>�[39m�[23m 99�[38;5;246m, �[39m99�[38;5;246m, �[39m98�[38;5;246m, �[39m98�[38;5;246m, �[39m94�[38;5;246m, �[39m93�[38;5;246m, �[39m94�[38;5;246m, �[39m98�[38;5;246m, �[39m81�[38;5;246m, �[39m96�[38;5;246m, �[39m81�[38;5;246m, �[39m98�[38;5;246m, �[39m98�[38;5;246m, �[39m97�[38;5;246m, �[39m99�[38;5;246m, �[39m99�[38;5;246m, �[39m99�[38;5;246m, �[39m97�[38;5;246m, �[39m96�[38;5;246m, �[39m97�[38;5;246m, �[39m89�[38;5;246m, �[39m99�[38;5;246m, �[39m98�[38;5;246m, �[39m96�[38;5;246m, �[39m95�[38;5;246m, �[39m59�[38;5;246m, �[39m30�[38;5;246m, �[39m89�[38;5;246m, �[39m96�[38;5;246m, �[39m94�[38;5;246m, �[39m95�[38;5;246m, �[39m93�[38;5;246m, �[39m96�[38;5;246m, �[39m90�[38;5;246m, �[39m87�[38;5;246m, �[39m70�[38;5;246m, �[39m84�[38;5;246m, �[39m98�[38;5;246m, �[39m96�[38;5;246m, �[39m94�[38;5;246m, �[39m…
## $ p_1                 �[3m�[38;5;246m<dbl>�[39m�[23m 1�[38;5;246m, �[39m1�[38;5;246m, �[39m2�[38;5;246m, �[39m2�[38;5;246m, �[39m6�[38;5;246m, �[39m6�[38;5;246m, �[39m6�[38;5;246m, �[39m2�[38;5;246m, �[39m16�[38;5;246m, �[39m3�[38;5;246m, �[39m16�[38;5;246m, �[39m2�[38;5;246m, �[39m2�[38;5;246m, �[39m3�[38;5;246m, �[39m1�[38;5;246m, �[39m1�[38;5;246m, �[39m1�[38;5;246m, �[39m3�[38;5;246m, �[39m4�[38;5;246m, �[39m3�[38;5;246m, �[39m9�[38;5;246m, �[39m1�[38;5;246m, �[39m2�[38;5;246m, �[39m4�[38;5;246m, �[39m5�[38;5;246m, �[39m26�[38;5;246m, �[39m36�[38;5;246m, �[39m9�[38;5;246m, �[39m4�[38;5;246m, �[39m5�[38;5;246m, �[39m5�[38;5;246m, �[39m7�[38;5;246m, �[39m4�[38;5;246m, �[39m8�[38;5;246m, �[39m10�[38;5;246m, �[39m21�[38;5;246m, �[39m12�[38;5;246m, �[39m2�[38;5;246m, �[39m3�[38;5;246m, �[39m5�[38;5;246m, �[39m3�[38;5;246m, �[39m1�[38;5;246m, �[39m1�[38;5;246m, �[39m3�[38;5;246m, �[39m2�[38;5;246m, �[39m1�[38;5;246m, �[39m15�[38;5;246m, �[39m3�[38;5;246m, �[39m9�[38;5;246m, �[39m7�[38;5;246m, �[39m13…
## $ p_2                 �[3m�[38;5;246m<dbl>�[39m�[23m 0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m1�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m3�[38;5;246m, �[39m0�[38;5;246m, �[39m2�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m1�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m11�[38;5;246m, �[39m24�[38;5;246m, �[39m1�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m1�[38;5;246m, �[39m0�[38;5;246m, �[39m1�[38;5;246m, �[39m2�[38;5;246m, �[39m6�[38;5;246m, �[39m3�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m4�[38;5;246m, �[39m0�[38;5;246m, �[39m1�[38;5;246m, �[39m1�[38;5;246m, �[39m4�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m,�[39m…
## $ p_3                 �[3m�[38;5;246m<dbl>�[39m�[23m 0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m1�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m4�[38;5;246m, �[39m11�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m1�[38;5;246m, �[39m2�[38;5;246m, �[39m1�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m1�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m1�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m…
## $ p3_sd               �[3m�[38;5;246m<dbl>�[39m�[23m 0.0012371945�[38;5;246m, �[39m0.0023733521�[38;5;246m, �[39m0.0024041385�[38;5;246m, �[39m0.0041712376�[38;5;246m, �[39m0.0669436602�[38;5;246m, �[39m0.0467839217�[38;5;246m, �[39m0.0317355271�[38;5;246m, �[39m0.0031925299�[38;5;246m, �[39m0.5697455237�[38;5;246m, �[39m0.0215190595�[38;5;246m, �[39m0.3680724580�[38;5;246m, �[39m0.0037…
## $ p_3_min             �[3m�[38;5;246m<dbl>�[39m�[23m 0.0005414331�[38;5;246m, �[39m0.0009854686�[38;5;246m, �[39m0.0019742312�[38;5;246m, �[39m0.0012217212�[38;5;246m, �[39m0.0037948987�[38;5;246m, �[39m0.0943924708�[38;5;246m, �[39m0.0315538928�[38;5;246m, �[39m0.0009424035�[38;5;246m, �[39m0.1029437175�[38;5;246m, �[39m0.0027424621�[38;5;246m, �[39m0.0409453467�[38;5;246m, �[39m0.0039…
## $ p_3_max             �[3m�[38;5;246m<dbl>�[39m�[23m 4.035514e-03�[38;5;246m, �[39m7.677227e-03�[38;5;246m, �[39m9.584654e-03�[38;5;246m, �[39m1.410544e-02�[38;5;246m, �[39m2.017008e-01�[38;5;246m, �[39m2.584866e-01�[38;5;246m, �[39m1.390330e-01�[38;5;246m, �[39m1.091267e-02�[38;5;246m, �[39m1.650765e+00�[38;5;246m, �[39m5.697501e-02�[38;5;246m, �[39m1.117264e+00�[38;5;246m, �[39m1.3985…
## $ predicted_class     �[3m�[38;5;246m<dbl>�[39m�[23m 0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m1�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0�[38;5;246m, �[39m0…
## $ f_id                �[3m�[38;5;246m<chr>�[39m�[23m "PSP10.11_2026-04-13_mytilus"�[38;5;246m, �[39m"PSP10.33_2026-04-13_mytilus"�[38;5;246m, �[39m"PSP12.01_2026-04-14_mytilus"�[38;5;246m, �[39m"PSP12.03_2026-04-14_mytilus"�[38;5;246m, �[39m"PSP12.13_2026-04-14_mytilus"�[38;5;246m, �[39m"PSP1…

Forecast Variables:

  • version - the version/configuration of the model used to make the prediction
  • ensemble_n - number of ensemble members used to generate prediction
  • location - the sampling station the forecast is for
  • date - the date the forecast was made on
  • name - site name
  • lat - latitude
  • lon - longitude
  • class_bins - the bins used to classify shellfish total toxicity (i.e. 0: 0-10, 1: 10-30, 2: 30-80, 3: >80)
  • forecast_date - the date the forecast is valid for (i.e. one week ahead of when it was made)
  • predicted_class - the predicted classification at the location listed on the forecast_date (in this case 0-3)
  • p_0 - class 0 probability
  • p_1 - class 1 probability
  • p_2 - class 2 probability
  • p_3 - class 3 probability
  • p3_sd - class 3 probability standard deviation
  • p_3_min - class 3 minimum probability (from ensemble run)
  • p_3_max - class 3 maximum probability (from ensemble run)
  • predicted_class - the predicted classification

Results

Metrics:

  • tp - The model predicted class 3 and the following week’s measurement was class 3
  • fp - The model predicted class 3 and the following week’s measurement was not class 3
  • tn - The model predicted class 0,1,2 and the following week’s measurement was in class 0,1,2
  • fn - The model predicted class 0,1,2 and the following week’s measurement was class 3
  • accuracy - Measure of how many correct classifications were predicted
  • cl_accuracy - Considering predictions are those that correctly predicted toxicity above or below the closure limit or not
  • precision - TP/(TP+FP)
  • sensitivity - TP/(TP+FN)
  • specificity - TN/(TN+FP)
  • f_1 - (2TP)/(2TP-FP+FN)

Predictions evaluated:

## [1] 2634

Metrics (overall):

## # A tibble: 1 × 11
##      tp    fp    tn    fn cl_accuracy accuracy brier   f_1 precision sensitivity specificity
##   <int> <int> <int> <int>       <dbl>    <dbl> <dbl> <dbl>     <dbl>       <dbl>       <dbl>
## 1    69    65  2449    51       0.956    0.806 0.028 0.543     0.515       0.575       0.974

Individual seasons:

## # A tibble: 5 × 12
##    year    tp    fp    tn    fn cl_accuracy accuracy brier     f_1 precision sensitivity specificity
##   <int> <int> <int> <int> <int>       <dbl>    <dbl> <dbl>   <dbl>     <dbl>       <dbl>       <dbl>
## 1  2021     2     3   463     0       0.994    0.938 0.005   0.571     0.4         1           0.994
## 2  2022    16    20   603    12       0.951    0.799 0.03    0.5       0.444       0.571       0.968
## 3  2023     0     0   405     0       1        0.99  0     NaN       NaN         NaN           1    
## 4  2024     2     4   397     7       0.973    0.717 0.017   0.267     0.333       0.222       0.990
## 5  2025    49    38   581    32       0.9      0.671 0.066   0.583     0.563       0.605       0.939

2026 (current season) Results

Predictions evaluated

## [1] 594

Metrics

## # A tibble: 1 × 11
##      tp    fp    tn    fn cl_accuracy accuracy brier   f_1 precision sensitivity specificity
##   <int> <int> <int> <int>       <dbl>    <dbl> <dbl> <dbl>     <dbl>       <dbl>       <dbl>
## 1    13    10   560    11       0.965    0.603 0.024 0.553     0.565       0.542       0.982

Last Updated

## [1] "2026-08-19"

Requirements

About

Maine shellfish toxicity forecast serving package

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages