# How can I test whether a trait frequency has changed significantly between generations in a transplant experiment?

I have a 4 x 4 transplant experiment. There are four locations and substrates. For each location and substrate combination I have the count of offspring karyotypes, coded as aa, ab, bb. I also have the karyotype counts for the parents at each location. I have treated the parents as generation 1 and the offspring as generation 2. I have also calculated the frequency of each karyotype, i.e. aa, ab, or bb. What is important is the 'aa' karotype as this is the one under selection.

I would like to know if there is a significant change in the 'aa' frequency of the karotype between generations at each location. Further, does the environment or "substrate" matter? For example, transplanting young to a "foreign" substrate could either increase or decrease the aa frequency, this is what is interesting.

I have tried a logistic model, but am unsure if this is the proper approach given my two questions above:

glm(aap ~ Generation + Location*Substrate, data=data)


Your help is very much appreciated.

Example Data:

data <- structure(list(Location = c("B", "B", "B",
"B", "B", "A", "A", "A",
"A", "A", "C", "C", "C", "C",
"C", "D", "D", "D", "D", "D"
), Substrate = c("B", "B", "A", "C",
"D", "B", "A", "A", "C", "D",
"B", "A", "C", "C", "D", "B",
"A", "C", "D", "D"), Generation = c(1,
2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2), aa = c(5L,
8L, 26L, 37L, 15L, NA, 5L, 16L, 29L, 11L, 12L, 17L, 11L, 18L,
18L, 6L, 15L, 11L, 2L, 21L), ab = c(16L, 14L, 32L, 26L, 38L,
NA, 18L, 43L, 22L, 22L, 16L, 23L, 12L, 18L, 9L, 8L, 38L, 34L,
22L, 37L), bb = c(6L, 1L, 4L, 3L, 4L, NA, 5L, 17L, 9L, 7L, 5L,
14L, 2L, 12L, 6L, 2L, 15L, 13L, 5L, 14L), aap = c(18.51,
34.78, 41.93, 56.06, 26.31, NA, 17.85, 21.05, 48.33, 27.5,
36.36, 31.48, 44, 37.5, 54.54,37.5, 22.05, 18.96, 6.89, 29.16), abp =   c(59.25, 60.86, 51.61, 39.39, 66.66, NA, 64.28, 56.57, 36.66, 55, 48.48, 42.59, 48, 37.5, 27.27, 50, 55.88, 58.62, 75.86, 51.38), bbp = c(22.22,
4.34, 6.45, 4.54, 7.01, NA, 17.85, 22.36, 15, 17.5, 15.15,
25.92, 8, 25, 18.18, 12.5, 22.05, 22.41, 17.24, 19.44)), class = "data.frame", row.names = c(NA,
-20L), .Names = c("Location", "Substrate", "Generation", "aa",
"ab", "bb", "aap", "abp", "bbp"))