Other type of outcome that's commonly observed in genomic data particularly data from next generation sequencing is count outcome data. So the very common scenario is you're dealing with a situation where you have a number of reads that overlap a particular region or variant and you want to make a regressional model for those counts. So here's an example. It's from gene expression datas. So, suppose, for example, that you wanted to count how many reads covered each gene. So, here are a number different that you could count that. You could say just if the read falls entirely within that gene how many counts does it get? There's a number of choices that you could actually make for that, but for now let's just assume that you made one of these choices and you've gotta count for each gene, then you can make those counts by calculating the total number of reads say that cover that gene. Now you have a count for each sample and for each gene of the total number of reads that cover that gene. So what you want to do is you want to model that distribution and so you might want to build a regression model. Again, based on the relationship between the phenotype that you care about and the counts for a particular gene. The most commonly used distribution to model counts in statistics is the Poisson distribution. So one thing to keep in mind about the Poisson distribution is that the mean and the variance are the same. So for example if you look at a Poisson distribution with a low mean, it also has a low variance. When you increase the mean you also increase the variability, and if you increase the mean even farther you increase the variability even more. So this is a distribution that's very good for count data because it's only positive, and it has other properties that for idealized type distributions it models count data very well. But it's very restrictive in modeling the variance. So, again, you could fit a regression model, but here, now, the regression model is going to be a little bit more complicated. So this is an example of the generalized linear model. Logistic regression is another example where we take a function of the expected value of the thing that we care about. So here, we have the counts that we care about, conditional on, say, the group indicator. And so what we're going to do is model the expected value of the counts, given our indicator as some function of the data. So here, usually what we do is use a link function when you're modeling counts, and the link function is often the log function. So you say the log of the counts is going to be modeled as a function of some adjustment variable here, this is usually a normalization constant which models the total sequencing depth, plus the parameter that we care about. So again, this is another parameter that we're going to be looking at, that again, models on the log scale of the count the relationship with the outcome variable that we care about. So this is another way of fitting a regression model now to a set of count data. And so if you fit a model like this, you get a slightly better fit than you do with using sort of standard linear regression models to count data. So here is a set of data where you have the average on the y, or x axis and the variance on the y axis. And so here you see the fit from the Poisson model in purple and it turns out that you can even do a little bit better than that if you model the relationship directly between the mean and the variance. So remember that the Poisson variable required that the mean and the variance be the same. So you have a straight line in the relationship between mean and variance. But sometimes that's not exactly true for counts, and so you actually model it as a function of the relationship between the mean and variance. So the two most popular techniques for modeling count data and bioconductor are edgeR and DEseq and both of those uses a type of local or smoothed regression to estimate the relationship between mean and variance. You can then plug that into a more flexible model, the negative binomial model. So the negative binomial model allows you to model the mean and variances set using separate parameters, or using a pair of parameters rather than just one parameter. And so while the Poisson distribution that I've modeled here in black fixes the variability for a specific mean value, you could have that same mean value but also a large number of different variances using the negative binomial distribution. So that's a little bit more flexible. So now you can model the counts as a negative binomial distribution, where the mean of that negative binomial distribution is equal to a sample-specific size factor that maybe relates to the number of reads that you've got. And then a parameter proportional to the number of fragments, which you then model as a function of using that same sort of log link. You model the relationship between the thing that you care about, how many counts you get, or how many fragments you have for that particular gene. For that particular sample is a linear function of the covariates that you care about. So again it's writing it down as a linear model but where the scale is slightly different. So this is an example of a generalized link linear model which you can learn a lot more about. For example in this set of lecture notes, they go into a lot of detail about generalized linear models, in particular for Poisson regression. This is again a huge topic and we've only scratched the surface but I wanted to show you an example of how you can relate count data to covariance that you care about using a regression model even if it's not the standard linear regression model by using this link function.