leppott / MBSStools

Suite of tools for data manipulation and calculations for Maryland DNR MBSS program.
https://leppott.github.io/MBSStools/
GNU General Public License v3.0
3 stars 3 forks source link

Change to scoring thresholds #23

Closed leppott closed 4 years ago

leppott commented 5 years ago

Is your feature request related to a problem? Please describe. Per email from Matt, 20190221.

Matt sent revised file.

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

ashtonmj commented 5 years ago

Describe the solution you'd like Update thresholds of metrics.scoring.tab in https://github.com/leppott/MBSStools/tree/master/data-raw with revised values for seven Fish IBI metrics. These thresholds as currently set are not scoring 1995-2016 monitoring site data the same as the previous program.

COASTAL nt_benthic Thresh.Hi should be changed to 0.22 from 0.21 COASTAL pi_genomninvrt Thresh.Hi should be changed to 99.9 from 100 COASTAL pi_rbs Thresh.Lo should be changed to 0.1 from 0.000000001 EPIEDMONT pi_genomninvrt Thresh.Hi should be changed to 99.9 from 100 COLD ni_m2 Thresh.Hi should be changed to 2.2399999999999999 from 2.24 COLD pi_brooktrout Thresh.Lo should be changed to 0.0000000000000001 from 1 COLD pi_sculpin Thresh.Lo should be changed to 0.0000000000000001 from 1

Additional context Using 16 significant digits should allow the COLD strata thresholds to function within the Lo Hi, Increase Decrease framework. There are no values in the MBSS database greater than 16 significant digits so setting the Thresh.Lo to <0.0000000000000001 for a decreasing response metric should function as "0" and score the metric as 1. Values >=0.0000000000000001 to the Thresh.Hi value should be scored as 3.

leppott commented 5 years ago

Should be good with update.

ashtonmj commented 5 years ago

Both Jono and I have updated and tried to run the Fish IBI with real and example data, but received the same error. There seems to be an issue when calling the metric names for myIndex, which fails to create the myMetrics.Fish object. The function then fails to score metrics because the myMetrics.Fish object is not found. Unsure why the error did not happen in the prior function when MyMetrics.Fish object was called to create the object myMetric.Values.Fish.

Metrics, Fish

library(MBSStools)

(generate values then score)s

myIndex <- "MBSS.2005.Fish"

Thresholds

thresh <- metrics_scoring

get metric names for myIndex

(myMetrics.Fish <- as.character(droplevels(unique(thresh[thresh[,"Index.Name"]==myIndex,"Metric"])))) Error in UseMethod("droplevels") : no applicable method for 'droplevels' applied to an object of class "NULL"

Taxa Data

myDF.Fish <- taxa_fish myMetric.Values.Fish <- metric.values(myDF.Fish, "fish", myMetrics.Fish, TRUE)

View(myMetric.Values.Fish)

SCORE

Metrics.Fish.Scores <- metric.scores(myMetric.Values.Fish, myMetrics.Fish, "Index.Name", "FIBISTRATA", thresh) Error in paste0("SC_", MetricNames) : object 'myMetrics.Fish' not found

View Results

knitr::kable(head(Metrics.Fish.Scores))

ashtonmj commented 5 years ago

Error was resolved by substituting "MetricName.Other" for "Metric" in (myMetrics.Fish <- as.character(droplevels(unique(thresh[thresh[,"Index.Name"]==myIndex,"Metric"]))))

leppott commented 4 years ago

Confirm no longer an issue.