community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Regression with ordinal variables

Highlighted

Hi community,

 

Fairly simple question. I have a variable that I am trying to regress, and it's divided into "low", "medium", "high" etc. When I enter it into the regression as a string, the coefficients don't match the intended order (e.g., "medium" is higher than "medium-high"). How do I specify an order to this variable?


Thanks

Alteryx Partner

Hi @black_adder ,

 

You can order your variables with levels when you define that field. For example,solution.png

Hi,

 

Thanks for the reply.

Unfortunately, I don't know how to implement this. I am not "declaring" the variable in R per se, I'm importing it from an excel file, so it's in my datastream already.

Would you plug this into a formula tool?

 

Thanks

Alteryx Certified Partner
Alteryx Certified Partner

Hello @black_adder ,

 

Te variables are being ordered alphabetically. The simplest solution would be to create an if statement editing them.

 

For example

 

IF [Coefficient] = "high" THEN "3 high" ELSEIF [Coefficient] = "medium" THEN "2 medium" ELSE "1 low" ENDIF

 

Cheers

Labels