Biodiversity Conservation: Correlation and prediction of blotching in sharks by environment and frequency of capture

Author

Qiuyang Zhang

Published

January 24, 2025

Title

Biodiversity Conservation: Correlation and prediction of blotching in sharks by environment and frequency of capture

Abstract

The stress response faced by sharks during capture is of great significance to ecological balance and animal welfare.(Skomal, 2011) We aims to explore the effects of environmental factors and physiological indicators on shark stress response during capture by analyzing the blotching phenomenon of Caribbean reef sharks. Using sharks and sharksub datasets respectively, shark research employed methods including Pearson and Spearman correlation analysis, linear regression, random forest, and paired sample t-test to assess the correlation between air temperature and water temperature, the influence of multiple captures on blotching time, and the predictive capacity of blotching time. The results revealed that the relationship between air temperature and water temperature was slightly negatively correlated but not significant; multiple captures significantly extended the duration of the blotching of sharks, indicating that the number of captures had a cumulative effect on the stress response of sharks; also, physiological and environmental indicators could effectively run dual prediction of blotching time. These results offer a uniquely different lens to examine physiological stress responses in sharks following capture.

Is there a correlation between the variables air and water?

library(tidyverse)
Warning: package 'tidyr' was built under R version 4.4.2
Warning: package 'dplyr' was built under R version 4.4.2
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.5.1     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(randomForest)
Warning: package 'randomForest' was built under R version 4.4.2
randomForest 4.7-1.2
Type rfNews() to see new features/changes/bug fixes.

Attaching package: 'randomForest'

The following object is masked from 'package:dplyr':

    combine

The following object is masked from 'package:ggplot2':

    margin
library(neuralnet)
Warning: package 'neuralnet' was built under R version 4.4.2

Attaching package: 'neuralnet'

The following object is masked from 'package:dplyr':

    compute
library(caret)
Warning: package 'caret' was built under R version 4.4.2
Loading required package: lattice

Attaching package: 'caret'

The following object is masked from 'package:purrr':

    lift
library(survival)
Warning: package 'survival' was built under R version 4.4.2

Attaching package: 'survival'

The following object is masked from 'package:caret':

    cluster
library(ggplot2)
library(tidyr)
library(dplyr)
library(randomForest)

sharks <- read.csv("sharks.csv")
sharksub <- read.csv("sharksub.csv")
str(sharks)
'data.frame':   500 obs. of  10 variables:
 $ ID    : chr  "SH001" "SH002" "SH003" "SH004" ...
 $ sex   : chr  "Female" "Female" "Female" "Male" ...
 $ blotch: num  37.2 34.5 36.3 35.3 37.4 ...
 $ BPM   : int  148 158 125 161 138 126 166 135 132 127 ...
 $ weight: num  74.7 73.4 71.8 104.6 67.1 ...
 $ length: num  187 189 284 171 264 ...
 $ air   : num  37.7 35.7 34.8 36.2 33.6 ...
 $ water : num  23.4 21.4 20.1 21.6 21.8 ...
 $ meta  : num  64.1 73.7 54.4 86.3 108 ...
 $ depth : num  53.2 49.6 49.4 50.3 49 ...
summary(sharks)
      ID                sex                blotch           BPM       
 Length:500         Length:500         Min.   :30.78   Min.   :119.0  
 Class :character   Class :character   1st Qu.:34.16   1st Qu.:129.0  
 Mode  :character   Mode  :character   Median :35.05   Median :142.0  
                                       Mean   :35.13   Mean   :141.8  
                                       3rd Qu.:36.05   3rd Qu.:153.2  
                                       Max.   :40.08   Max.   :166.0  
     weight           length           air            water      
 Min.   : 65.10   Min.   :128.3   Min.   :33.00   Min.   :20.01  
 1st Qu.: 75.68   1st Qu.:172.0   1st Qu.:34.42   1st Qu.:21.55  
 Median : 87.82   Median :211.1   Median :35.43   Median :23.11  
 Mean   : 87.94   Mean   :211.0   Mean   :35.54   Mean   :23.02  
 3rd Qu.:100.40   3rd Qu.:251.8   3rd Qu.:36.71   3rd Qu.:24.37  
 Max.   :110.94   Max.   :291.0   Max.   :38.00   Max.   :25.99  
      meta            depth      
 Min.   : 50.03   Min.   :44.64  
 1st Qu.: 67.39   1st Qu.:48.90  
 Median : 82.45   Median :50.14  
 Mean   : 82.04   Mean   :50.14  
 3rd Qu.: 95.97   3rd Qu.:51.35  
 Max.   :112.45   Max.   :56.83  
