# bootstrapping a confidence interval with unbalanced data

Say I have a dataset of penguin weights and the associated penguin gender. This is an unbalanced dataset, eg there is not an equal number of male and female penguins.

I want to bootstrap a confidence interval for the difference in average weight of the male and female penguins, where my point estimate ($$\theta^{^}$$) is the difference in the mean weight of the male penguins from the mean weight of the female penguins.

While doing the bootstrap replicates, would it be correct to separately bootstrap the males and females, eg for n_boot trials:

1   sample with replacement from the male penguin weights
2   separately sample with replacement from the female penguin weights
3   compute the difference in (mean male penguin weight) - (mean female penguin weight)


OR not account for the class imbalance?

1   sample from replacement from the full dataset and ignore penguin gender
2   Determine mean male penguin weight and mean female penguin weight
3   Take the difference of means from step 2


then from n_boot samples (determined with either approach), compute the upper/lower quantiles for a given confidence level, then construct the confidence interval: (e.g. 2 (\theta^{hat}) - quantile_lower, 2(\theta^{hat}) - quantile_upper).

thank you!