0
$\begingroup$

I am trying to model data in which I have 2 continuous predictors and a proportional response, but it isn't a single proportional value, but rather 5 different categories, whose proportions all sum up to 1.

Here is an example toy dataset, replicating this requires tidyverse, or at least dplyr.

df1 = data.frame(
          pred1 = rnorm(100),
          pred2 = rnorm(100),
          year = rep(1:20, each = 5),
          cat_name = rep(letters[1:5], times = 20),
          counts = sample(1:100, 100, replace = T)
   )

df1 = df1 %>%
     group_by(year) %>%
     mutate(
       total_count = sum(counts),
       prop = counts/total_counts
       )

I realize that this toy dataset would make it perfectly valid to just use the counts and not bother with the proportions, but in my real dataset, total counts are decreasing strongly over time, and that affect will vastly outweigh any change in relative amounts resulting from the predictor variables (which do not have a strong trend in time), so proportions is a way of getting rid of that issue.

I would like to model the how the proportions of each category change in response to the two continuous predictor variables (or, in the case of this toy dataset, likely don't change), but I haven't had much luck in finding out how to do this. It's easy enough to generate a model for any one of the categories, but I'd like to know how all of them change together. And I assume that running one model for each category is going to run into multiple test issues. Any resources would be greatly appreciated.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.