str(sharksub)
'data.frame':   50 obs. of  4 variables:
 $ ID     : chr  "SH269" "SH163" "SH008" "SH239" ...
 $ sex    : chr  "Female" "Female" "Female" "Female" ...
 $ blotch1: num  36.1 33.4 36.3 35 35.7 ...
 $ blotch2: num  37.2 34.4 36.5 36 36.8 ...
summary(sharksub)
      ID                sex               blotch1         blotch2     
 Length:50          Length:50          Min.   :32.49   Min.   :33.47  
 Class :character   Class :character   1st Qu.:34.38   1st Qu.:35.31  
 Mode  :character   Mode  :character   Median :34.94   Median :35.94  
                                       Mean   :35.03   Mean   :35.96  
                                       3rd Qu.:35.90   3rd Qu.:36.78  
                                       Max.   :37.07   Max.   :38.18  
sharks_norm <- sharks %>%
  mutate(air = scale(air), water = scale(water))
pearson_corr <- cor(sharks$air, sharks$water, method = "pearson")
spearman_corr <- cor(sharks$air, sharks$water, method = "spearman")
cat("Pearson : ", pearson_corr, "\n")
Pearson :  -0.05524051 
cat("Spearman : ", spearman_corr, "\n")
Spearman :  -0.05637344 
pearson_test <- cor.test(sharks$air, sharks$water, method = "pearson")
print(pearson_test)

    Pearson's product-moment correlation

data:  sharks$air and sharks$water
t = -1.2346, df = 498, p-value = 0.2176
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.14224207  0.03260803
sample estimates:
        cor 
-0.05524051 
air_water_lm <- lm(water ~ air, data = sharks)
summary(air_water_lm)

Call:
lm(formula = water ~ air, data = sharks)

Residuals:
     Min       1Q   Median       3Q      Max 
-3.03472 -1.47563  0.09925  1.38700  3.06356 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 25.31781    1.86221  13.596   <2e-16 ***
air         -0.06465    0.05236  -1.235    0.218    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.67 on 498 degrees of freedom
Multiple R-squared:  0.003052,  Adjusted R-squared:  0.00105 
F-statistic: 1.524 on 1 and 498 DF,  p-value: 0.2176
r_squared <- summary(air_water_lm)$r.squared
print(paste("R^2:", round(r_squared, 3)))
[1] "R^2: 0.003"
ggplot(sharks, aes(x = air, y = water)) +
  geom_point(color = "blue", alpha = 0.6) +
  labs(title = "Scatter plot of air temperature and water temperature",
       x = "AIR TEMP (°C)",
       y = "WATER TEMP (°C)") +
  theme_minimal()+
  theme(axis.text = element_text(size = 14),
        axis.title = element_text(size = 14))

ggplot(sharks, aes(x = air, y = water)) +
  geom_point(color = "blue", alpha = 0.6) +
  geom_smooth(method = "lm", color = "red", se = TRUE) +
  labs(title = "Linear regression diagram of air temperature and water temperature",
       x = "AIR TEMP (°C)",
       y = "WATER TEMP (°C)") +
  theme_minimal()+
  theme(axis.text = element_text(size = 14),
        axis.title = element_text(size = 14))
`geom_smooth()` using formula = 'y ~ x'

ggplot(sharks, aes(x = air, y = water)) +
  geom_point(position = position_jitter(width = 0.2), size = 2,) +
  geom_smooth(method = "loess", color = "green") +
  labs(title = "A smooth graph of air temperature and water temperature",
    x = "AIR TEMP (°C)",
       y = "WATER TEMP (°C)")+
  theme_minimal()+
  theme(axis.text = element_text(size = 14),
        axis.title = element_text(size = 14))
