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.6170325      0    1  0.2464809 -1.098901182 -0.018131357 R187557   Male
## 2  0.2126651      0    1  0.3753270 -0.132978126 -0.154356766 R187559   Male
## 3 -0.3887086      1    0  0.2620467  0.531475188 -0.150755220 R187568 Female
## 4 -1.0722142      1    0 -0.1760677  1.799807824 -0.396146496 R187518 Female
## 5  0.3466036      0    1  0.4672305 -0.003029647 -0.150366787 R187528   Male
## 6 -0.8563174      1    0 -0.3623897  0.317785707  0.006072329 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)