I'm trying to fit a weighted ordinal logistic regression as my dependent variable, meat consumption, is ordered following three categories (low, medium and high) and my data includes weights.
I'm using the svyolr() function from the package survey on a survey object I created with the svydesign() function.
However, when running the code, I keep getting an error message reading 'response must be a factor', which really puzzles me as I already have converted my outcome dependent variable into a factor...
Here is the code I'm running:
DataUBSw$Meat_consum <- factor(DataUBSw$Meat_consum, ordered = TRUE)
modele_ord_w <- svyolr(Meat_consum ~ Geo, design = DataUBSw)
with DataUBSw being the survey object created from my original dataframe, with weights included.
I tried running the regression multiple times, to no avail as the same error message keeps popping up:
Error in svyolr.survey.design2(Meat_consum ~ Geo, design = DataUBSw) :
response must be a factor
Would anyone have an idea why I keep getting this error message?
Thanks very much!