# Modelling a proportion

My outcome variable, 'sensitivity', is a continuous proportion ranging from 0 to 1, inclusive. For example, it indicates the percentage of instances in which my gold detector correctly identified the presence of gold when it was present. I do not have access to the original count data, but I know that each proportion comes from 100 instances originally.

Would doing the below be inappropriate?

1. Instances where sensitivity values were exactly 0 or 1 have been modified to 0.001 and 0.999 to apply logit transformation
2. Use a linear regression model with logit(sensitivity) as outcome variable? That is: lm(car::logit(sensitivity) ~ some predictors)

If this is fine, how can I interpret the coefficient? If this is not fine, why is that and what should be done instead?

Stack exchange posts that have similar questions but no clear answer include:

• I have my doubts that $4/8$ should be treated the same as $50000/100000$, even though both equal $1/2$. Excluding the size could lose a lot of information.
– Dave
Jan 23 at 18:27
• Use a binary regression model with counts of successes and failures. The R documentation for glm explains how to do this.
– Sycorax
Jan 23 at 19:04
• Why not just do a logistic regression with the raw success/failure observations? Aggregating the observations into a sensitivity measurement loses information, distorts the observations near the 0 and 1 boundaries, and just generally makes your life harder. Jan 23 at 19:04
• You have tens of thousands of aggregations, is that right? Do you have any sense of how many instances compose each aggregation? Is it reasonable to assume that they all have the same number of instances, whatever that is? Jan 23 at 19:24
• If you have the sample proportions (the aggregations), and you know that each aggregation is composed of 100 instances, then you can immediately infer the counts!
– Sycorax
Jan 23 at 19:40

You don't actually have a continuous proportion. That is a discrete proportion. The proportions you have are counts of successes out of 100 trials. You are fortunate that you know the number of trials for each value (and that they are all the same). You should determine the underlying counts by multiplying the proportions you have by 100. Some rounding may be needed, but it is unlikely to have much impact, especially with a lot of data. From there, you can run a logistic regression with the counts of successes and failures. You can see a little bit how this is done in my answer to Difference in output between SAS's proc genmod and R's glm or perhaps Test logistic regression model using residual deviance and degrees of freedom.

• (+1) And to close the loop regarding OP’s kludge to avoid log(0), one notes that the regression will be sensitive to the choice of the small number chosen to avoid log(0). Regression on the counts avoids this source of bias.
– Sycorax
Jan 23 at 22:11
• I tell you that I have a coin that shows heads 100% of the time. Do you believe me? What if I told you I flipped it one million times? Would you change your answer if I told you that I only flipped the coin once? One million out of one million has the same proportion as one out of one, but the precision of the estimator is wildly different.
– Sycorax
Jan 24 at 14:50
• The logits of 100% and 0% are infinity and negative infinity, @CyG. To get out of this problem, you want to use some ad-hoc adjustment to just those two proportions, but leave all the others as they are. I don't know of a justification for this, nor do I know how to determine what the 'correct' adjustment should be. Why not just use the correct analysis and sidestep all of that? You have all of the information you need, you just need to perform one simple computation first. Jan 24 at 18:11
• @CyG, note that my comment / reason is in addition to the also correct reason given by Sycorax that the SEs, CIs & p-values would be incorrect if each aggregation were treated as a single observation rather than comprised of 100 individual trials, even if you had no 100%s or 0%s in your dataset to worry about. Jan 24 at 19:53
• The logit link is applied to the probability estimates, not the sample proportions, so there's no log(0). All of the other answers to these questions are in this comment thread.
– Sycorax
Jan 26 at 0:03