You will likely / hopefully receive a more in depth response on Cross Validated, which is more 'statistics'-aligned than we are.
The simplest type of association test just looks at allele tallies in cases versus controls and derives a Chi-square P value from this, as I go over step-by-step here: A: SNP dataset and Z Score
The SNPs are tested independently for association. Each test is therefore its own model and the ones that pass Genome-wide statistical significance are chosen. Prior to running these tests, we can pre-filter the variants based on various metrics, including:
- missingness
- Drift from Hardy-Weinberg Equilibrium (HWE)
- Linkage Disequilibrium
- et cetera
Power analysis prior to study commencement helps to determine ideal sample numbers for testing.
That's just simple association tests.
--------------------------------------------------
It is also possible to test each SNP and adjust for certain factors, like BMI, height, exposure to allergens, ethnicity, gender, age, etc. This type of test is performed through logistic regression.
In these situations, the endpoint (y variable) is usually a binary trait (1, case; 0, control), with the x predictors being the genotype being tested and then all of the covariates that I mentioned above, e.g.:
glm(CaseControl ~ SNP1 + PC1 + PC2 + age + BMI)
[NB - ethnicity / population stratification is usually controlled via PCs / eigenvectors, here PC1 and PC2]
From this, the P value for SNP1 will be 'adjusted' by the other factors in the model, i.e., PC1, PC2, age, and BMI.
Note: you should not just adjust for any type of variable without justification. For example, you cannot just throw everything into the model and assume that this will be in any way good. You need justification for including covariates. For example, prior to testing any SNPs, you should independently test each of your covariates against your endpoint to see if it's statistically significantly different between, for example, your cases and controls - if it is, then you should include it, as, otherwise, your testing would be confounded by such a covariate.
Regarding age and age^2, think of the squaring as a transformation or smoothing function (like logging), which can bring the distribution of the covariate to a normal distribution. Other options may include:
- converting age into a categorical variable (e.g. <18, <30, <50, >=50)
- stratifying your cases and controls by matching on age, as in
conditional logistic regression
Indeed, one should also check the distribution of each covariate and normalise (log, square, square root, etc), categorise, match (conditional logistic regression), or do something else if the distribution is likely an issue.
If you have a trait with excess zeros, then consider categorising it and not testing it as a numerical covariate.
A QQ plot of your obtained P values is the typical and easy way to see how your sample cohort and model assumptions have held up against the expected distribution in a 'normal' population.
Please also read this former answer by Philipp: A: GWAS: when is it appropriate to add covariates?
Kevin