`geom_smooth()` using formula = 'y ~ x'

set.seed(123)
train_index <- createDataPartition(sharks$water, p = 0.8, list = FALSE)
train_data <- sharks[train_index, ]
test_data <- sharks[-train_index, ]

rf_model <- randomForest(water ~ air, data = train_data, ntree = 500, importance = TRUE)

print(rf_model)

Call:
 randomForest(formula = water ~ air, data = train_data, ntree = 500,      importance = TRUE) 
               Type of random forest: regression
                     Number of trees: 500
No. of variables tried at each split: 1

          Mean of squared residuals: 3.600593
                    % Var explained: -30.09
rf_predictions <- predict(rf_model, newdata = test_data)

mse_rf <- mean((test_data$water - rf_predictions)^2)
print(paste("MSE:", round(mse_rf, 3)))
[1] "MSE: 3.37"
importance(rf_model)
     %IncMSE IncNodePurity
air 9.148128      944.7882
varImpPlot(rf_model)

Does multiple capture have an effect on blotching time?

sharks <- read.csv("sharks.csv")
sharksub <- read.csv("sharksub.csv")
summary(sharksub$blotch1)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  32.49   34.38   34.94   35.03   35.90   37.07 
summary(sharksub$blotch2)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  33.47   35.31   35.94   35.96   36.78   38.18 
mean_blotch1 <- mean(sharksub$blotch1, na.rm = TRUE)
sd_blotch1 <- sd(sharksub$blotch1, na.rm = TRUE)

mean_blotch2 <- mean(sharksub$blotch2, na.rm = TRUE)
sd_blotch2 <- sd(sharksub$blotch2, na.rm = TRUE)
sharksub_long <- sharksub %>%
  pivot_longer(cols = c(blotch1, blotch2), names_to = "capture", values_to = "blotch_time")

ggplot(sharksub_long, aes(x = capture, y = blotch_time, fill = capture)) +
  geom_boxplot() +
  labs(title = "Comparison of blotching time between two catches",
       x = "Blotching Times",
       y = "Time(s)") +
  theme_minimal()

ggplot(sharksub, aes(x = blotch1, y = blotch2)) +
  geom_point(color = "blue") +
  geom_abline(slope = 1, intercept = 0, color = "red", linetype = "dashed") +
  labs(title = "Comparison of two blotching capture times",
       x = "blotch 1",
       y = "blotch 2") +
  theme_minimal()

shapiro.test(sharksub$blotch1)

    Shapiro-Wilk normality test

data:  sharksub$blotch1
W = 0.97958, p-value = 0.5345
shapiro.test(sharksub$blotch2)

    Shapiro-Wilk normality test

data:  sharksub$blotch2
W = 0.97936, p-value = 0.5255
paired_t_test <- t.test(sharksub$blotch1, sharksub$blotch2, paired = TRUE)
print(paired_t_test)

    Paired t-test

data:  sharksub$blotch1 and sharksub$blotch2
t = -17.39, df = 49, p-value < 2.2e-16
alternative hypothesis: true mean difference is not equal to 0
95 percent confidence interval:
 -1.037176 -0.822301
sample estimates:
mean difference 
     -0.9297384 
wilcoxon_test <- wilcox.test(sharksub$blotch1, sharksub$blotch2, paired = TRUE)

print(wilcoxon_test)

    Wilcoxon signed rank test with continuity correction

data:  sharksub$blotch1 and sharksub$blotch2
V = 12, p-value = 1.606e-09
alternative hypothesis: true location shift is not equal to 0
sharksub_long <- sharksub %>%
  pivot_longer(cols = c(blotch1, blotch2), names_to = "capture", values_to = "blotch_time")
anova_model <- aov(blotch_time ~ capture, data = sharksub_long)
summary(anova_model)
            Df Sum Sq Mean Sq F value   Pr(>F)    
capture      1  21.61  21.610   16.93 8.09e-05 ***
Residuals   98 125.11   1.277                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
kruskal_test <- kruskal.test(blotch_time ~ capture, data = sharksub_long)

print(kruskal_test)

    Kruskal-Wallis rank sum test

data:  blotch_time by capture
Kruskal-Wallis chi-squared = 12.752, df = 1, p-value = 0.0003556

