4.3 Sex specific genetic variance and inter-sexual genetic correlations

ds <- data.frame(animal=BTped[,"animal"],sex=sample(c("Female","Male"),nrow(BTped), replace=TRUE))

squid_data <- simulate_population(
  parameters = list(
    sex=list(
      fixed=TRUE,
      names=c("Female","Male"),
      beta=c(-0.5,0.5)
    ),
    animal= list(
      names = c("G_female","G_male"),
      vcov =matrix(c(0.1,-0.1,-0.1,0.4), nrow=2, ncol=2 ,byrow=TRUE)
      ),
    residual = list(
      names="residual",
      vcov = 0.1
    )
  ),
  data_structure = ds,
  pedigree = list(animal=BTped),
  model = "y = Female + Male + I(Female)*G_female + I(Male)*G_male + residual"
)

data <- get_population_data(squid_data)
head(data)
##            y Female Male    G_female      G_male    residual  animal    sex
## 1  0.2055466      0    1  0.47080769 -0.73545126  0.44099788 R187557   Male
## 2  0.4324628      0    1 -0.62078654 -0.01386573 -0.05367147 R187559   Male
## 3 -0.5981933      1    0 -0.14154068  0.15570322  0.04334741 R187568 Female
## 4 -0.8820294      1    0 -0.09385028 -0.33749998 -0.28817915 R187518 Female
## 5 -0.5110713      0    1  0.31509524 -0.70944997 -0.30162129 R187528   Male
## 6 -0.1480012      1    0  0.07452335  0.34664838  0.27747548 R187945 Female
##   squid_pop
## 1         1
## 2         1
## 3         1
## 4         1
## 5         1
## 6         1
par(mfrow=c(1,2))
boxplot(y~factor(sex),data)
plot(G_female~G_male,data)