Hi there, was hoping someone could help,
Im quite new to Rstudio, using it for help to formulate hypothesis. And im just going around in circles trying to do a regression model with R

I'm using a dataset about election results and one variable is called dem_economist and its ordinal data type with two types of democracy, 0 and 1. and the outcome variable is ratio about levels of confidence. And I've formulated a hypothesis that goes something like "Countries with type 0 democracy have a higher level of confidence than type 1" all good there but when i come to do a regression model, surely if i were to use the standard

world <- subset(world, !is.na(confidence))
model.1 <- lm(confidence~dem_economisteasy, data=world)
summary(model.1)

it wouldn't explain one type of democracy over the other, rather it would talk about the statistical significance of any type when compared to levels of confidence.
im breaking my brain trying to think of solutions. if anyone could suggest anything that would be great, do i code it as a multivariate regression but technically type of democracy isnt two variables just two categories under one variable

This is a problem in logistic regression because the response variable is binary. Ordinal regression is when the response is ordered, such as grades or ranks.

The tool is glm. You can start with

model <- glm(democracy ~ ., data = your_data, family = binomialâ€ť)

Interpreting results is quite a bit different from ordinary least squares regression. See my post here.

UPDATE: revisiting on laptop after comment made on tablet. If confidence_ratio is continuous within the closed interval[0.0:1.0], meaning it can take on any value and isn't say, limited to just 0.1 increments, the ordinary least square regression is adaptable to the purpose even when independent variables are binary. If there are discrete increments, then the variable is ordinal. The increments need not be evenly spaced.

One package for that is {ordinal}. I'd encourage you to review Chapter 13 of Frank Harrell's Regression Modeling Strategies because there's a lot going on with this technique. You can find a pdf if you look hard enough but it's a large book and easier to navigate in hard copy.