File:Genotype phenotype regression.svg

Summary

Description
English: Illustration of an association between phenotype and genotype. Data is simulated, actual associations detected in GWAS are usually much smaller. Fitted regression line shown in red and actual phenotype means for each genotype are shown in blue crosses.
Date
Source Own work
Author D Wells
SVG development
InfoField
 The SVG code is valid.
 This plot was created with R.
Category:Valid SVG created with R code#Genotype%20phenotype%20regression.svg
 The file size of this SVG plot may be irrationally large because its text has been converted to paths inhibiting translations.
Category:Path text SVG
Source code
InfoField

R code

library(ggplot2)
set.seed(5678)
n = 1000
allele_freq = 0.3
genotypes = rbinom(n, size = 2, p = allele_freq) # assuming HWE
mean_phenotype = function(genotype) 0.1 + 0.3 * genotype
phenotypes = rnorm(n, mean_phenotype(genotypes))

svg("genotype_phenotype_regression.svg", width=4, height=4)
ggplot(data.frame(phenotypes, genotypes), aes(genotypes, phenotypes)) +
  geom_jitter(alpha=0.2, width=0.3) +
  geom_smooth(method="lm", colour="red3", fullrange=T, se=F) +
  stat_summary(fun = mean,  geom="point", shape="+", size=7, colour="blue3") +
  scale_x_continuous(breaks=c(0, 1, 2), labels=c("0 (CC)","1 (CT)","2 (TT)"), limits=c(-1,3)) +
  coord_cartesian(xlim=c(-0.5, 2.5))+
  theme_classic() +
  xlab("Number of T alleles") + ylab("Phenotype")
dev.off()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Category:CC-BY-SA-4.0#Genotype%20phenotype%20regression.svgCategory:Self-published work
Category:Genome-wide association studies Category:Statistical genetics
Category:CC-BY-SA-4.0 Category:Genome-wide association studies Category:Path text SVG Category:Self-published work Category:Statistical genetics Category:Valid SVG created with R code