Is it possible to predict blotching time?

shark_data <- read.csv("sharks.csv")

str(shark_data)
'data.frame':   500 obs. of  10 variables:
 $ ID    : chr  "SH001" "SH002" "SH003" "SH004" ...
 $ sex   : chr  "Female" "Female" "Female" "Male" ...
 $ blotch: num  37.2 34.5 36.3 35.3 37.4 ...
 $ BPM   : int  148 158 125 161 138 126 166 135 132 127 ...
 $ weight: num  74.7 73.4 71.8 104.6 67.1 ...
 $ length: num  187 189 284 171 264 ...
 $ air   : num  37.7 35.7 34.8 36.2 33.6 ...
 $ water : num  23.4 21.4 20.1 21.6 21.8 ...
 $ meta  : num  64.1 73.7 54.4 86.3 108 ...
 $ depth : num  53.2 49.6 49.4 50.3 49 ...
summary(shark_data)
      ID                sex                blotch           BPM       
 Length:500         Length:500         Min.   :30.78   Min.   :119.0  
 Class :character   Class :character   1st Qu.:34.16   1st Qu.:129.0  
 Mode  :character   Mode  :character   Median :35.05   Median :142.0  
                                       Mean   :35.13   Mean   :141.8  
                                       3rd Qu.:36.05   3rd Qu.:153.2  
                                       Max.   :40.08   Max.   :166.0  
     weight           length           air            water      
 Min.   : 65.10   Min.   :128.3   Min.   :33.00   Min.   :20.01  
 1st Qu.: 75.68   1st Qu.:172.0   1st Qu.:34.42   1st Qu.:21.55  
 Median : 87.82   Median :211.1   Median :35.43   Median :23.11  
 Mean   : 87.94   Mean   :211.0   Mean   :35.54   Mean   :23.02  
 3rd Qu.:100.40   3rd Qu.:251.8   3rd Qu.:36.71   3rd Qu.:24.37  
 Max.   :110.94   Max.   :291.0   Max.   :38.00   Max.   :25.99  
      meta            depth      
 Min.   : 50.03   Min.   :44.64  
 1st Qu.: 67.39   1st Qu.:48.90  
 Median : 82.45   Median :50.14  
 Mean   : 82.04   Mean   :50.14  
 3rd Qu.: 95.97   3rd Qu.:51.35  
 Max.   :112.45   Max.   :56.83  
shark_data <- na.omit(shark_data)

set.seed(123)  
train_index <- createDataPartition(shark_data$blotch, p = 0.8, list = FALSE)
train_data <- shark_data[train_index, ]
test_data <- shark_data[-train_index, ]

cat("Training data rows:", nrow(train_data), "\n")
Training data rows: 400 
cat("Testing data rows:", nrow(test_data), "\n")
Testing data rows: 100 
lm_model <- lm(blotch ~ BPM + weight + length + air + water + meta + depth + sex, data = train_data)
summary(lm_model)

Call:
lm(formula = blotch ~ BPM + weight + length + air + water + meta + 
    depth + sex, data = train_data)

Residuals:
     Min       1Q   Median       3Q      Max 
-2.83160 -0.65735 -0.03399  0.65674  2.84243 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept) 10.3242015  2.0482091   5.041 7.11e-07 ***
BPM         -0.0008375  0.0034588  -0.242   0.8088    
weight      -0.0010884  0.0036394  -0.299   0.7650    
length       0.0018266  0.0010588   1.725   0.0853 .  
air         -0.0130284  0.0349766  -0.372   0.7097    
water        0.0136424  0.0289796   0.471   0.6381    
meta        -0.0015427  0.0029479  -0.523   0.6010    
depth        0.4944716  0.0244901  20.191  < 2e-16 ***
sexMale      0.1869687  0.0985288   1.898   0.0585 .  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.9804 on 391 degrees of freedom
Multiple R-squared:  0.516, Adjusted R-squared:  0.506 
F-statistic:  52.1 on 8 and 391 DF,  p-value: < 2.2e-16
lm_predictions <- predict(lm_model, newdata = test_data)

