Adding covariates in chi-squared test or proportions test? I am having trouble figuring out what analysis is appropriate for my research question. I've been googling for the past few days but couldn't find the answer. I would greatly appreciate it if anyone could provide some thoughts or comments.
Below is my research question, which I only changed the names of the variables to make it more straightforward:
Suppose that I hypothesize that people will prefer eating chocolates over candies. So I collected participants and asked them which they like more, chocolate or candy.
Thus in my model, the dependent variable is a categorical variable with two levels (0=candy, 1=chocolate). Then I ran chi-squared goodness of fit analysis and found out that 85% of participants preferred chocolate, and 15% preferred candy -- which supported my hypothesis that people prefer chocolates over candies, and that it's not an even split (50% vs. 50%).
But I found out that age is correlated with the preference for chocolate, such that older people are more likely to choose chocolate over candy.
Thus I want to control for the effect of age, such that even after accounting for age, significantly more people will still prefer chocolates over candies.**
I’ve been trying to figure out how to do this. I don’t think I can include covariates when running the chi-squared goodness of fit analysis. And binomial logistic regression doesn’t seem to work here either because I don’t have a predictor variable, but just the covariate (i.e., age) and the dependent variable (i.e., chocolate vs. candy). Or would the likelihood-ratio test serve the purpose here?
I would really appreciate it if anyone could provide any suggestions on the analysis.
Thank you very much for your time!
Best,
Jean

You state that the hypothesis you are interested in is that the proportion of people who prefer chocolate is larger than .5. You also state that this proportion is influenced by age, and you want to control for that. However saying that the proportion is influenced by age, means that there is no longer a single proportion, but one proportion for each age. So the problem is your hypothesis no longer makes sense. The solution is to think about what it is that you want to know exactly (e.g. do you want to know the proportion of an average aged person or the average proportion). What the right hypothesis for your problem is depends on the details. Since this is obviously a fictional example, there is not much more to be said here.
