Histamine fish poisoning is a significant seafood safety concerns and the illness is the most common cuase of seafood poisoning outbreaks worldwide. The illness is caused by ingestion of seafood containing high levels of histamine that is produced by naturally occurring bacteria. Certain fish naturally contain high levels of histidine in their tissue. During storage of the fish, bacteria that contain the histidine decaroxylase can grow and convert the histidine to histamine. Many of the histamine-producing bacteria (HPB) can only grow at temperature above refrigeration. However, recently, HPB that are able to grow at low temperature have been discovered. This research analyzed the histamine production of a HPB that is able to grow at produce histamine at low temperature. This application fits a semented model to the histamine that was produced in tuna with low inoculation level of HPB. The slider represents days that tuna was stored at 4C and the output is that histamine that was produced at designated time.
The purpose of this application is to provide guidance on how long tuna can be stored at refrigeration until it becomes decomposed or toxic. The slider represents the days that tuna is stored at 4C with low inoculation of bacteria and the outcome is histamine that would be expected under these conditions.
library(segmented)
library(ggplot2)
D1 <- read.csv("../D1b.csv")
D1$Day <- as.numeric(D1$Day)
The data was fitted to a segmented model with two reflection points
#Model fitting
model1 <- glm(logHst~Day, data = D1)
fit.seg <- segmented(model1, seg.Z=~Day,psi=c(3,8), control=seg.control(display=FALSE))
summary(fit.seg)
##
## ***Regression Model with Segmented Relationship(s)***
##
## Call:
## segmented.glm(obj = model1, seg.Z = ~Day, psi = c(3, 8), control = seg.control(display = FALSE))
##
## Estimated Break-Point(s):
## Est. St.Err
## psi1.Day 3.927 0.857
## psi2.Day 7.162 0.406
##
## Meaningful coefficients of the linear terms:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.6933 0.2559 -2.710 0.0267 *
## Day 0.1100 0.1982 0.555 0.5940
## U1.Day 0.7570 0.2345 3.228 NA
## U2.Day -0.8377 0.1361 -6.156 NA
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Dispersion parameter for gaussian family taken to be 0.07855673)
##
## Null deviance: 27.43324 on 13 degrees of freedom
## Residual deviance: 0.62845 on 8 degrees of freedom
## AIC: 10.281
##
## Convergence attained in 0 iter. (rel. change 0.47073)
Based on the model fit, a prediction is made
#Predicting histamine at day 3
predict(fit.seg, Day = 3)
## 1 11 21 41 51 61 71
## -0.6933333 -0.5833333 -0.4733333 -0.1980000 0.6690000 1.5360000 2.4030000
## 81 91 101 111 121 131 141
## 2.5678571 2.5971429 2.6264286 2.6557143 2.6850000 2.7142857 2.7435714
ggplot(D1, aes(x = Day, y = fit)) +
geom_line(color = "blue", size=1)+
geom_point(aes(x = Day, y = logHst))+
theme_classic()+
xlab("Time(Days)")+
ylab("Histamine(log Histamine (ppm))")+
theme(plot.title = element_text(hjust = 0.5))
The shiny app can be viewed the following link.