mse_lm <- mean((test_data$blotch - lm_predictions)^2)
cat("Linear Regression MSE:", round(mse_lm, 3), "\n")
Linear Regression MSE: 1.112 
rf_model <- randomForest(blotch ~ BPM + weight + length + air + water + meta + depth + sex, data = train_data, ntree = 500)
print(rf_model)

Call:
 randomForest(formula = blotch ~ BPM + weight + length + air +      water + meta + depth + sex, data = train_data, ntree = 500) 
               Type of random forest: regression
                     Number of trees: 500
No. of variables tried at each split: 2

          Mean of squared residuals: 1.099551
                    % Var explained: 43.35
rf_predictions <- predict(rf_model, newdata = test_data)

mse_rf <- mean((test_data$blotch - rf_predictions)^2)
cat("Random Forest MSE:", round(mse_rf, 3), "\n")
Random Forest MSE: 1.323 
threshold <- median(shark_data$blotch)  
train_data$blotch_high <- ifelse(train_data$blotch > threshold, 1, 0)
test_data$blotch_high <- ifelse(test_data$blotch > threshold, 1, 0)

logistic_model <- glm(blotch_high ~ BPM + weight + length + air + water + meta + depth + sex, data = train_data, family = binomial)
summary(logistic_model)

Call:
glm(formula = blotch_high ~ BPM + weight + length + air + water + 
    meta + depth + sex, family = binomial, data = train_data)

Coefficients:
              Estimate Std. Error z value Pr(>|z|)    
(Intercept) -45.308977   6.477493  -6.995 2.66e-12 ***
BPM          -0.008868   0.008777  -1.010   0.3123    
weight        0.009542   0.009310   1.025   0.3054    
length        0.002545   0.002741   0.928   0.3532    
air          -0.035707   0.090035  -0.397   0.6917    
water         0.062872   0.075840   0.829   0.4071    
meta         -0.002207   0.007367  -0.300   0.7645    
depth         0.895097   0.094771   9.445  < 2e-16 ***
sexMale       0.634779   0.255259   2.487   0.0129 *  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 554.52  on 399  degrees of freedom
Residual deviance: 384.89  on 391  degrees of freedom
AIC: 402.89

Number of Fisher Scoring iterations: 5
logistic_predictions <- predict(logistic_model, newdata = test_data, type = "response")
logistic_predictions_class <- ifelse(logistic_predictions > 0.5, 1, 0)

accuracy_logistic <- mean(logistic_predictions_class == test_data$blotch_high)
cat("Logistic Regression Accuracy:", round(accuracy_logistic * 100, 2), "%\n")
Logistic Regression Accuracy: 76 %
plot(test_data$blotch, lm_predictions, col = "blue", pch = 16, main = "Actual vs Predicted (Linear Regression)",
     xlab = "Actual Blotch", ylab = "Predicted Blotch")
abline(0, 1, col = "red", lty = 2)

plot(test_data$blotch, rf_predictions, col = "green", pch = 16, main = "Actual vs Predicted (Random Forest)",
     xlab = "Actual Blotch", ylab = "Predicted Blotch")
abline(0, 1, col = "red", lty = 2)

ggplot(train_data, aes(x = blotch, y = blotch_high, color = as.factor(blotch_high))) +
  geom_point(size = 3) +
  geom_smooth(method = "glm", method.args = list(family = "binomial"), color = "blue") +
  labs(title = "Logistic Regression Classification",
       x = "Blotch",
       y = "Probability of High Blotch") +
  theme_minimal()
`geom_smooth()` using formula = 'y ~ x'
Warning: glm.fit: algorithm did not converge
Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred

train_data$weight_squared <- train_data$weight^2
train_data$length_squared <- train_data$length^2
test_data$weight_squared <- test_data$weight^2
test_data$length_squared <- test_data$length^2

