# Appropriate Test for Binary Dependent Variable and Continuous Independent Variable

I have a dataset of observations of hawks foraging. I am trying to examine the relationship between height of perch used (continuous independent variable, integers of 0 through 10) and outcome of a foraging attempt (binary: success or fail). I'd like to answer the question, are hawks more successful at shorter or taller perches.

Would it be appropriate to use a linear regression or is there something more apropos?

• Do you have any other information about the foraging attempts? Eg: Do you have multiple attempts from the same hawk? Or some information about location, time of day, any other variable that can have an effect on the success probability? Nov 13, 2022 at 14:30
• I have 6-7 different variables relating to each foraging attempt that might impact success probability. For those, I ran a GLMM with bird identity being a random effect. My question here was more focused on descriptive stats rather than a more in-depth analysis. Nov 14, 2022 at 15:08
• Both suggested analyses (regression and t-test) are more than descriptive summaries, and more importantly, assume the observations are independent. That is an inaccurate assumption if there are multiple observations of the same hawk. In the future, consider including all relevant information in the question. Nov 14, 2022 at 15:49
• I think I would argue that performing a mixed-effects regression qualifies an as in-depth analysis much more than it qualifies as descriptive statistics.
– Dave
Nov 14, 2022 at 15:58

Can you reframe your question as, "Are perch heights different between successful and unsuccessful foraging attempts?" In this case, you could compare the two groups, success and failure, with a t-test. By using a two-tailed t-test, you are making no assumptions of the direction of the difference, higher or lower could either be more successful.

The null hypothesis in this case is that heights do not differ between successful and failed foraging attempts, and the alternative hypothesis that perch height does differ between groups.

• For the depth of the question I'm trying to answer, I guess I could go about answering my question that way. No use in over-analyzing when a simple t-test would work. Thank you. Nov 13, 2022 at 1:56
• Dave's answer gives you a way to interpret the effect of height by looking at the coefficient in a logistic regression. Mine is simply a comparison of means. Either or both have value to for different reasons. Nov 13, 2022 at 5:06
• I completely agree, both are insightful. One is simply more appropriate for my question. Thank you both. Nov 13, 2022 at 5:29

Your outcome of interest is the success probability of success. Therefore, you want some kind of probability model that estimates the probability of a success for a given perch height.

Linear regression in this case would be a linear probability model. While people do use this, there are issues, among them being that illegal probabilities exceeding $$1$$ or below $$0$$ can be predicted.

More reasonable might be a logistic regression, which applies a clever transformation to your predictions to squeeze them into legal probability values.

Any decent statistical software will have a logistic regression option that outputs coefficient estimates along with confidence intervals and p-values. You interpret the coefficients similar to how you would interpret them in a linear regression, except that they explicitly describe changes in log-odds. Simplified, this means that a positive coefficient corresponds to an increase in probability while a negative coefficient corresponds to a decrease in probability.

You do have to watch out for how you code your binary variable. Typical would be to take failures as $$0$$ and successes as $$1$$. If you do not do this coding explicitly and rely on your software to interpret a string input, you will want to know how that conversion occurs.