# Which statistical method to use to compare reinforced colour and speed of learning?

I'm working on my master's thesis where I'm trying to determine whether sea turtles are capable of discriminating between colour. One subcategory I'm looking into is seeing whether the speed they learned to discriminate between the colour is affected by which colour was their reinforced colour (ie whether colour affects how fast they learned). I'm not sure what statistical test (if any) I could use to test that. I don't have a ton of data for this as all turtles learned the task in max 10 days. The data also isn't normally distributed.

Below is the data. The turtles were shown the two colours for 10 times each day and I noted how many times they picked the correct colour out of 10. At the top, their reinforced colour is noted.

Green 1 Green 2 Green 3 Hawksbill Green 4 Green 5
Red Red Blue Red Blue Blue
Day 1 8 5 6 5 7 8
Day 2 9 7 6 7 7 8
Day 3 10 8 8 7 9 9
Day 4 10 7 8 8 9 10
Day 5 10 7 7 8 10 10
Day 6 10 8 9 9 10 10
Day 7 10 9 9 8 10 10
Day 8 10 10 10 9 10 10
Day 9 10 9 10 10 10 10
Day 10 10 10 10 10 10 10

Edit: Some of you asked for clarification of a few things. The first line (Green 1, Green 2, etc.) represents the turtle species. The second line represents what their reinforced colour was ie if they chose that colour by touching the paddle with their nose, they got a reward.

The experiment was set in such way: once a day when the turtles were fed, the 2 coloured paddles were shown to them. Before "Day 1" in this matrix, each turtle was trained with their reinforced colour alone so they learned what it meant. "Day 1" here means the first day that both colours were shown to the turtles. And during each session, the paddles were shown 10 times and I recorded out of how many of those 10 tries, they chose the correct (reinforced) colour. So Green 1 on Day 1, got 8/10 correct. Does that make it clearer?

Edit 2: Yes, the point of the experiment was to see if turtles are able to tell a difference between 2 colours. We chose red and blue as they're the furthest away on the colour spectrum and therefore the most different. We cut a circle out of blue plastic and one out of red plastic and attached them to a pre-made paddle which made it easier to put it in the water and show it to the turtle. We first trained them with only one colour (their reinforced colour) so that they learned they had to touch the coloured paddle with their nose to get a food reward. Once this was achieved, we showed them one red and one blue paddle at the same time and had them choose. If they touched the coloured paddle they had during the initial training, that was considered a correct choice. If they chose the other coloured paddle, that was the incorrect choice.

A session is basically one feeding/training session. Since they're fed once a day, there was one session per day. And during each session, the two different paddles were shown to the turtles 10 times - so they had to make a choice 10 times. In the table, I recorded how many of those 10 times, they chose the correct colour per feeding session.

Each column in the table is a different individual. I had 5 individuals which were of the green turtle species and 1 individual that was a hawksbill species.

Whether the reinforced colour was on the left or right side when presented to a turtle was randomised each time. So out of the 10 times, they were shown the paddles during a session, it was always in a random order of left and right.

• please explain variables/terms in the table with details. Feb 17, 2023 at 0:19
• what in the matrix represents each individual turtle? Feb 17, 2023 at 8:19
• This is a bit confusing since, I assume, Green is a type of turtle not a colour to which they were exposed. Is that correct? If so edit that information into the question please. Feb 18, 2023 at 13:18
• The last paragraph is still unclear. What is a reinforced colour? What are these paddles? What is a session? How does the turtle choose a colour? ----- I imagine that I might be missing something, but I guess that a very simple explanation of the test is possible. Feb 18, 2023 at 16:29
• I imagine now that you had the turtles make 'some choice' between two options during feeding. Initially you gave them two options with the same colour for some period of time, and after that you gave them during 10 days two options with different colours. In that period of 10 days you recorded whether the turtles had a preference for a particular colour based on the colour that they were presented in the training period.... Feb 18, 2023 at 16:36

This question describes an interesting experiment: can sea turtle distinguish between the colors red and blue? And since the OP has provided all the data, let's look at it.

There is a panel for each turtle, with turtles whose reinforced color is red on top. For each color (row), I've ordered the turtles by speed of learning (more about this below). The time $$t$$ (in days) ranges from 0 to 9; it simplifies the math a bit to start at $$t$$ = 0 rather than $$t$$ = 1. And each point indicates the number of successes out of 10 trials: the number of times the turtle pushed the paddle with its reinforced color and got a reward.

The position of the reinforced color (left or right paddle) was randomized during each trial. So we can model the number of successes as $$Y \approx \operatorname{Binomial}(10, p_t)$$. Let's also assume that the probability of success $$p_t$$ is a function of time and two learning parameters, $$\alpha$$ and $$\beta$$:

\begin{aligned} p_t(\alpha,\beta) &= \alpha + (1 - \alpha)\left(1 - \exp(-\beta t)\right) \quad \alpha\in(0,1), \beta > 0 \end{aligned}

This equation looks a bit complex but the meaning of $$\alpha$$ and $$\beta$$ is easy to explain: Initially, at time $$t$$ = 0, the probability of success is $$\alpha$$ and then over then next 9 days, it grows by a factor of $$\beta$$. Prior to the experiment, each turtle received training with its reinforced color alone, so we expect the $$\alpha$$ parameter is ≥ 0.5 for all of them. The $$\beta$$ parameter is the speed of learning.

Here are the MLEs (maximum likelihood estimates) of $$\alpha$$ and $$\beta$$ for each turtle. I obtained these by minimizing the negative log-likelihood of $$\operatorname{Binomial}(10, p_t)$$. R code is attached at the end.

#>   id        color α.mle β.mle
#>   Green (1) red   0.779 1.36
#>   Hawksbill red   0.517 0.272
#>   Green (2) red   0.522 0.249
#>   Green (5) blue  0.735 0.778
#>   Green (4) blue  0.623 0.657
#>   Green (3) blue  0.528 0.314


There is variability in the initial probabilities $$\alpha$$, with Green (1) and Green (5) doing very well from the start. There is even more variability in the speed of learning $$\beta$$. This is not a formal hypothesis test but the exploratory analysis suggests that either (a) there is no difference in the speed of learning when the reinforced color is blue vs red, or (b) there difference is small compared to the biological variability between turtles.

library("nloptr")

minimize <- function(x0, func, lb = NULL, ub = NULL) {
opts <- list(
"algorithm" = "NLOPT_LN_SBPLX",
"xtol_rel" = 1.0e-6
)
a <- nloptr(x0, func, lb = lb, ub = ub, opts = opts)
list(x = a$$solution, fx = a$$objective)
}

turtles <- c(
# red
"Green (1)", "Hawksbill", "Green (2)",
# blue
"Green (5)", "Green (4)", "Green (3)"
)

params.mle <- tibble(
id = character(),
color = character(),
α.mle = numeric(),
β.mle = numeric()
)

for (i in seq(turtles)) {
id <- turtles[i]
x <- 0:9
n <- 10

subset <- data %>%
filter(.data$$id == {{ id }}) y <- subset$$successes
col <- subset\$color[1]
nll <- function(param) {
a <- param[1]
b <- param[2]
prob <- a + (1 - a) * (1 - exp(-b * x))
-sum(dbinom(y, n, prob, log = TRUE))
}

soln <- minimize(c(0.5, 1), nll, lb = c(0, 0), ub = c(1, 3))
a <- soln$$x[1] b <- soln$$x[2]

params.mle <- params.mle %>%
bind_rows(
list(
id = id, color = col,
α.mle = a, β.mle = b
)
)
}

params.mle