poly_poisson_model <- glm(blotch ~ BPM + weight + length + air + water + meta + depth + sex + weight_squared + length_squared, 
                          data = train_data, family = poisson())
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.549730
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.328610
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.338810
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.397990
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.294970
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.403440
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.024780
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.237670
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.681040
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.048900
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.754000
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.361050
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.491410
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.097410
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.751840
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.334410
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.984890
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.118900
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.259710
Warning in dpois(y, mu, log = TRUE): non-integer x = 39.139720
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.790070
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.341530
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.259380
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.600360
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.641410
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.191580
Warning in dpois(y, mu, log = TRUE): non-integer x = 38.275600
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.380740
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.703230
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.865590
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.681980
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.118470
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.238410
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.702300
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.092250
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.017770
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.304830
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.734230
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.502640
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.548550
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.511450
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.209840
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.768080
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.371150
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.128680
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.381520
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.788330
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.500010
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.291340
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.142640
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.435980
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.310530
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.735150
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.465050
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.563320
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.720530
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.859580
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.870370
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.241400
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.941770
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.479370
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.277160
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.204340
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.139520
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.524000
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.763780
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.427450
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.050250
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.831440
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.930180
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.606920
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.164140
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.907370
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.657260
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.609000
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.907580
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.275130
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.078150
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.445250
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.267320
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.277620
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.228300
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.535310
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.903480
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.397840
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.687030
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.726320
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.656320
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.764470
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.176920
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.549500
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.935940
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.440280
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.487680
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.735770
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.958680
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.565660
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.920570
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.042510
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.771590
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.863920
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.469430
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.803020
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.746390
Warning in dpois(y, mu, log = TRUE): non-integer x = 38.656620
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.310560
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.235680
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.857020
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.888000
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.595810
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.995560
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.103350
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.823180
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.227280
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.391830
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.843280
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.568970
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.111130
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.365570
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.487020
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.928960
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.357390
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.883820
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.561390
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.562560
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.929700
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.308690
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.758690
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.021390
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.383960
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.980820
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.072160
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.536460
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.674390
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.898590
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.127830
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.480570
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.438510
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.548510
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.541890
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.508340
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.458790
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.077620
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.530090
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.133230
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.096750
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.491570
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.260170
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.755800
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.315240
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.850640
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.860740
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.581080
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.622750
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.695440
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.071650
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.866710
Warning in dpois(y, mu, log = TRUE): non-integer x = 38.640130
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.788460
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.048750
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.209170
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.560330
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.035480
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.144080
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.482510
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.269470
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.278920
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.879350
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.673360
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.665630
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.966940
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.827180
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.478580
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.990210
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.338180
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.001030
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.284340
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.770760
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.029830
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.705800
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.848830
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.143500
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.920900
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.482290
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.101820
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.061210
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.073070
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.795410
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.989310
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.664340
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.748150
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.885110
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.698620
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.100990
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.568700
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.294750
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.902920
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.667000
Warning in dpois(y, mu, log = TRUE): non-integer x = 38.275310
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.368930
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.976180
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.493220
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.030940
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.428900
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.871600
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.172850
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.263280
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.554160
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.921340
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.501310
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.072010
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.612260
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.847330
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.260670
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.043940
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.463960
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.261820
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.844330
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.804790
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.770440
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.950210
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.118750
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.150690
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.188000
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.253840
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.850050
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.745140
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.975650
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.459610
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.014140
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.601200
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.799320
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.240480
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.570900
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.454570
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.220410
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.053440
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.956180
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.686450
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.522450
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.771370
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.646570
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.466060
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.431160
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.275280
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.169900
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.987360
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.847840
Warning in dpois(y, mu, log = TRUE): non-integer x = 38.561000
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.402910
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.038340
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.882090
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.042880
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.659210
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.836840
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.902830
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.817210
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.410770
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.542360
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.705720
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.861620
Warning in dpois(y, mu, log = TRUE): non-integer x = 31.359350
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.561610
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.728870
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.399240
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.118780
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.907430
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.606700
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.913320
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.710400
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.888590
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.700400
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.520620
Warning in dpois(y, mu, log = TRUE): non-integer x = 31.884140
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.858140
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.195380
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.765010
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.090210
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.682890
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.773030
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.802530
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.746750
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.976800
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.747590
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.530000
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.263040
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.707350
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.486700
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.114940
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.960670
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.288660
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.478270
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.330560
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.314920
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.496050
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.003630
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.785530
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.246880
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.278140
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.232080
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.724880
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.815280
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.274860
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.552220
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.028530
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.980680
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.996020
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.488820
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.839440
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.078080
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.920760
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.180940
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.698240
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.725750
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.939600
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.498790
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.310960
Warning in dpois(y, mu, log = TRUE): non-integer x = 31.981990
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.584390
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.923010
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.698300
Warning in dpois(y, mu, log = TRUE): non-integer x = 38.338050
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.487760
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.700790
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.971680
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.009730
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.125830
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.277670
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.368680
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.701310
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.294930
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.924440
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.068680
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.604610
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.250160
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.657000
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.637550
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.167050
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.633340
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.456430
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.741820
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.919400
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.332840
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.375960
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.904840
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.720310
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.191470
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.510680
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.876700
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.982790
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.175290
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.273410
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.715100
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.407090
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.448280
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.935610
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.861910
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.178560
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.643180
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.593470
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.414290
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.431540
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.212440
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.542950
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.344800
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.468050
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.103720
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.768350
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.250840
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.610850
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.180840
Warning in dpois(y, mu, log = TRUE): non-integer x = 37.048300
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.344900
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.949830
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.566950
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.868830
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.701740
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.363520
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.557500
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.051500
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.201200
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.496770
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.487380
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.851240
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.607260
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.144120
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.466250
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.272030
Warning in dpois(y, mu, log = TRUE): non-integer x = 33.684360
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.726610
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.654200
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.096640
Warning in dpois(y, mu, log = TRUE): non-integer x = 36.997400
Warning in dpois(y, mu, log = TRUE): non-integer x = 31.797470
Warning in dpois(y, mu, log = TRUE): non-integer x = 31.849950
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.885000
Warning in dpois(y, mu, log = TRUE): non-integer x = 34.608100
Warning in dpois(y, mu, log = TRUE): non-integer x = 32.068410
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.318980
Warning in dpois(y, mu, log = TRUE): non-integer x = 35.265020
summary(poly_poisson_model)

