cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
Anja_W
Level III

Encoding of categorical variables

Hi everyone,

 

I'm interested in an *easy* recoding of categorical variables in JMP. Depending on the variables I want to do this to be able to specify which levels should be compared to each other. If I include all levels in the model I want to get p-values for exactly the differences I want to see or I want to do a model selection and just include certain differences of levels. In these cases the result depends on the specific encoding of the categorical variable.

In some cases I want a dummy encoding or Reverse Helmert etc. I know how to do this by hand, but it would be nice if there is a more convenient way. 

 

I already found this, but it just covers dummy encoding:

Solved: In JMP, how do you adjust the parameterization of categorical variables in a reg... - JMP Us...

 

Any help would be highly appreciated!

4 REPLIES 4
MRB3855
Super User

Re: Encoding of categorical variables

Not sure if this is helpful...but you can make any comparison of interest via Custom Test. Unless I'm missing something, from the sound of your needs there is no need to recode.

Here is a recent discussion.

https://community.jmp.com/t5/Discussions/Linear-and-quadratic-contrasts-with-unequally-spaced-treatm...

 

And here is JMP help:

Custom Test (jmp.com)

 

AnjaW
Level II

Re: Encoding of categorical variables

Thank you very much for your answer and apologies that I only come back to you now. This sounds like a very good option if I only have the categorical factor. Since I'm working with DoEs I usually have more than just this one categorical factor. Additionally, I have several continuous numerical factors, their quadratic effects and twofold interactions. So I would like to go via the Standard Least Squares Platform.

Victor_G
Super User

Re: Encoding of categorical variables

Hi @Anja_W,

If you're using categorical factors in DoE, the Gram-Schmidt Orthogonalization procedure is done by default on categorical factors to transform any k-levels categorical factor into k-1 continuous independant and orthonormal factors (vectors). More infos can be found here :

Gram–Schmidt process - Wikipedia
9.5: The Gram-Schmidt Orthogonalization procedure - Mathematics LibreTexts

The Gram-Schmidt Orthogonalization procedure is needed to make sure the k-1 independant vectors related to k-levels categorical factor are orthonormal (= one unit length). This "scaling" ensures that the lengths of all factors in your design are the same, so the comparison of effects during model building is done on the same basis, there are no bias due to high cardinality of categorical factors that would create very high vectors length and make these factors potentially more (or less) important than they are.

In order to get access to this factor encoding, you can check "Save X Matrix" when creating your design the first time, or launch the script "DoE Dialog" to get access to the same design creation you have and from then, check the "Save X Matrix" option when (re-)generating the same design. You can modify slightly the script so that the X Matrix appear in a JMP datatable format.
You can see more info on this closely related topic : DoE Color map on correlations for multi-level categorical factors 

Hope this answer may help you,

Victor GUILLER

"It is not unusual for a well-designed experiment to analyze itself" (Box, Hunter and Hunter)
julian
Community Manager Community Manager

Re: Encoding of categorical variables

Hi @Anja_W,

 

It sounds like simple linear contrasts might be the way to do what you're asking. Here's a short video describing the most basic use of them in Fit Model. Contrasts are, by far, my favorite way to make those specific comparisons in the context of a larger model (without any recoding of the original variables) and jmp makes specifying them quite easy.

 

https://www.youtube.com/watch?v=YcFmp1KkLkY

 

I hope this helps!

 

@julian  

To view a playlist and download materials shown in this eCourse, visit the course page at: http://www.jmp.com/en_us/academic/ssms.html

Recommended Articles