'factor variables may not contain noninteger values margin stata

I am trying to estimate the marginal effects of my xtlogit model in stata, which looks like this:

xtlogit onset c.l.log_welfarespending##c.l.ethnic_groups l.gdplog, re vce(robust)

The model itself runs smoothly and there are no complications at all. When I try to estimate the marginal effects:

margins log_welfarespending, at(l.ethnic_groups(= (0, 6))

I receive log_welfarespending: factor variables may not contain noninteger values. From what I have read so far sometimes Stata needs a specification on whether the variables are categorical or continuous. When I change the code to:

c.margins log_welfarespending, at(l.ethnic_groups(= (0, 6))

The error changes to only factor variables and their interactions are allowed. Any suggestions how to solve the problem?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source