Call:
glm(formula = blotch ~ BPM + weight + length + air + water + 
    meta + depth + sex + weight_squared + length_squared, family = poisson(), 
    data = train_data)

Coefficients:
                 Estimate Std. Error z value Pr(>|z|)    
(Intercept)     2.984e+00  5.835e-01   5.115 3.14e-07 ***
BPM            -8.814e-06  5.981e-04  -0.015 0.988242    
weight         -2.858e-03  9.663e-03  -0.296 0.767426    
length         -4.952e-05  1.816e-03  -0.027 0.978242    
air            -4.341e-04  6.039e-03  -0.072 0.942700    
water           4.389e-04  5.008e-03   0.088 0.930177    
meta           -4.754e-05  5.088e-04  -0.093 0.925559    
depth           1.404e-02  4.220e-03   3.328 0.000876 ***
sexMale         5.691e-03  1.705e-02   0.334 0.738543    
weight_squared  1.612e-05  5.500e-05   0.293 0.769525    
length_squared  2.401e-07  4.300e-06   0.056 0.955472    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for poisson family taken to be 1)

    Null deviance: 22.132  on 399  degrees of freedom
Residual deviance: 10.632  on 389  degrees of freedom
AIC: Inf

Number of Fisher Scoring iterations: 3
poly_poisson_predictions <- predict(poly_poisson_model, newdata = test_data, type = "response")

mse_poly_poisson <- mean((test_data$blotch - poly_poisson_predictions)^2)
cat("Polynomial Poisson Regression MSE:", round(mse_poly_poisson, 3), "\n")
Polynomial Poisson Regression MSE: 1.139 
contingency_table <- table(train_data$sex, train_data$blotch_high)

print(contingency_table)
        
           0   1
  Female 106  82
  Male    94 118
chi_square_test <- chisq.test(contingency_table)
print(chi_square_test)

    Pearson's Chi-squared test with Yates' continuity correction

data:  contingency_table
X-squared = 5.3091, df = 1, p-value = 0.02121
ggplot(train_data, aes(x = sex, fill = as.factor(blotch_high))) +
  geom_bar(position = "fill") +
  labs(title = "Chi-Square Test: Sex vs Blotch High",
       x = "Sex",
       y = "Proportion",
       fill = "Blotch High") +
  theme_minimal()