Choose Language Hide Translation Bar
Highlighted
hxnduke
Level III

Simulation Experiment with Random Categorical Factor

Hi all,

 

I'm looking to examine the effects of varying the continuous factor "liquid" on the response ("strength") in the Flrpaste.jmp example. In the final model, I have "Liquid", "Flour", and "Type" as factors.

I would like to perform a "Simulation Experiment" whereby for each experimental run (consisting of 5000 N Runs), I would have "Liquid" at a unique level (between 4 and 5), "Flour" fixed at White, and "Type" varying randomly between Water and Milk at equal probability (so roughly 2500 N Runs for each type). I know that from the Simulation Experiment platform, I could just select "Liquid" under the list of factors to experiment on and the script would generate a table whereby each row would correspond to one such experimental run. The issue is, Simulation Experiment only accepts "Fixed" type for categorical factor so I won't be able to vary between Milk and Water for "Type". 

 

One option I'm currently employing to get around this is to do this manually by changing "Liquid" value in the picture below and recording the simulation result each time. I'm just wondering whether this might be something that could be easily done with scripting?

 

Attached is the modified "Flrpaste.jmp" file - please refer to the "Simulator" script to generate the simulation interface as shown.

 

Thank you!

 

Flrpaste simulation.png

3 REPLIES 3
Highlighted

Re: Simulation Experiment with Random Categorical Factor

the only way I can think of to use the categorical value in a simulation experiment is to cheat.

 

You need to make a continuous column with values 1 and 2, e.g. .This can be done by selecing the Type column. Then Cols menu, utilities, labels to codes. This will change column entries to 1 an d2 and keep the original values as lables. Of course you can create a new column for a similar behaviour.

 

When you use the simulation you can use uniform. In the created simulation experiment you add a column by right clicking on type column, New formula column,  transform, round. Withthat you create a new column of 1 and 2 which are equally distributed. 

 

Now you have to change the model script to use this column instead of the type column, in this example when you have nothing changed the :Type needs to be exchanged with :Name("Round[Type]") in the script if you want to run the model.

 

Attached a modification of your data table (including a script creating the ne simulation table).

Highlighted
hxnduke
Level III

Re: Simulation Experiment with Random Categorical Factor

Thanks for the suggestion, @martindemel 

I'm a little bit confused. In the "Simulation Experiment Table" script, values of all columns besides Round(Type) are given but how did you get these values? Also, looks like the Round(Type) column is created after the simulation table is generated? In that case, wouldn't the simulation be conducted based on Type values such as 1.2, 1.6 etc. rather than the round values of 1 or 2? I totally understand your point of using Round(Type) column as input for the Simulation Experiment, I'm just not quite sure how that could be done before simulation is actually conducted to calculate Defect Rate etc.

For example, this is part of the script that shows how the Strength Mean column is generated in the Simulation Experiment Table script:

New Column( "Strength Mean",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values(
			[9.22251973143198, 9.52515071457111, 9.13419539683891, 8.40703105322384,
			7.77461735393402, 7.52128272230656, 9.09993409369168, 9.55028950380741,

My other question is, could this be done with categorical factors with more than 2 levels? For the study that I'm working on, there is a categorical factor with 5 levels so I'm not quite sure whether that would work unless I add second, third, and fourth degree terms for Type?

 

As an alternative, would it be possible to write a script to automate the manual, one simulation-at-a-time procedure using the Simulate button, but having Liquid running in a for loop instead?

Highlighted

Re: Simulation Experiment with Random Categorical Factor

 


@hxnduke wrote:

Thanks for the suggestion, @martindemel 

I'm a little bit confused. In the "Simulation Experiment Table" script, values of all columns besides Round(Type) are given but how did you get these values? Also, looks like the Round(Type) column is created after the simulation table is generated? In that case, wouldn't the simulation be conducted based on Type values such as 1.2, 1.6 etc. rather than the round values of 1 or 2? 


Ok, I think this is my fault. You are right the overall defect rate, ODR,  (as the other columns have been calculated based on the numberic values and the Round was applied afterwards. To have a model taking only 1 and 2 into account you need to model ODR by Type and Liquid. In the saved prediction formula you exchange Type by Round(Type) as we now calculate based on the model the ODR for just 1 and 2 values. 

Then you can adjust the gaussian process script with the log10(newODR) column and before ruunning set the response limit for that column to minimize. In the profiler you can see the levels 1 and 2 having impact. Lock Round(Type) and set it to 1, then optimize. Do the same for 2. And compare the results. This probably give what you want. 

 

However maybe another approach would be to save the prediction formula of the model with categorical effect. Then create a simulation table as you need it for the continuous variables, ad a random categorical column with the levels you need and add the prediction column formula in a new column. This will provide you a simulation table with that many levels you need for your categorical value based on the model created in first instance. 

 

Article Labels