2
$\begingroup$

I am working on a model based on logistic regression with a binary response variable and my data consists of ratios of integers (number of positive observations out of the total number of observations).

I am trying to speed up the regression by downsampling the ratios (I have to run it on a massive amount of datasets). I can estimate the minimum number of observations (the denominator of a ratio) that I need to perform the required test at a specific power. So I am wondering if

  • downsampling is a valid way to speed up the regression?
  • If so, what is an appropriate way to do this? Can I just, say, pick a random number from Binomial(20, 0.25) if I want to downsample a ratio 250/1000 (=0.25)?

I hope my question is clear. I have just started learning stats so I apologize for this naive question.

$\endgroup$
2
  • 2
    $\begingroup$ I am not sure what you mean by "downsampling". If you take a random sample of cases, things will of course run faster, but estimates will be less precise. $\endgroup$
    – Peter Flom
    Commented Aug 13, 2013 at 23:44
  • 1
    $\begingroup$ I probably used a wrong term. I am looking for a reasonable way to replace all my ratios with "similar" ratios with smaller denominators. $\endgroup$
    – vokov
    Commented Aug 14, 2013 at 6:22

1 Answer 1

1
$\begingroup$

There is no need for "downsampling", not even for speed. What you have is binomial data, and a good logistic regression routine should be able to use data in that form (R can do that). So I will give a simple simulated example with R showing how:

set.seed( 7*11*13 ) # My public seed 
x  <-  runif(100)
p  <-  1/(1+exp(-x)) 
y  <-  rbinom(100, 10, p) 
mydata  <- data.frame(success=y, failure=10-y)
mod  <-  glm( cbind(success, failure) ~ x, family=binomial, data=mydata )
mod

Now, if the number of observations in each binomial experiment was 1000 and not 10 (for a total of 10000 bernoulli experiments), the data frame would still have only 100 rows and computing time should be the same.

Now, if speed is the main problem, there is another approach. From your example it seems that the denominators of the ratios are always large. So, that being the case, calculate a logit transform of the ratio $y = \log(\hat{p}/(1-\hat{p}) )$ and use a usual linear model. This was done as an approximation before the days of fast computers.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.