And then what I can do is, I can actually fit different models.
So that's the additive model.
If I want to fit the dominant model, I can just change how I code that variable,
so I basically require it to have, only if there's either one or
two copies of the minor allele then you have risk.
And so that's going to be with the cases where snp1 is equal to two or three and
then I can fit the dominant model by fitting the next glm, where instead of
using the snp variables, the covariant, I fit this dominant dummy variable.
And so then I get a slightly different estimate for
that value because I'm fitting a different model and so
it's estimating something a little bit different.
The other thing I can do is, I can just directly adjust for things like
the principal components, which is what people often need to do because it's
a typical confounder in the population structure in these sorts of models.
In this case I've just added to my model, my term for the principal components.
And so then I can look at that model, and it's got estimates for all the principal
components which I'm not as interested in, and then the estimate for
the snp variable now adjusted for the principal component values.
If I want to do many of these, you can actually do that quickly in R as well.
So you can do that by using this snp.rhs.test function,
which will on the left-hand side should take the case control status or
whatever your outcome is.
On the right-hand side is adjustment variables,
this is an unadjusted model you just tell it to regress with the 1 on that side.
And then you tell it where the snpata is and it fits many glms.
So if we look at what are the names of that object?
It's an s4 class so it has a slightly different way of accessing it.
We can look and
see that one of the things that you get out of that is the chi squared statistics.
So this fits sort of a version of the generalized linear model, but
calculates the chi squared statistic.
And so we can plot those chi square statistics here versus what they
would expect.
So this is again a QQ plot, so this is the quantiles of the expected chi square
distribution versus the observed chi square distribution.
You see it's not the same.
You would expect there to be very few signals in the snpdata sets, so
you'd expect those actually to not really fall very far from the expected quantiles.
So we can fix that by looking at the adjustment.
So here's we're going to basically fit the same model,
only now we're going to adjust for the pcs.
So here we've got the status tilt of the pcs.
So this is the adjustment variables, with the same data set, so we fit that model.
And then we can look at the chi
squared values for this one.
And let's see here.