Categorical
Categorical using Response Screening
Summary: Generates a contour profiler plot for yield with Reaction Temperature and Reaction Time as factors, utilizing the Response Screening platform in JMP.
Code:
// Response Screening
// Open data table
dt = Open("data_table.jmp");
// Response Screening
Response Screening(
Y(
:Job Satisfaction,
:I am working on my career,
:I want to see the world,
:
My home needs some major improvements,
:
I have vast interests outside of work,
:
I want to get my debt under control,
:I come from a large family,
:Brush, :Floss
),
X(
:Gender, :Single Status,
:School Age Children, :Age Group
),
Force X Categorical( 1 ),
Force Y Categorical( 1 )
);
Code Explanation:
- Open table.
- Run Response Screening.
- Set response variables.
- Set predictor variables.
- Force X categorical.
- Force Y categorical.
Example 1
Summary: Opens a data table, defines a categorical analysis with multiple responses, and fits the model to predict Annual Salary Z while incorporating Gender, Length Of Service, and Performance as effects, suppressing detailed diagnostic plots.
Code:
// Categorical Several
// Open data table
dt = Open("data_table.jmp");
// Categorical Several
Categorical(
X( :Age Group, :School Age Children ),
Grouping Option(
"Each Individually"
),
Responses(
:I am working on my career
),
Responses(
:
My home needs some major improvements
),
Responses(
:
I have vast interests outside of work
),
Responses(
:I come from a large family
),
Crosstab Transposed( 1 ),
Legend( 0 ),
Test Response Homogeneity( 1 )
);
Code Explanation:
- Open data table.
- Define categorical analysis.
- Specify X variables.
- Set grouping option.
- Add first response.
- Add second response.
- Add third response.
- Add fourth response.
- Transpose crosstab.
- Disable legend.
- Enable test for homogeneity.
Example 2
Summary: Visualizes career development by age group, using a categorical analysis to cross-tabulate responses with Age Group as the X-axis and suppressing detailed diagnostic plots.
Code:
// Career by Age Group
// Open data table
dt = Open("data_table.jmp");
// Career by Age Group
Categorical(
X( :Age Group ),
Responses(
:I am working on my career
),
Crosstab Transposed( 1 ),
Legend( 0 ),
Test Response Homogeneity( 1 )
);
Code Explanation:
- Open table.
- Set categorical analysis.
- Specify age group as X.
- Add response variable.
- Enable crosstab transposition.
- Disable legend display.
- Enable test for homogeneity.
Example 3
Summary: Opens a data table, performs categorical analysis to visualize the proportion of school children who think their home needs major improvements, and tests response homogeneity.
Code:
// Home Needs Improve by School Children
// Open data table
dt = Open("data_table.jmp");
// Home Needs Improve by School Children
Categorical(
X( :School Age Children ),
Responses(
:
My home needs some major improvements
),
Crosstab Transposed( 1 ),
Legend( 0 ),
Test Response Homogeneity( 1 )
);
Code Explanation:
- Open table.
- Set categorical analysis.
- Specify X variable.
- Define response.
- Transpose crosstab.
- Hide legend.
- Test response homogeneity.
Example 4
Summary: Generates a categorical analysis to visualize the interests of school children outside of work, using a crosstab transposed layout and suppressing detailed diagnostic plots.
Code:
// Vast Interests by School Children
// Open data table
dt = Open("data_table.jmp");
// Vast Interests by School Children
Categorical(
X( :School Age Children ),
Responses(
:
I have vast interests outside of work
),
Crosstab Transposed( 1 ),
Legend( 0 ),
Test Response Homogeneity( 1 )
);
Code Explanation:
- Open data table.
- Create categorical analysis.
- Set X variable.
- Define response.
- Enable crosstab transposition.
- Disable legend.
- Test response homogeneity.
Example 5
Summary: Brushing Indicator Group by Age: Visualizes the distribution of brushing habits among different age groups, using a categorical analysis with indicator grouping and frequency charts.
Code:
// Brushing Indicator Group by Age
// Open data table
dt = Open("data_table.jmp");
// Brushing Indicator Group by Age
Categorical(
X( :Age Group ),
Indicator Group(
:Brush After Waking Up,
:Brush After Meal,
:Brush Before Sleep,
:Brush Another Time
),
Share Of Responses( 0 ),
Share Chart( 0 ),
Frequency Chart( 1 ),
Crosstab( 1 ),
Legend( 0 ),
Test Each Response( 1 )
);
Code Explanation:
- Open table.
- Define categorical variable.
- Set indicator group.
- Exclude share of responses.
- Disable share chart.
- Enable frequency chart.
- Enable crosstab.
- Disable legend.
- Enable test each response.
Example 6
Summary: Visualizes the flossing indicator by age group, using a categorical analysis to display frequency charts and crosstabs for each response.
Code:
// Flossing Indicator by Age
// Open data table
dt = Open("data_table.jmp");
// Flossing Indicator by Age
Categorical(
X( :Age Group ),
Indicator Group(
:Floss After Waking Up,
:Floss After Meal,
:Floss Before Sleep,
:Floss Another Time
),
Share Of Responses( 0 ),
Share Chart( 0 ),
Frequency Chart( 1 ),
Crosstab Transposed( 1 ),
Legend( 0 ),
Test Each Response( 1 )
);
Code Explanation:
- Open data table.
- Set categorical analysis.
- Specify age group as X.
- Define indicator groups for flossing.
- Disable share of responses chart.
- Disable share chart.
- Enable frequency chart.
- Enable crosstab transposed.
- Disable legend.
- Enable test each response.
Example 7
Summary: Brushes data to visualize the relationship between Age Group and Brush Delimited, using a categorical analysis with multiple delimited brushing, frequency chart, crosstab transposed, and test each response.
Code:
// Brushing Delimited by Age
// Open data table
dt = Open("data_table.jmp");
// Brushing Delimited by Age
Categorical(
X( :Age Group ),
Multiple Delimited(
:Brush Delimited
),
Share Chart( 0 ),
Frequency Chart( 1 ),
Crosstab Transposed( 1 ),
Legend( 0 ),
Test Each Response( 1 )
);
Code Explanation:
- Open data table.
- Set categorical variable.
- Specify multiple delimited brushing.
- Disable shared chart.
- Enable frequency chart.
- Enable crosstab transposed.
- Disable legend.
- Enable test each response.
Example 8
Summary: Visualizes the distribution of flossing habits among individuals grouped by age, using a categorical analysis with multiple delimited responses and suppresses detailed diagnostic plots.
Code:
// Flossing Delimited by Age
// Open data table
dt = Open("data_table.jmp");
// Flossing Delimited by Age
Categorical(
X( :Age Group ),
Multiple Delimited(
:Floss Delimited
),
Share Of Responses( 0 ),
Share Chart( 0 ),
Frequency Chart( 1 ),
Crosstab Transposed( 1 ),
Legend( 0 ),
Test Each Response( 1 )
);
Code Explanation:
- Open data table.
- Set categorical analysis.
- Specify age group as X variable.
- Use multiple delimited for flossing.
- Disable share of responses.
- Disable share chart.
- Enable frequency chart.
- Enable crosstab transposed.
- Disable legend.
- Enable test each response.
Example 9
Summary: Visualizes free text reasons not to floss by scoring and saving a word table, then performing a crosstab analysis with transposed results.
Code:
// Free Text Floss Reasons
// Open data table
dt = Open("data_table.jmp");
// Free Text Floss Reasons
Categorical(
Free Text(
:Reasons Not to Floss,
<<Score Words by Column( :Floss ),
<<Save Word Table
),
Crosstab Transposed( 1 ),
Legend( 0 )
);
Code Explanation:
- Open table.
- Assign to dt variable.
- Categorical analysis.
- Free Text analysis.
- Specify column for scoring.
- Save word table.
- Perform crosstab.
- Transpose crosstab.
- Disable legend.
Example 10
Summary: Opens a data table, performs categorical analysis by Age, and includes various responses such as Handedness, Analysis, BBQ, Pie, Discoveries, OS, Usage, Boy Band, DGA, and Type, with the legend display disabled.
Code:
// Categorical by Age
// Open data table
dt = Open("data_table.jmp");
// Categorical by Age
Categorical(
X( :Age ),
Responses( :Handedness ),
Responses( :Analysis ),
Responses( :BBQ ),
Responses( :Pie ),
Responses( :Discoveries ),
Responses( :OS ),
Responses( :Usage ),
Responses( :Boy Band ),
Responses( :DGA ),
Responses( :Type ),
Legend( 0 )
);
Code Explanation:
- Open data table.
- Set categorical analysis.
- Use Age as X variable.
- Include Handedness as response.
- Include Analysis as response.
- Include BBQ as response.
- Include Pie as response.
- Include Discoveries as response.
- Include OS as response.
- Include Usage as response.
- Include Boy Band as response.
- Include DGA as response.
- Include Type as response.
- Disable legend display.
Example 11
Summary: Opens a data table, defines categorical variables and response frequencies, and analyzes the data to visualize the relationships between contamination, corrosion, doping, metallization, miscellaneous, oxide defect, and silicon defect.
Code:
// Categorical
// Open data table
dt = Open("data_table.jmp");
// Categorical
Categorical(
Sample Size( :SampleSize ),
X( :clean, :date ),
Response Frequencies(
:contamination, :corrosion,
:doping, :metallization,
:miscellaneous, :oxide defect,
:silicon defect
)
);
Code Explanation:
- Open table.
- Set categorical variables.
- Define sample size.
- Specify X variables.
- Define response frequencies.
- Analyze categorical data.
Example 12
Summary: Opens a data table, defines a categorical analysis with multiple response by ID, and specifies the X variable for further exploration.
Code:
// Cat MultID
// Open data table
dt = Open("data_table.jmp");
// Cat MultID
Categorical(
Freq( :N ),
ID( :ID ),
X( :clean ),
Multiple Response by ID( :failure ),
Sample Size( :SampleSize )
);
Code Explanation:
- Open data table.
- Define categorical analysis.
- Set frequency variable.
- Identify ID variable.
- Specify X variable.
- Define multiple response by ID.
- Set sample size variable.
Example 13
Summary: Opens a data table, defines a categorical analysis with multiple response by ID, and specifies sample size. It visualizes the frequency of responses for each ID.
Code:
// Cat MultID2
// Open data table
dt = Open("data_table.jmp");
// Cat MultID2
Categorical(
Freq( :N ),
ID( :ID ),
X( :clean, :date ),
Multiple Response by ID( :failure ),
Sample Size( :SampleSize )
);
Code Explanation:
- Open table.
- Define categorical analysis.
- Specify frequency column.
- Identify ID column.
- Define X variables.
- Set multiple response by ID.
- Specify sample size column.
Example 14
Summary: Opens a data table, sets categorical variables, defines multiple responses, and generates a frequency chart to visualize the distribution of Failure1, Failure2, and Failure3.
Code:
// Categorical
// Open data table
dt = Open("data_table.jmp");
// Categorical
Categorical(
X( :clean, :date ),
Multiple Response(
:Failure1, :Failure2, :Failure3
),
Frequency Chart( 0 )
);
Code Explanation:
- Open data table.
- Set variables as categorical.
- Define multiple responses.
- Generate frequency chart.
Example 15
Summary: Opens a data table, defines categorical variables, and fits a standard linear regression model to predict Annual Salary Z incorporating Gender, Length Of Service, and Performance as effects, while suppressing detailed diagnostic plots.
Code:
// Categorical Delimited
// Open data table
dt = Open("data_table.jmp");
// Categorical Delimited
Categorical(
ID( :ID ),
X( :clean, :date ),
Multiple Delimited( :failureS )
);
Code Explanation:
- Open data table.
- Define categorical variables.
- Set ID as categorical.
- Set clean and date as continuous.
- Set failureS as multiple delimited.
Example 16
Summary: Opens a data table, sets categorical variables for contamination, corrosion, doping, metallization, miscellaneous, and oxide defect, and then creates a Categorical plot to visualize the relationships between these factors.
Code:
// Categorical
// Open data table
dt = Open("data_table.jmp");
// Categorical
Categorical(
X( :clean, :date ),
Indicator Group(
:contamination, :corrosion,
:doping, :metallization,
:miscellaneous, :oxide defect,
:silicon defect
)
);
Code Explanation:
- Open data table.
- Set categorical variables.
Example 17
Summary: Opens a data table, defines categorical variables, specifies the response variable, sets the crosstab format, and suppresses legend display to visualize the relationship between gender, length of service, and performance on annual salary.
Code:
// Categorical
// Open data table
dt = Open("data_table.jmp");
// Categorical
Categorical(
X( :Sex, :Passenger Class ),
Separate Responses( :Survived ),
Crosstab Format( 1 ),
Legend( 0 )
);
Code Explanation:
- Open data table.
- Define categorical variables.
- Specify response variable.
- Set crosstab format.
- Disable legend display.
Example 18
Summary: Uses the Categorical platform to analyze free text data, scoring words by a specified column and saving the word table. It then creates a crosstab transposed with legend display suppressed.
Code:
// Free Text Floss Reasons
Categorical(
Free Text(
:Reasons Not to Floss,
<<Score Words by Column( :Floss ),
<<Save Word Table
),
Crosstab Transposed( 1 ),
Legend( 0 )
);
Code Explanation:
- Analyze categorical data.
- Use free text analysis.
- Specify column for reasons.
- Score words by another column.
- Save word table.
- Create crosstab transposed.
- Disable legend display.
Example 19
Summary: Analyze employee data by fitting a categorical model to predict Annual Salary Z, incorporating Gender, Length Of Service, and Performance as effects, and suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
ID( :Response ID ),
X( :Gender ),
Unique Occurrences within ID( 1 ),
Multiple Delimited( :Brush Delimited ),
Legend( 0 ),
Conditional Association( 1 ),
);
obj << Local Data Filter(
Mode,
Add Filter(
columns( :Brush Delimited ),
Match Any( Where( :Brush Delimited == "After Meal" ) ),
Display( :Brush Delimited, Size( 117, 66 ), Check Box Display )
)
);
Distribution(
Automatic Recalc( 1 ),
Nominal Distribution( Column( :Age Group ) ),
Nominal Distribution( Column( :Employee Tenure ) ),
Nominal Distribution( Column( :Position Tenure ) ),
Local Data Filter(
Add Filter(
columns( :Floss Delimited ),
Match Any( Where( :Floss Delimited == "After Meal" ) ),
Display( :Floss Delimited, Check Box Display )
)
)
);
Code Explanation:
- Open data table.
- Apply categorical analysis.
- Set response ID.
- Include gender variable.
- Ensure unique occurrences.
- Use brush delimited column.
- Disable legend.
- Enable conditional association.
- Add local data filter.
- Filter for "After Meal".
- Create distribution analysis.
- Recalculate automatically.
- Analyze age group.
- Analyze employee tenure.
- Analyze position tenure.
- Add local data filter for Floss Delimited.
- Filter for "After Meal".
- Display with check box.
Example 20
Summary: Creates a categorical object from structured data, highlighting cells with high share and mean score, and customizing color for specific conditions.
Code:
Open("data_table.jmp");
obj = dt = Categorical( Structured( :Position Tenure + :Age Group, :I am working on my career + :Brush ), Mean Score( 1 ) );
obj << Highlight Cells( Share >= 0.8 );
obj << Highlight Cells( Mean Score >= 2.7, Color( "Blue" ) );
Code Explanation:
- Open data table.
- Create categorical object.
- Structure categorical variables.
- Calculate mean score.
- Highlight cells with share >= 0.8.
- Highlight cells with mean score >= 2.7.
- Set highlight color to blue.
Example 21
Summary: Creates a categorical analysis object to highlight cells with share >= 0.8 and mean score >= 2.7 in blue, utilizing the Categorical platform in JMP.
Code:
dt = Open("data_table.jmp");
obj = dt = Categorical( Structured( :Position Tenure + :Age Group, :I am working on my career + :Brush ), Mean Score( 1 ) );
obj << Highlight Cells( Share >= 0.8 );
obj << Highlight Cells( Mean Score >= 2.7, Color( "Blue" ) );
obj << Journal;
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Highlight cells with share >= 0.8.
- Highlight mean score >= 2.7 in blue.
- Output results to journal.
Example 22
Summary: Creates a categorical table to analyze passenger survival rates based on gender and passenger class, using crosstab format and suppressing legend display.
Code:
dt under test = Open("data_table.jmp");
obj = Categorical( X( :Sex, :Passenger Class ), Separate Responses( :Survived ), Crosstab Format( 1 ), Legend( 0 ) );
Code Explanation:
- Open data table;
- Create Categorical object.
- Set X variables: Sex, Passenger Class.
- Set response variable: Survived.
- Use Crosstab format.
- Disable legend display.
Example 23
Summary: Creates a categorical analysis object to visualize the relationship between passenger class and survival, suppressing detailed diagnostic plots.
Code:
dt under test = Open("data_table.jmp");
obj = Categorical(
X( :Sex, :Passenger Class ),
Responses( :Survived ),
Frequencies( 0 ),
Share Of Responses( 0 ),
Share Chart( 0 ),
Frequency Chart( 1 ),
Crosstab Transposed( 1 ),
Legend( 0 ),
Test Response Homogeneity( 1 ),
Total Responses( 0 ),
Mean Score( 1 ),
Force Crosstab Shading( 0 ),
SendToReport(
Dispatch( {}, "Categorical", OutlineBox,
{Set Title( "Frequency Chart, Crosstab Transposed, Test Response Homogeneity, Mean Score" )}
)
)
);
Code Explanation:
- Open data table;
- Create Categorical analysis object.
- Set X variables: Sex, Passenger Class.
- Set response variable: Survived.
- Disable frequencies display.
- Disable share of responses display.
- Disable share chart display.
- Enable frequency chart display.
- Enable crosstab transposed display.
- Disable legend display.
- Enable test response homogeneity.
- Disable total responses display.
- Enable mean score display.
- Disable force crosstab shading.
- Set report title.
Example 24
Summary: Creates a categorical analysis to visualize responses from employees, incorporating age group and school age children as X variables, with additional filters for Floss Delimited column.
Code:
dt2 = Open("data_table.jmp");
cat = dt2 << Categorical(
X( :Age Group, :School Age Children ),
Grouping Option( "Each Individually" ),
Responses( :I am working on my career ),
Responses( :My home needs some major improvements ),
Responses( :I have vast interests outside of work ),
Responses( :I come from a large family ),
Crosstab Transposed( 1 ),
Legend( 0 ),
Test Response Homogeneity( 1 )
);
ldf = cat << Local Data Filter(
Location( {607, 87} ),
Mode,
Add Filter(
columns( :Floss Delimited ),
Match Between( 1, 2, Where( :Floss Delimited == {"After Meal", "Before Sleep", "Other"} ) ),
Display( :Floss Delimited, Size( 121, 87 ), Check Box Display )
)
);
txt = ldf << Get Script;
whereClause = Char( Arg( Arg( txt, 2 ), 2 ) );
Code Explanation:
- Open data table;
- Create categorical analysis.
- Set age group and school age children as X variables.
- Group individually.
- Add responses for career, home improvements, interests, and family size.
- Transpose crosstab.
- Hide legend.
- Test response homogeneity.
- Add local data filter.
- Set filter location and mode.
- Add filter for Floss Delimited column.
- Match values after meal, before sleep, other.
- Display checkboxes for filter.
- Get script for local data filter.
- Extract where clause from script.
Example 25
Summary: Creates a categorical analysis with local data filtering, incorporating specific response variables and filter settings.
Code:
dt = Open("data_table.jmp");
cat = dt << Categorical(
X( :Age Group, :School Age Children ),
Grouping Option( Each Individually ),
Responses( :I am working on my career ),
Responses( :My home needs some major improvements ),
Responses( :I have vast interests outside of work ),
Responses( :I come from a large family ),
Crosstab Transposed( 1 ),
Legend( 0 ),
Test Response Homogeneity( 1 )
);
ldf = cat << Local Data Filter(
Location( {351, 167} ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) ),
Inverse,
Add Filter(
columns( :Brush Delimited ),
Match Any( Where( :Brush Delimited == {"After Meal", "Before Sleep"} ) ),
Display( :Brush Delimited, Size( 121, 70 ), Check Box Display )
),
Add Filter(
columns( :Brush Delimited ),
Match Any( Where( :Brush Delimited == "Other" ) ),
Display( :Brush Delimited, Size( 121, 70 ), Check Box Display )
),
Add Filter(
columns( :Floss Delimited ),
Match Any( Where( :Floss Delimited == {"Other", "Wake"} ) ),
Display( :Floss Delimited, Size( 121, 87 ), Check Box Display )
),
Add Filter(
columns( :Frequency of Teeth Cleaning ),
Where( :Frequency of Teeth Cleaning == 2 ),
Display( :Frequency of Teeth Cleaning, Size( 208, 72 ), List Display )
)
);
ldf << Add Favorites( "Foo" );
ldf << Delete All;
ldf << Apply Favorites( "Foo" );
Code Explanation:
- Open data table;
- Create categorical analysis.
- Set X variables: Age Group, School Age Children.
- Group each individually.
- Set response variables.
- Transpose crosstab.
- Hide legend.
- Test response homogeneity.
- Add local data filter.
- Configure filter settings.
Example 26
Summary: Creates a categorical analysis report, incorporating local data filters and filtering by gender, age group, and single status to predict annual salary Z.
Code:
dt = Open("data_table.jmp");
categ = dt << Categorical(
X( :Age Group ),
Indicator Group( :Brush After Waking Up, :Brush After Meal, :Brush Before Sleep, :Brush Another Time ),
Share Of Responses( 0 ),
Share Chart( 0 ),
Frequency Chart( 1 ),
Legend( 0 ),
Count Test( 1 ),
);
preMatrix = (Report( categ )["Test Each Response"][Table Box( 1 )] << Get as Matrix)[0, 1 :: 2];
ldf1 = categ << Local Data Filter(
Location( {379, 328} ),
Grouped by AND( 1 ),
Add Filter(
columns( :Gender, :Age Group ),
Where( :Gender == 2 ),
Where( :Age Group == 3 ),
Display( :Age Group, Size( 220, 115 ), List Display )
),
Add Filter( columns( :Age in Years ), Where( :Age in Years >= 29.8 & :Age in Years <= 62.5 ) ),
Add Filter( columns( :Single Status, :School Age Children ), Where( :Single Status == 2 ), Where( :School Age Children == 1 ) ),
Add Filter( columns( :Age in Years ), Where( :Age in Years >= 38.3 & :Age in Years <= 58.6 ) ),
Favorites(
"((Gender = F) or (Age Group = 35-39)) and (Age in Years >= 29.8 & Age in Years <= 62.5) and ((Single Status = Not Single) or (School Age Children = Yes)) and (Age in Years >= 38.3 & Age in Years <= 58.6)"
(Match( columns( :Gender, :Age Group ), Where( :Gender == 2 ), Where( :Age Group == 3 ) ), Match( columns( :Age in Years ),
Where( :Age in Years >= 29.8 & :Age in Years <= 62.5 )
), Match( columns( :Single Status, :School Age Children ), Where( :Single Status == 2 ), Where( :School Age Children == 1 ) ),
Match( columns( :Age in Years ), Where( :Age in Years >= 38.3 & :Age in Years <= 58.6 ) ))
)
);
afterMatrix = (Report( categ )["Test Each Response"][Table Box( 1 )] << Get as Matrix)[0, 1 :: 2];
Code Explanation:
- Open data table;
- Create categorical analysis.
- Extract pre-filter matrix.
- Add local data filter.
- Set filter location.
- Group filters using AND.
- Add gender filter.
- Add age group filter.
- Add age range filter.
- Add single status and school age children filter.
Example 27
Summary: Creates a categorical analysis report, incorporating local data filters and test response homogeneity to analyze employee demographics and habits.
Code:
dt = Open("data_table.jmp");
cateq = dt << Categorical(
X( :Age Group ),
Indicator Group( :Floss After Waking Up, :Floss After Meal, :Floss Before Sleep, :Floss Another Time ),
Share Of Responses( 0 ),
Share Chart( 0 ),
Frequency Chart( 1 ),
Crosstab Transposed( 1 ),
Legend( 0 ),
Test Each Response( 1 )
);
preMatrix = (Report( cateq )["Test Each Response"][Table Box( 1 )] << Get as Matrix)[0, 1 :: 2];
ldf1 = cateq << Local Data Filter(
Grouped by AND( 1 ),
Add Filter(
columns( :Floss Delimited, :Gender ),
Match At Least( 2, Where( :Floss Delimited == {"Before Sleep", "Wake"} ) ),
Where( :Gender == 2 ),
Display( :Floss Delimited, Size( 134, 96 ), Check Box Display )
),
Add Filter(
columns( :Brush Delimited, :Employee Tenure ),
Match All( Where( :Brush Delimited == {"After Meal", "Before Sleep"} ) ),
Where( :Employee Tenure == 2 ),
Display( :Brush Delimited, Size( 134, 77 ), Check Box Display ),
Display( :Employee Tenure, Size( 220, 70 ), List Display )
)
);
afterMatrix = (Report( cateq )["Test Each Response"][Table Box( 1 )] << Get as Matrix)[0, 1 :: 2];
Code Explanation:
- Open data table.
- Create categorical analysis.
- Configure categorical settings.
- Extract initial test matrix.
- Add local data filter.
- Set filter grouped by AND.
- Add first filter criteria.
- Add second filter criteria.
- Extract final test matrix.
Example 28
Summary: Creates a categorical analysis with local data filtering, displaying filtered results in a list display and check box displays.
Code:
dt = Open("data_table.jmp");
categ = dt << Categorical(
X( :Age Group ),
Responses( :I am working on my career ),
Crosstab Transposed( 1 ),
Legend( 0 ),
Test Response Homogeneity( 1 )
);
ldf = categ << Local Data Filter(
Location( {317, 239} ),
Add Filter(
columns( :Age Group, :Brush Delimited, :Floss Delimited ),
Where( :Age Group == 7 ),
Match Any( Where( :Brush Delimited == "Before Sleep" ) ),
Match Any( Where( :Floss Delimited == "Before Sleep" ) ),
Display( :Age Group, Size( 204, 123 ), List Display ),
Display( :Brush Delimited, Size( 121, 70 ), Check Box Display ),
Display( :Floss Delimited, Size( 121, 87 ), Check Box Display )
),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
);
sub1 = ldf << Show Subset;
ldf << Add Favorites( "Mixed filters" );
ldf << Delete All;
ldf << Apply Favorites( "Mixed filters" );
sub2 = ldf << Show Subset;
result = sub1 << Compare Data Tables( compare With( sub2 ) );
Close( dt, no save );
Code Explanation:
- Open data table.
- Create categorical analysis.
- Set up local data filter.
- Configure filter location.
- Add filter for age group.
- Match brush delimited condition.
- Match floss delimited condition.
- Display age group list.
- Display brush delimited checkboxes.
- Display floss delimited checkboxes.
Example 29
Summary: Creates a categorical analysis to filter and subset data based on specific conditions, utilizing Local Data Filter and Show Subset features.
Code:
dt = Open("data_table.jmp");
categ = dt << Categorical(
X( :Age Group ),
Responses( :I am working on my career ),
Crosstab Transposed( 1 ),
Legend( 0 ),
Test Response Homogeneity( 1 )
);
ldf = categ << Local Data Filter(
Location( {317, 239} ),
Add Filter(
columns( :Age Group, :Brush Delimited, :Floss Delimited ),
Where( :Age Group == 7 ),
Match Any( Where( :Brush Delimited == "Before Sleep" ) ),
Match Any( Where( :Floss Delimited == "Before Sleep" ) ),
Display( :Age Group, Size( 204, 123 ), List Display ),
Display( :Brush Delimited, Size( 121, 70 ), Check Box Display ),
Display( :Floss Delimited, Size( 121, 87 ), Check Box Display )
),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
);
sub1 = ldf << Show Subset;
ldf << Add Favorites( "Mixed filters" );
ldf << Delete All;
ldf << Apply Favorites( "Mixed filters" );
sub2 = ldf << Show Subset;
result = sub1 << Compare Data Tables( compare With( sub2 ) );
Code Explanation:
- Open data table.
- Create categorical analysis.
- Set X variable to Age Group.
- Set response variable.
- Configure crosstab settings.
- Disable legend.
- Enable test for response homogeneity.
- Add local data filter.
- Set filter location.
- Define filter conditions.
- Display filter options.
- Set filter mode.
- Show subset with current filters.
- Save filter as "Mixed filters".
- Clear all filters.
- Apply saved "Mixed filters".
- Show subset with new filters.
- Compare data tables from subsets.
Example 30
Summary: Data filtering and report generation from a categorical object, incorporating local data filters and automatic recalculation suppression.
Code:
dt = Open("data_table.jmp");
obj = Categorical(
Sample Size( :SampleSize ),
X( :clean, :date ),
Response Frequencies( :contamination, :corrosion, :doping, :metallization, :miscellaneous, :oxide defect, :silicon defect )
);
obj << Local Data Filter(
Location( {0, 0} ),
Add Filter( columns( :clean ), Where( :clean == "after" ) ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
);
obj << Automatic Recalc( 0 );
dt << Select rows( [1, 4] );
dt << Exclude();
dt << Clear Select();
rpt = Report( obj );
rpt[Outline Box( 2 )][GridMultiCellBox( 2 )] << copydata;
s = Get Clipboard();
Code Explanation:
- Open data table.
- Create categorical object.
- Set local data filter.
- Disable automatic recalculation.
- Select specific rows.
- Exclude selected rows.
- Clear row selection.
- Generate report from object.
- Copy grid data to clipboard.
- Retrieve clipboard content.
Example 31
Summary: Data filtering and report generation from a categorical object, incorporating local data filters and row selection to extract specific data subsets.
Code:
dt = Open("data_table.jmp");
obj = Categorical(
Sample Size( :SampleSize ),
X( :clean, :date ),
Response Frequencies( :contamination, :corrosion, :doping, :metallization, :miscellaneous, :oxide defect, :silicon defect )
);
obj << Local Data Filter(
Location( {0, 0} ),
Add Filter( columns( :clean ), Where( :clean == "after" ) ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
);
dt << Select rows( [1, 4] );
dt << Exclude();
dt << Clear Select();
rpt = Report( obj );
rpt[Outline Box( 2 )][GridCellBox( 5 )] << copydata;
s = Get Clipboard();
Close( dt, NoSave );
dt = Open("data_table.jmp");
obj = Categorical(
Sample Size( :SampleSize ),
X( :clean, :date ),
Response Frequencies( :contamination, :corrosion, :doping, :metallization, :miscellaneous, :oxide defect, :silicon defect )
);
obj << Local Data Filter(
Location( {0, 0} ),
Add Filter( columns( :clean ), Where( :clean == "after" ) ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
);
obj << Automatic Recalc( 0 );
dt << Select rows( [1, 4] );
dt << Exclude();
dt << Clear Select();
rpt = Report( obj );
rpt[Outline Box( 2 )][GridMultiCellBox( 2 )] << copydata;
s = Get Clipboard();
Code Explanation:
- Open table.
- Create categorical object.
- Add local data filter.
- Select specific rows.
- Exclude selected rows.
- Clear row selection.
- Generate report.
- Copy data from report.
- Close table without saving.
- Repeat steps 1-9.
Example 32
Summary: Runs a categorical analysis to visualize the relationship between employee tenure, job satisfaction, and interests outside of work, with comparison groups 'D/E' and cell-by-cell comparisons.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured(
:I have vast interests outside of work * (:Employee Tenure + :Job Satisfaction), :Brush + :Floss,
<<Specify Comparison Groups( "D/E" )
),
Compare Each Cell( 1 ),
Share Chart( 0 ),
Legend( 0 )
);
Code Explanation:
- Open table "data_table".
- Create categorical analysis object.
- Define structured analysis.
- Include interaction terms.
- Specify comparison groups "D/E".
- Compare each cell.
- Do not share chart.
- Do not show legend.
Example 33
Summary: Runs the creation and deletion of rows in a JMP data table, as well as the closing of a categorical analysis window.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( X( :sex, :marital status ), Aligned Responses( :country, :size ), Grouping Option( Each Individually ) );
dt << Select Rows( 1 :: N Row( dt ) );
dt << Delete Rows();
obj = Window( "data_table - Categorical" );
obj << close window;
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Select all rows in table.
- Delete all selected rows.
- Find window "data_table - Categorical".
- Close found window.
Example 34
Summary: Runs the creation and deletion of a categorical analysis object in JMP, utilizing the Categorical platform to analyze data.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Repeated Measures( :First Survey, :Second Survey ), Freq( :Count ) );
dt << Select Rows( 1 :: N Row( dt ) );
dt << Delete Rows();
obj = Window( "data_table - Categorical" );
obj << close window;
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Select all rows in table.
- Delete selected rows.
- Close categorical analysis window.
Example 35
Summary: Runs the creation and deletion of a categorical analysis object in JMP, utilizing the Categorical platform to analyze data.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Rater Agreement( :First Survey, :Second Survey ), Freq( :Count ) );
dt << Select Rows( 1 :: N Row( dt ) );
dt << Delete Rows();
obj = Window( "data_table - Categorical" );
obj << close window;
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Select all rows in data table.
- Delete selected rows.
- Close categorical analysis window.
Example 36
Summary: Creates a categorical analysis by selecting all rows, deleting them, and closing the analysis window.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( X( :Single Status ), Responses( :Age Group ), Legend( 0 ) );
dt << Select Rows( 1 :: N Row( dt ) );
dt << Delete Rows();
obj = Window( "data_table - Categorical by Single Status" );
obj << close window;
Code Explanation:
- Open data table.
- Create categorical analysis.
- Select all rows.
- Delete selected rows.
- Find analysis window.
- Close analysis window.
Example 37
Summary: Runs the creation and deletion of rows in a JMP data table, as well as the opening and closing of an analysis window.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( X( :clean, :date ), Multiple Response( :Failure1, :Failure2, :Failure3 ), Frequency Chart( 0 ) );
dt << Select Rows( 1 :: N Row( dt ) );
dt << Delete Rows();
obj = Window( "Failure3MultipleField - Categorical" );
obj << close window;
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Select all rows in table.
- Delete all rows from table.
- Locate analysis window.
- Close analysis window.
Example 38
Summary: Runs the opening and categorization of a data table, selecting all rows, deleting them, and closing the analysis window.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Structured( :Gender * :Age Group + :Position Tenure, :Job Satisfaction + :Salary Group ) );
dt << Select Rows( 1 :: N Row( dt ) );
dt << Delete Rows();
obj = Window( "data_table - Categorical" );
obj << close window;
Code Explanation:
- Open data table.
- Perform categorical analysis.
- Select all rows.
- Delete all rows.
- Locate analysis window.
- Close analysis window.
Example 39
Summary: Creates and configures a categorical analysis object, selecting all rows, deleting them, and closing the analysis window.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured(
Empty(),
Empty(),
Aligned Responses(
:I am working on my career, :I want to see the world, :My home needs some major improvements,
:I have vast interests outside of work, :I want to get my debt under control, :I come from a large family
)
),
Legend( 0 ),
Share Chart( 1 )
);
dt << Select Rows( 1 :: N Row( dt ) );
dt << Delete Rows();
obj = Window( "data_table - Categorical" );
obj << close window;
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Configure structured analysis.
- Set legend visibility.
- Enable shared chart.
- Select all rows.
- Delete selected rows.
- Locate analysis window.
- Close analysis window.
Example 40
Summary: Creates a categorical analysis object to visualize relationships between gender, marital status, country, and size, with interactive filtering by age.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( X( :sex, :marital status ), Aligned Responses( :country, :size ), Grouping Option( Each Individually ) );
obj << Local Data Filter( Add Filter( columns( :age ), Where( :age == 18.5 ) ) );
obj << close window;
Code Explanation:
- Open data table;
- Create Categorical analysis object.
- Set X variables: sex, marital status.
- Set aligned responses: country, size.
- Grouping option: each individually.
- Add local data filter.
- Filter column age.
- Where age equals 18.5.
- Close analysis window.
Example 41
Summary: Creates a categorical analysis report to visualize and analyze employee data, incorporating indicator groups for country and size, X variables for sex and marital status, and individual grouping options.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Indicator Group( :country, :size ), X( :sex, :marital status ), Grouping Option( Each Individually ) );
rpt = obj << report;
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Set indicator group variables.
- Define X variables for analysis.
- Set grouping option individually.
- Generate report from analysis.
Example 42
Summary: Creates a categorical analysis object to structure age variable, align height and weight responses, enable crosstab transposition, disable legend display, and share chart across windows.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured( :age, Aligned Responses( :height, :weight ) ),
Crosstab Transposed( 1 ),
Legend( 0 ),
Share Chart( 1 )
);
obj << close window;
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Structure age variable.
- Align height and weight responses.
- Enable crosstab transposition.
- Disable legend display.
- Share chart across windows.
- Close analysis window.
Example 43
Summary: Creates a categorical analysis object to visualize Age Group and Gender, then saves the output to an Excel file on the desktop.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( X( :Age Group ), Responses( :Gender ), Legend( 0 ) );
Log Capture( obj << Save Excel File( "$DESKTOP\consumerpreferences.xlsx", Separate Rows for each cell
statistic( 1 ) ) );
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Set X variable to Age Group.
- Set Responses variable to Gender.
- Disable legend display.
- Capture log output.
- Save analysis to Excel file.
- Specify file path on desktop.
- Use separate rows for each cell.
- Include only first statistic.
Example 44
Summary: Creates and saves a structured analysis object to an Excel file, incorporating categorical variables for sex, marital status, and size.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Categorical( Structured( :sex * :marital status, :size ), Structured( :size, :sex * :marital status ) );
Log Capture( obj1 << Save Excel File( "$DESKTOP\testSaveStructuredMultiple.xlsx", Separate Rows for each
cell statistic( 1 ) ) );
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Define structured analysis for sex, marital status, and size.
- Define another structured analysis for size, sex, and marital status.
- Capture log output.
- Save structured analysis to Excel file.
- Use separate rows for cell statistics.
- Specify cell statistic option.
- Save file to desktop.
- Name file "testSaveStructuredMultiple.xlsx".
Example 45
Summary: Creates a categorical analysis object to explore the relationship between gender and age, suppressing detailed diagnostic plots and saving the results to an Excel file.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
X( :sex ),
Responses( :age ),
Frequencies( 0 ),
Share Of Responses( 0 ),
Cell Chisq( 1 ),
Share Chart( 0 ),
Legend( 0 )
);
Log Capture( obj << Save Excel File( "$DESKTOP\chisq.xlsx", Separate Rows for each cell statistic( 1 ) ) );
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Set X variable to "sex".
- Set response variable to "age".
- Disable frequencies display.
- Disable share of responses display.
- Enable cell chi-square calculation.
- Disable share chart display.
- Disable legend display.
- Save analysis to Excel file.
Example 46
Summary: Creates a categorical analysis object with structured layout, aligned responses, and crosstab transposed view to analyze age-related data, and saves the results to an Excel file.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured( Empty(), :age, Aligned Responses( :height, :weight ) ),
Crosstab Transposed( 1 ),
Legend( 0 ),
Share Chart( 1 )
);
Log Capture( obj << Save Excel File( "$DESKTOP\aligned.xlsx", Separate Rows for each cell statistic( 1 ) ) );
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Use structured layout.
- Include age variable.
- Align height and weight responses.
- Use crosstab transposed view.
- Disable legend display.
- Share chart across cells.
- Log capture of save operation.
- Save results to aligned.xlsx.
Example 47
Summary: Creates a structured categorical analysis object from a data table, incorporating age and marital status variables, and saves it to an Excel file with separate rows for each cell statistic.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Structured( age * :marital status, :size ) );
obj << Save Excel File( "$DESKTOP\testSaveStructured_AgeTimesMS_Cols.xlsx", Separate Rows for each cell statistic( 1 ) );
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Structure analysis by age and marital status.
- Include size variable in analysis.
- Save structured data to Excel.
- Place file on desktop.
- Use separate rows for each cell.
- Include cell statistics in Excel.
- Specify cell statistic as 1.
- Complete script execution.
Example 48
Summary: Creates a categorical analysis object to visualize and analyze the distribution of responses based on gender, suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Responses( :sex ),
Share Chart( 1 ),
Legend( 0 ),
Mean Score( 1 ),
Mean Std Error( 1 ),
Mean Confidence Interval( 1 ),
Std Dev Score( 1 )
);
rpt = Report( obj );
allScores = J( 18, 1, 1 ) |/ J( 22, 1, 2 );
mean value = Mean( allScores );
std dev val = Std Dev( allScores );
mean se val = std dev val / Sqrt( 40 );
lower limit = mean value - t Quantile( 0.975, N Row( allScores ) - 1 ) * mean se val;
upper limit = mean value + t Quantile( 0.975, N Row( allScores ) - 1 ) * mean se val;
lcap = Log Capture( dt2 = obj << savettestsandpvalues );
check = Contains( lcap, "No t-Tests or p-Values to save." );
dtMeanScores = obj << Save Mean Scores;
obj << close window;
Close( dtMeanScores, nosave );
Close( dt, no save );
ut relative epsilon = 1e-2;
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Set responses to "sex".
- Enable share chart.
- Disable legend.
- Enable mean score.
- Enable mean standard error.
- Enable mean confidence interval.
- Enable standard deviation score.
- Generate report from object.
Example 49
Summary: Calculates and visualizes mean scores, standard deviation, and confidence intervals for categorical responses in a data table, while suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Responses( :sex ),
Share Chart( 1 ),
Legend( 0 ),
Mean Score( 1 ),
Mean Std Error( 1 ),
Mean Confidence Interval( 1 ),
Std Dev Score( 1 )
);
rpt = Report( obj );
allScores = J( 18, 1, 1 ) |/ J( 22, 1, 2 );
mean value = Mean( allScores );
std dev val = Std Dev( allScores );
mean se val = std dev val / Sqrt( 40 );
lower limit = mean value - t Quantile( 0.975, N Row( allScores ) - 1 ) * mean se val;
upper limit = mean value + t Quantile( 0.975, N Row( allScores ) - 1 ) * mean se val;
lcap = Log Capture( dt2 = obj << savettestsandpvalues );
check = Contains( lcap, "No t-Tests or p-Values to save." );
dtMeanScores = obj << Save Mean Scores;
obj << close window;
Code Explanation:
- Open data table.
- Perform categorical analysis.
- Generate share chart.
- Calculate mean score.
- Calculate mean standard error.
- Calculate mean confidence interval.
- Calculate standard deviation score.
- Create report object.
- Define all scores array.
- Calculate mean value.
- Calculate standard deviation.
- Calculate mean standard error value.
- Calculate lower confidence limit.
- Calculate upper confidence limit.
- Save t-tests and p-values.
- Check for t-test results.
- Save mean scores.
- Close analysis window.
Example 50
Summary: Creates a categorical analysis object for reporting, disabling chart sharing and legend display, and setting rate per case responding.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Structured( Empty(), :Brush Delimited ), Share Chart( 0 ), Legend( 0 ), Rate per case responding( 1 ) );
rpt = obj << report;
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Disable chart sharing.
- Disable legend display.
- Set rate per case responding.
- Generate report object.
Example 51
Summary: Creates two categorical analysis objects to compare and test response homogeneity in a data table, generating reports with associated matrices.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Categorical(
Structured( :Brush Delimited, :Brush ),
Compare Each Cell( 1 ),
Cell Chisq( 1 ),
Test Response Homogeneity( 1 ),
Compare Each Sample( 1 )
);
rpt1 = obj1 << report;
actMat = rpt1[Outline Box( 3 )][Table Box( 1 )] << getasmatrix;
obj2 = dt << Categorical(
Structured( :Brush Delimited, :Brush, <<Specify Comparison Groups( "A/B/c/d" ) ),
Test Response Homogeneity( 1 ),
);
rpt2 = obj2 << report;
expMat = rpt2[Outline Box( 3 )][Table Box( 1 )] << getasmatrix;
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Configure structured comparison.
- Enable cell chi-square test.
- Test response homogeneity.
- Compare each sample.
- Generate report from analysis.
- Extract matrix from report.
- Create second categorical analysis object.
- Specify comparison groups.
- Test response homogeneity.
- Generate second report.
- Extract matrix from second report.
Example 52
Summary: Creates a frequency table to analyze failure modes by clean and date, utilizing Categorical analysis and nested loops.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( ID( :ID ), X( :clean, :date ), Multiple Delimited( :failureS ) );
rpt = Report( obj );
cleanKeys = Associative Array( dt[0, "clean"] ) << Get Keys;
dateKeys = Associative Array( dt[0, "date"] ) << Get Keys;
failureKeys = {"", "contamination", "corrosion", "doping", "metallization", "miscellaneous", "oxide defect", "silicon defect"};
freq_table = [];
For( i = 1, i <= Length( cleanKeys ), i++,
For( j = 1, j <= Length( dateKeys ), j++,
freq_row = [];
For( k = 2, k <= Length( failureKeys ), k++,
freq_row = freq_row || N Row(
dt << Select Where( :clean == cleanKeys[i] & :date == dateKeys[j] & Contains( :"failureS"n, failureKeys[k] ) ) <<
Get Selected Rows
)
);
freq_table = freq_table |/ freq_row;
)
);
dt_freq = obj << Save Frequencies;
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Generate report from object.
- Extract unique clean keys.
- Extract unique date keys.
- Define failure keys array.
- Initialize frequency table.
- Loop through clean keys.
- Loop through date keys.
- Initialize frequency row.
- Loop through failure keys.
- Count rows for each condition.
- Append count to frequency row.
- Append frequency row to table.
- Save frequencies to new table.
Example 53
Summary: Creates a categorical object from a structured data table, calculating mean and standard deviation scores for Age Group, and generates a report.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Structured( Empty(), :Age Group ), Mean Score( 1 ), Std Dev Score( 1 ) );
rpt = obj << report;
Code Explanation:
- Open data table.
- Create categorical object.
- Structure by Age Group.
- Calculate mean score.
- Calculate standard deviation score.
- Generate report object.
Example 54
Summary: Fits a standard linear regression model to predict Annual Salary Z, incorporating Gender, Length Of Service, and Performance as effects, and suppresses detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Categorical(
X( :sex, :marital status ),
Multiple Response( :country, :size ),
Table Format( 0 ),
Crosstab Format( 1 ),
Legend( 0 ),
Test Each Response( 1 ),
Order by Significance( 1 )
);
rpt1 = obj1 << report;
order valuelists = [0.26100816059817, 0.364885791886085, 0.486159330404024, 0.559548341908125, 0.592553284037938, 0.995444207835343];
valuelists = rpt1[Outline Box( 3 )][Number Col Box( 2 )] << get as matrix;
obj3 = dt << Categorical( X( :sex, :marital status ), Responses( :country ) );
obj3 << ChiSquare Test Choices( LR Only );
rpt3 = Report( obj3 );
val1 = rpt3[Outline Box( "Test Response Homogeneity" )][Number Col Box( 1 )] << get as matrix;
val2 = rpt3[Outline Box( "Test Response Homogeneity" )][Number Col Box( 2 )] << get as matrix;
exp1 = [5.68644135646778];
exp2 = [0.459215091587712];
Code Explanation:
- Open data table;
- Run Categorical analysis.
- Set multiple responses.
- Use crosstab format.
- Disable legend.
- Test each response.
- Order by significance.
- Generate report.
- Extract value lists.
- Run ChiSquare test.
Example 55
Summary: Analyze categorical responses to predict annual salary, incorporating gender, length of service, and performance as effects, and suppresses detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = Categorical( Multiple Response( :country, :size ), X( :sex, :marital status ) );
obj << Test Each Response( 1 );
rpt = Report( obj );
val = rpt[Outline Box( 3 )][Number Col Box( 1 )] << get as matrix;
val1 = [4.00422599201568, 1.90407349729486, 2.06244174616131, 3.17869629977412, 2.4403954010094, 0.0673496556842679];
Code Explanation:
- Open data table.
- Create Categorical analysis object.
- Set multiple response variables.
- Set predictor variables.
- Test each response.
- Generate report from analysis.
- Extract outline box from report.
- Get matrix from number column box.
- Define target values array.
Example 56
Summary: Analyze categorical data by fitting a standard linear regression model to predict Annual Salary Z, incorporating Gender, Length Of Service, and Performance as effects, and suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = Categorical( X( :sex, :marital status ), Responses( :country ) );
obj << Test Response Homogeneity( 1 );
rpt = Report( obj );
val = rpt[Outline Box( 3 )][Number Col Box( 1 )] << get as matrix;
val2 = rpt[Outline Box( 3 )][Number Col Box( 3 )] << get as matrix;
val1 = [5.68644135646778, 5.6069849388796];
Code Explanation:
- Open table.
- Create categorical analysis.
- Test response homogeneity.
- Generate report.
- Extract first value matrix.
- Extract third value matrix.
- Define fixed values array.
Example 57
Summary: Fits a standard linear regression model to predict Annual Salary Z, incorporating Gender, Length Of Service, and Performance as effects, and generates a report with detailed results.
Code:
dt = Open("data_table.jmp");
obj = Categorical( X( :size ), Responses( :country ) );
obj << Cell Chisq( 1 );
obj << Compare each sample( 1 );
obj << Compare each cell( 1 );
rpt = Report( obj );
val1 = rpt["Compare Each Sample"][Matrix Box( 1 )] << get;
eval1 = [. 0.0000003111401583204 5.98746519668924e-16,
0.0000003111401583204 . 0.0000792793472117579,
5.98746519668924e-16 0.0000792793472117579 .];
val2 = rpt["Compare Each Cell - Details"][Table Box( 1 )] << get as matrix;
eval2 = [0.0000004358910269543 1.70186058968822e-15 0.0000268030789191484,
0.468856725856521 0.448498257255933 0.970334867561975,
0.000000288775318326 2.43290419919438e-14 0.000117284011578632];
Code Explanation:
- Open data table;
- Create Categorical object.
- Set Chi-square test option.
- Enable Compare Each Sample option.
- Enable Compare Each Cell option.
- Generate report from object.
- Extract "Compare Each Sample" matrix.
- Store expected matrix eval1.
- Extract "Compare Each Cell - Details" matrix.
- Store expected matrix eval2.
Example 58
Summary: Fits a standard linear regression model to predict Annual Salary Z, incorporating Gender, Length Of Service, and Performance as effects, and suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Responses( :size ), X( :country ) );
obj << Compare Each Sample( 1 );
rpt = Report( obj );
val = rpt[Outline Box( 3 )][Matrix Box( 1 )] << get;
val1 = [. 0.00234452809225109 2.32230956499395e-16, 0.00234452809225109 . 0.0273253411221382, 2.32230956499395e-16 0.0273253411221382 .];
obj1 = dt << Categorical( Responses( :size ), X( :country ) );
obj1 << Compare Each Cell( 1 );
rpt = Report( obj1 );
valu = rpt[Outline Box( 3 )][Table Box( 1 )] << get as matrix;
valu1 = [0.00451998340635482 3.14754693928954e-13 0.0147433443816591,
0.694189731336238 0.116137177808372 0.488681022629614,
0.00361318849538789 6.86794158436025e-11 0.0965057693685581];
Code Explanation:
- Open data table;
- Run Categorical analysis.
- Set responses to :size.
- Set X to :country.
- Compare each sample.
- Extract report.
- Get matrix values.
- Define val1 matrix.
- Run Categorical analysis again.
- Compare each cell.
- Extract report.
- Get table values as matrix.
- Define valu1 matrix.
Example 59
Summary: Creates a categorical chart to analyze country distribution based on size, type, and responses from an open data table.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( X( :size, :type ), Responses( :country ), Legend( 0 ) );
Code Explanation:
- Open data table;
- Create categorical chart object.
- Set X variables: size, type.
- Set response variable: country.
- Disable legend display.
Example 60
Summary: Creates a categorical analysis object from a data table, specifying sample size, X variable, response frequencies, and frequency charts.
Code:
dt = Open("data_table.jmp");
obj = Categorical(
Sample Size( :SampleSize ),
X( :clean ),
Response Frequencies( :contamination, :corrosion, :doping, :metallization, :miscellaneous, :oxide defect, :silicon defect ),
Frequency Chart( 1 ),
Transposed Freq Chart( 1 ),
);
rpt = Report( obj );
Code Explanation:
- Open data table;
- Define categorical analysis object.
- Set sample size variable.
- Specify X variable.
- Define response frequencies.
- Create frequency chart.
- Create transposed frequency chart.
- Generate report object.
Example 61
Summary: Calculates and visualizes rater agreement for categorical data, using a Categorical object to group individual responses and generate a report.
Code:
dt = Open("data_table.jmp");
obj = Categorical( X, Rater Agreement( :A, :B, :C ), Grouping Option( Each Individually ) );
rpt = Report( obj );
val = rpt[Outline Box( 3 )][Number Col Box( 1 )] << get as matrix;
exp = [0.862944162436548, 0.776119402985075, 0.788007268322229];
Code Explanation:
- Open data table;
- Create Categorical object.
- Set Rater Agreement.
- Group individually.
- Generate report.
- Access outline box 3.
- Get number column box 1.
- Convert to matrix.
- Define expected values.
- Compare results.
Example 62
Summary: Creates a categorical report to compare letter grades, utilizing the Categorical function and suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = Categorical( Structured( :Goals, :Grade ), Compare Each Cell( 1 ) );
rpt = Report( obj );
text = rpt[Outline Box( 3 )][Text Box( 1 )] << get text;
exp = "Letter comparisons use Fisher's Exact Test";
Code Explanation:
- Open data table;
- Create categorical object.
- Generate report.
- Extract text from report.
- Define expected text.
Example 63
Summary: Creates a categorical analysis with local data filtering to visualize country-specific responses for female employees, suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Responses( :country ),
Legend( 0 ),
Local Data Filter(
Location( {1856, 246} ),
Add Filter( columns( :sex ), Where( :sex == "Female" ) ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
)
);
indicator = Is Scriptable( obj );
Code Explanation:
- Open table.
- Create categorical analysis.
- Set response variable.
- Disable legend.
- Add local data filter.
- Set filter location.
- Filter by sex.
- Configure filter mode.
- Check scriptability.
- Assign result to indicator.
Example 64
Summary: Creates a categorical report to visualize and analyze responses from an employee survey, incorporating gender and single status as effects.
Code:
dt = Open("data_table.jmp");
obj = Categorical( Responses( :Gender ), Responses( :Single Status ), Legend( 0 ) );
obj << Automatic Recalc;
rpt = obj << report;
Code Explanation:
- Open data table.
- Create categorical object.
- Set responses to Gender.
- Add Single Status response.
- Disable legend.
- Enable automatic recalculation.
- Generate report.
Example 65
Summary: Creates a categorical analysis object to visualize frequency charts and share charts for Annual Salary Z, incorporating Gender, Length Of Service, and Performance as effects, while suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Structured( Empty(), :Brush Delimited ), Frequency Chart( 1 ), Share Chart( 1 ), Legend( 0 ) );
obj << savescripttodatatable;
rpt = obj << report;
obj2 = dt << runscript( "Categorical" );
rpt2 = obj2 << report;
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Configure frequency chart.
- Configure share chart.
- Disable legend.
- Save script to data table.
- Generate initial report.
- Run script again.
- Generate second report.
Example 66
Summary: Creates a categorical analysis report to visualize Rater Agreement for Employee Tenure, suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Rater Agreement( :Employee Tenure ), Legend( 0 ) );
rpt = obj << report;
Code Explanation:
- Open data table.
- Create categorical analysis.
- Set variable for analysis.
- Disable legend display.
- Generate report object.
Example 67
Summary: Creates a categorical analysis report to explore employee tenure, age group, and comparison groups, suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured( :Employee Tenure, :Age Group, <<Specify Comparison Groups( "A/B/C/D" ) ),
Share Chart( 0 ),
Legend( 0 )
);
rpt = obj << report;
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Define structured comparison groups.
- Disable shared chart.
- Disable legend.
- Generate report object.
Example 68
Summary: Creates a categorical analysis report, incorporating count missing responses and structured data from the Employee Master table.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Count Missing Responses( 1 ), Structured( Empty(), :Floss Delimited ), Share Chart( 0 ), Legend( 0 ) );
rpt = obj << report;
Code Explanation:
- Open table.
- Create categorical analysis object.
- Set count missing responses.
- Define structured data.
- Disable shared chart.
- Disable legend.
- Generate report.
Example 69
Summary: Creates a categorical analysis report, incorporating frequency and structured variables, with customized formatting for frequencies and shares.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Freq( :varnish pct ),
Structured( Empty(), :blade mfg ),
Frequencies Format( "Fixed Dec", 7, 3 ),
Shares and Rates Format( "Percent", 7, 2 )
);
rpt = obj << report;
Code Explanation:
- Open data table;
- Create categorical analysis.
- Set frequency variable.
- Define structured analysis.
- Specify empty structure.
- Include blade mfg variable.
- Set frequencies format.
- Set shares and rates format.
- Generate report object.
- Display report.
Example 70
Summary: Creates a categorical report to analyze structured data, incorporating comparison groups and response homogeneity testing.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured( :Brush Delimited, :Brush, <<Specify Comparison Groups( "A/B/c/d" ) ),
Test Response Homogeneity( 1 ),
);
rpt = obj << report;
Code Explanation:
- Open data table.
- Create categorical object.
- Specify structured analysis.
- Define comparison groups.
- Test response homogeneity.
- Generate report.
Example 71
Summary: Creates a categorical analysis object to visualize the relationship between age, type, country, and sex in predicting annual salary Z.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured(
:size * :age, :type * :country + :sex,
<<Specify Comparison Groups(
"A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/A1/B1/C1/D1/E1,F1/G1/H1/I1/J1/K1/L1/M1/N1/O1/P1/Q1/R1/S1/T1/U1/V1/W1/X1/Y1/Z1/A2/B2/C2/D2/E2/F2/G2/H2/I2/J2,K2/L2/M2/N2/O2/P2/Q2/R2/S2/T2/U2/V2/W2/X2/Y2/Z2/A3/B3/C3/D3/E3/F3"
)
),
Frequencies( 0 ),
Compare Each Cell( 1 ),
Share Chart( 0 ),
Frequency Chart( 1 ),
Legend( 0 )
);
obj << close window;
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Define structured model: sizeage, typecountry+sex.
- Specify comparison groups.
- Set frequencies to 0.
- Compare each cell.
- Disable shared chart.
- Enable frequency chart.
- Disable legend.
- Close analysis window.
Example 72
Summary: Creates a categorical object in JMP, specifying ID variable 'size', multiple responses for 'country' and 'size', and suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
ID( :size ),
Multiple Response( :country, :size ),
Multiple Response by ID( :country, :size ),
Multiple Delimited( :country ),
Multiple Delimited( :size ),
Legend( 0 )
);
obj << close window;
Code Explanation:
- Open data table;
- Create categorical object.
- Set ID variable to "size".
- Add "country" and "size" as multiple responses.
- Add "country" and "size" as multiple responses by ID.
- Add "country" as multiple delimited.
- Add "size" as multiple delimited.
- Set legend visibility to off.
- Close the categorical object window.
Example 73
Summary: Creates two categorical analysis objects to analyze Age Group and responses, with options for excluding nonresponses and testing response homogeneity.
Code:
dt = Open("data_table.jmp");
obj = Categorical(
Title( "Original" ),
X( :Age Group ),
Responses( :I am working on my career ),
Legend( 0 ),
Test Response Homogeneity( 1 )
);
obj2 = Categorical(
Title( "Exclude Nonresponses" ),
Exclude Nonresponses( 1 ),
X( :Age Group ),
Responses( :I am working on my career ),
Legend( 0 ),
Test Response Homogeneity( 1 )
);
obj << close window;
obj2 << close window;
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Set title "Original".
- Set X variable to Age Group.
- Add response variable.
- Disable legend.
- Enable test for response homogeneity.
- Create second categorical analysis object.
- Set title "Exclude Nonresponses".
- Exclude nonresponse cases.
- Set X variable to Age Group.
- Add response variable.
- Disable legend.
- Enable test for response homogeneity.
- Close first analysis window.
- Close second analysis window.
Example 74
Summary: Creates and configures a categorical object to analyze responses, applying local data filters and updating missing responses count.
Code:
dt = Open("data_table.jmp");
obj = Categorical(
Count Missing Responses( 1 ),
Structured(
Empty(),
Aligned Responses(
:Name( "I am working on my career" ), :Name( "I want to see the world" ), :Name( "My home needs some major improvements" ),
:Name( "I have vast interests outside of work" ), :Name( "I want to get my debt under control" ),
:Name( "I come from a large family" ),
)
),
Legend( 0 ),
Share Chart( 1 )
);
ldf = obj << Local Data Filter(
Add Filter(
columns( :Name( "I want to see the world" ) ),
Display( :Name( "I want to see the world" ), Size( 160, 102 ), "List Display" )
)
);
ldf = ldf << (Filter Column( :Name( "I want to see the world" ) ) << Where( :Name( "I want to see the world" ) == 2 ));
obj << Count Missing Responses( 0 );
ldf = ldf << (Filter Column( :Name( "I want to see the world" ) ) << Where( :Name( "I want to see the world" ) == 1 ));
freqs = obj << Save Frequencies;
freqs_mat = freqs << Get as matrix;
obj << close window;
Code Explanation:
- Open data table.
- Create categorical object.
- Configure missing responses count.
- Define structured analysis.
- Disable legend display.
- Enable shared chart.
- Add local data filter.
- Set filter for specific column.
- Apply filter condition.
- Update missing responses count.
- Change filter condition.
- Save frequencies.
- Convert frequencies to matrix.
- Close categorical object window.
Example 75
Summary: Creates and manipulates categorical analysis objects to analyze rater agreement statistics, suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Rater Agreement( :First Survey, :Second Survey ), Freq( :Count ) );
jrn = obj << get journal;
check_agreement1 = Contains( jrn, "Rater Agreement Statistics" );
obj << Agreement Statistic( 0 );
jrn2 = obj << get journal;
check_agreement2 = Contains( jrn2, "Rater Agreement Statistics" );
obj << close window;
obj2 = dt << Categorical( Rater Agreement( :First Survey, :Second Survey ), Freq( :Count ), Agreement Statistic( 0 ) );
jrn3 = obj2 << get journal;
check_agreement3 = Contains( jrn3, "Rater Agreement Statistics" );
obj2 << close window;
Code Explanation:
- Open data table.
- Create categorical analysis.
- Retrieve analysis journal.
- Check for agreement statistics.
- Disable agreement statistic.
- Retrieve updated journal.
- Check for agreement statistics again.
- Close analysis window.
- Create categorical analysis with disabled statistic.
- Retrieve final journal and check for agreement statistics.
Example 76
Summary: Creates a categorical analysis object to visualize frequency of teeth cleaning habits based on indicator groups, suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
X( :Frequency of Teeth Cleaning ),
Indicator Group( :Floss After Waking Up, :Floss After Meal, :Floss Before Sleep, :Floss Another Time ),
Legend( 0 )
);
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Set X variable.
- Define indicator groups.
- Hide legend.
Example 77
Summary: Creates a categorical analysis object to predict Single Status and Job Satisfaction based on interactions between Age Group, Gender, and other variables.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured( :Single Status * :Gender, :Age Group * :Job Satisfaction ),
Share Chart( 0 ),
Legend( 0 ),
Test Response Homogeneity( 1 ),
FDR Adjusted PValues( 1 )
);
Code Explanation:
- Open table "data_table".
- Create categorical analysis object.
- Define structured analysis.
- Include interactions: Single Status * Gender, Age Group * Job Satisfaction.
- Disable shared chart.
- Disable legend.
- Enable test for response homogeneity.
- Enable FDR adjusted p-values.
Example 78
Summary: Fits a standard linear regression model to predict Annual Salary Z, incorporating Gender, Length Of Service, and Performance as effects, and suppresses detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Grouping Option( Both ),
X( :clean, :date ),
Multiple Response( :Failure1, :Failure2, :Failure3 ),
Legend( 0 ),
Count Test( 1 ),
Homogeneity Test( 1 ),
FDR Adjusted PValues( 1 )
);
Code Explanation:
- Open data table.
- Launch Categorical analysis.
- Set grouping option.
- Specify X variables.
- Define multiple responses.
- Hide legend.
- Enable count test.
- Enable homogeneity test.
- Adjust for false discovery rate.
- Display results.
Example 79
Summary: Fits a standard linear regression model to predict Annual Salary Z, incorporating Gender, Length Of Service, and Performance as effects, while suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Grouping Option( Each Individually ),
X( :Age Group, :Employee Tenure ),
Multiple Delimited( :Brush Delimited ),
Share Chart( 0 ),
Legend( 0 ),
Count Test( 1 ),
Homogeneity Test( 1 ),
FDR Adjusted PValues( 1 )
);
Code Explanation:
- Open data table.
- Perform categorical analysis.
- Group individually.
- Set X variables.
- Enable multiple delimited.
- Disable share chart.
- Disable legend.
- Enable count test.
- Enable homogeneity test.
- Enable FDR adjusted p-values.
Example 80
Summary: Creates a categorical table to analyze frequency and homogeneity tests, incorporating multiple response variables and suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Freq( :N ),
Grouping Option( Both ),
X( :date ),
By( :clean ),
Sample Size( :SampleSize ),
ID( :ID ),
Multiple Response by ID( :failure ),
Legend( 0 ),
Count Test( 1 ),
Homogeneity Test( 1 ),
FDR Adjusted PValues( 1 )
);
Code Explanation:
- Open data table.
- Set frequency variable.
- Enable grouping option.
- Define X-axis variable.
- Apply by variable.
- Specify sample size.
- Identify ID variable.
- Set multiple response.
- Disable legend display.
- Enable count test.
- Enable homogeneity test.
- Adjust p-values for FDR.
Example 81
Summary: Creates a categorical analysis object to visualize and analyze employee data, incorporating Age Group, Employee Tenure, Brush After Waking Up, Brush After Meal, Brush Before Sleep, and Brush Another Time as effects.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
X( :Age Group, :Employee Tenure ),
Indicator Group( :Brush After Waking Up, :Brush After Meal, :Brush Before Sleep, :Brush Another Time ),
Legend( 0 ),
Count Test( 1 ),
Homogeneity Test( 1 ),
FDR Adjusted PValues( 1 )
);
Code Explanation:
- Open table.
- Create categorical analysis object.
- Set X variables.
- Define indicator groups.
- Disable legend.
- Enable count test.
- Enable homogeneity test.
- Enable FDR adjusted p-values.
Example 82
Summary: Creates a categorical object to analyze response frequencies, suppressing detailed diagnostic plots and enabling FDR adjusted p-values.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Sample Size( :SampleSize ),
X( :clean, :date ),
Response Frequencies( :contamination, :corrosion, :doping, :metallization, :miscellaneous, :oxide defect, :silicon defect ),
Legend( 0 ),
Count Test( 1 ),
Homogeneity Test( 1 ),
FDR Adjusted PValues( 1 )
);
Code Explanation:
- Open data table.
- Create categorical object.
- Set sample size.
- Define X variables.
- Specify response frequencies.
- Disable legend.
- Enable count test.
- Enable homogeneity test.
- Enable FDR adjusted p-values.
Example 83
Summary: Creates a categorical object for structured analysis, incorporating Single Status and Gender as grouping options, and suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured( :Single Status * :Gender, :Age Group * Brush Delimited ),
Share Chart( 0 ),
Legend( 0 ),
Count Test( 1 ),
Homogeneity Test( 1 ),
FDR Adjusted PValues( 1 )
);
Code Explanation:
- Open table.
- Create categorical object.
- Define structured analysis.
- Disable shared chart.
- Disable legend.
- Enable count test.
- Enable homogeneity test.
- Enable FDR adjusted p-values.
Example 84
Summary: Creates two categorical plots from a data table, transforming 'sex' to titlecase and setting 'name' as responses, while suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
X( Transform Column( "Titlecase[sex]", Character, Formula( Titlecase( :sex ) ) ) ),
Responses( :name ),
Legend( 0 )
);
obj2 = dt << Categorical( X( :sex ), Responses( :name ) );
checkTables = Function( {obj, obj2, saveScript},
Eval( Parse( "dt1 = obj << " || Char( saveScript ) ) );
Eval( Parse( "dt2 = obj2 << " || Char( saveScript ) ) );
Close( dt1, nosave );
Close( dt2, nosave );
);
obj << close window;
obj2 << close window;
Code Explanation:
- Open data table;
- Create categorical plot.
- Transform "sex" to titlecase.
- Set "name" as response.
- Disable legend.
- Create second categorical plot.
- Set "sex" as predictor.
- Define checkTables function.
- Save script to dt1 and dt2.
- Close dt1 and dt2 without saving.
- Close first categorical plot.
- Close second categorical plot.
Example 85
Summary: Creates two categorical plots with multiple delimited options and legend suppression, utilizing JMP's Categorical platform.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
X( :I am working on my career ),
Multiple Delimited( Transform Column( "Uppercase[Floss Delimited]", Character, Formula( Uppercase( :Floss Delimited ) ) ) ),
Legend( 0 )
);
obj2 = dt << Categorical( X( :I am working on my career ), Multiple Delimited( :Floss Delimited ), Legend( 0 ) );
obj << close window;
obj2 << close window;
Code Explanation:
- Open data table.
- Create categorical plot.
- Transform column to uppercase.
- Set multiple delimited option.
- Hide legend.
- Create second categorical plot.
- Set multiple delimited option.
- Hide legend.
- Close first plot window.
- Close second plot window.
Example 86
Summary: Runs the transformation and visualization of employee data by standardizing Employee Tenure and centering Age Group, then creating two categorical objects for analysis.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured(
Transform Column( "Standardize[Employee Tenure]", Formula( Col Standardize( :Employee Tenure ) ) ),
Transform Column( "Center[Age Group]", Formula( :Age Group - Col Mean( :Age Group ) ) )
),
Share Chart( 0 ),
Legend( 0 )
);
obj2 = dt << Categorical( Structured( :Employee Tenure, :Age Group ), Share Chart( 0 ), Legend( 0 ) );
obj << close window;
obj2 << close window;
Code Explanation:
- Open data table.
- Create categorical object with transformations.
- Transform Employee Tenure column.
- Center Age Group column.
- Disable shared chart.
- Disable legend.
- Create second categorical object.
- Include Employee Tenure and Age Group.
- Disable shared chart.
- Disable legend.
Example 87
Summary: Creates two categorical analysis objects to transform and analyze data, incorporating various effects and suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured(
Transform Column( "Square Root[Position Tenure]", Formula( Sqrt( :Position Tenure ) ) ) *
Transform Column( "Abs[My home needs some major improvements]", Formula( Abs( :My home needs some major improvements ) ) ) *
:Age Group,
Transform Column( "Abs[I am working on my career]", Formula( Abs( :I am working on my career ) ) ) *
Transform Column( "I want to see the world^2", Formula( :I want to see the world * :I want to see the world ) ) *
:I come from a large family
),
Share Chart( 0 ),
Legend( 0 )
);
obj2 = dt << Categorical(
Structured(
:Position Tenure * :My home needs some major improvements * :Age Group,
:I am working on my career * :I want to see the world * :I come from a large family
),
Share Chart( 0 ),
Legend( 0 )
);
obj << close window;
obj2 << close window;
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Transform "Position Tenure" column.
- Transform "My home needs some major improvements" column.
- Include "Age Group" in analysis.
- Transform "I am working on my career" column.
- Square "I want to see the world" column.
- Include "I come from a large family" in analysis.
- Create second categorical analysis object.
- Close both analysis windows.
Example 88
Summary: Creates a categorical object from a data table, specifying repeated measures and frequency variables for analysis.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Repeated Measures( :First Survey, :Second Survey ), Freq( :Count ) );
Code Explanation:
- Open data table.
- Create categorical object.
- Specify repeated measures.
- Set frequency variable.
Example 89
Summary: Creates a categorical analysis report from a structured data table, filtering results and generating a report with specified settings.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured( :Gender * :Single Status + :Age Group, :I want to see the world + :I want to get my debt under control )
);
obj << Filter( 1 );
rpt = obj << report;
a = 0;
Code Explanation:
- Open table "data_table".
- Create categorical analysis.
- Define structured categories.
- Apply filter to analysis.
- Generate report from analysis.
- Initialize variable 'a' to 0.
Example 90
Summary: Creates a categorical analysis object to explore gender-based responses, utilizing structured analysis and suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured(
Empty(),
:Gender,
Aligned Responses(
:I am working on my career, :I want to see the world, :My home needs some major improvements,
:I have vast interests outside of work, :I want to get my debt under control, :I come from a large family
)
),
Legend( 0 ),
Test Response Homogeneity( 1 ),
FDR Adjusted PValues( 1 ),
Share Chart( 1 )
);
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Define structured analysis.
- Include empty structure.
- Add gender variable.
- Align response variables.
- Specify response variables.
- Disable legend display.
- Enable response homogeneity test.
- Use FDR adjusted p-values.
- Enable share chart option.
Example 91
Summary: Creates categorical analysis objects to visualize and analyze employee data, incorporating titlecase transformation for the 'sex' column and suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
X( Transform Column( "Titlecase[sex]", Character, Formula( Titlecase( :sex ) ) ) ),
Responses( :name ),
Legend( 0 )
);
obj2 = dt << Categorical( X( :sex ), Responses( :name ) );
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Transform sex column to titlecase.
- Set name as response variable.
- Hide legend.
- Create second categorical analysis object.
- Use original sex column.
- Set name as response variable again.
Example 92
Summary: Creates a categorical analysis object to compare each cell in a structured data table, incorporating age and sex variables, and suppresses detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured( :age, :sex ),
Compare Each Cell( 1 ),
Share Chart( 0 ),
Frequency Chart( 1 ),
Legend( 0 ),
SendToReport( Dispatch( {"sex By age"}, "Compare Each Cell - Details", OutlineBox, {Close( 0 )} ) )
);
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Define structured variables: age, sex.
- Compare each cell with value 1.
- Do not share chart.
- Generate frequency chart.
- Hide legend.
- Send report dispatch.
- Close "Compare Each Cell - Details" outline box.
Example 93
Summary: Creates a categorical analysis object to compare each cell in a structured data table, suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = Categorical( Structured( :Employee Tenure, :Job Satisfaction ), Legend( 0 ) );
obj << Compare Each Cell( 1 );
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Define structured variables.
- Disable legend display.
- Compare each cell.
Example 94
Summary: Creates a categorical object with multiple delimited failures, ID column, and X variables for data analysis.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Multiple Delimited( :failureS ), ID( :ID ), X( :clean, :date ) );
obj << Compare Each Cell( 1 );
Code Explanation:
- Open data table;
- Assign dataset to variable
dt. - Create categorical object with multiple delimited failures.
- Set ID column to :ID.
- Set X variables to :clean and :date.
- Assign categorical object to variable
obj. - Compare each cell with threshold 1.
Example 95
Summary: Creates and analyzes contingency tables from a data table, including filtering out rows and renaming tables.
Code:
dt = Open("data_table.jmp");
dt[1, 3 :: 9] = 0;
obj1 = dt << Categorical(
Title( "Original" ),
Sample Size( :SampleSize ),
X( :clean, :date ),
Response Frequencies( :contamination, :corrosion, :doping, :metallization, :miscellaneous, :oxide defect, :silicon defect ),
Legend( 0 ),
Count Test( 1 ),
Homogeneity Test( 1 )
);
dt2 = dt << Subset( All Rows( 1 ), All Columns( 1 ) );
dt2 << Select Rows( 1 );
dt2 << exclude;
obj4 = dt2 << Categorical(
Title( "Exclude Rows" ),
Sample Size( :SampleSize ),
X( :clean, :date ),
Response Frequencies( :contamination, :corrosion, :doping, :metallization, :miscellaneous, :oxide defect, :silicon defect ),
Legend( 0 ),
Count Test( 1 ),
Homogeneity Test( 1 )
);
tab1 = obj1 << Save Contingency Table;
tab1 << Set Name( "Contingency Table - Original Data" );
tab2 = obj4 << Save Contingency Table;
tab2 << Set Name( "Contingency Table - Excluded One Row" );
mat1 = tab1 << Get as Matrix;
mat2 = tab2 << Get as Matrix;
obj1 << close window;
obj4 << close window;
Close( tab1, nosave );
Close( tab2, nosave );
Code Explanation:
- Open data table.
- Set selected columns to zero.
- Create categorical analysis object.
- Duplicate data table.
- Select first row in duplicate.
- Exclude selected row.
- Create categorical analysis object on excluded data.
- Save contingency table from original analysis.
- Rename original contingency table.
- Save contingency table from excluded analysis.
- Rename excluded contingency table.
- Extract matrix from original table.
- Extract matrix from excluded table.
- Close original analysis window.
- Close excluded analysis window.
- Close original contingency table without saving.
- Close excluded contingency table without saving.
Example 96
Summary: Creates and analyzes contingency tables for original and excluded data, utilizing Categorical and Subset operations in JMP.
Code:
dt = Open("data_table.jmp");
dt[1, 3 :: 9] = 0;
obj1 = dt << Categorical(
Title( "Original" ),
Sample Size( :SampleSize ),
X( :clean, :date ),
Response Frequencies( :contamination, :corrosion, :doping, :metallization, :miscellaneous, :oxide defect, :silicon defect ),
Legend( 0 ),
Count Test( 1 ),
Homogeneity Test( 1 )
);
dt2 = dt << Subset( All Rows( 1 ), All Columns( 1 ) );
dt2 << Select Rows( 1 );
dt2 << exclude;
obj4 = dt2 << Categorical(
Title( "Exclude Rows" ),
Sample Size( :SampleSize ),
X( :clean, :date ),
Response Frequencies( :contamination, :corrosion, :doping, :metallization, :miscellaneous, :oxide defect, :silicon defect ),
Legend( 0 ),
Count Test( 1 ),
Homogeneity Test( 1 )
);
tab1 = obj1 << Save Contingency Table;
tab1 << Set Name( "Contingency Table - Original Data" );
tab2 = obj4 << Save Contingency Table;
tab2 << Set Name( "Contingency Table - Excluded One Row" );
mat1 = tab1 << Get as Matrix;
mat2 = tab2 << Get as Matrix;
obj1 << close window;
obj4 << close window;
Code Explanation:
- Open data table.
- Set specific cells to zero.
- Create categorical analysis for original data.
- Subset all rows and columns.
- Exclude first row from subset.
- Create categorical analysis for excluded data.
- Save contingency table for original data.
- Rename original contingency table.
- Save contingency table for excluded data.
- Rename excluded contingency table.
Example 97
Summary: Creates a categorical object to analyze multiple responses and hide nonsignificant results, utilizing the Categorical platform in JMP.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Multiple Response( :country, :size ), X( :sex, :marital status ) );
obj << Count Test( 1 );
obj << Hide Nonsignificant( 1 );
Code Explanation:
- Open data table;
- Create categorical object.
- Set multiple responses.
- Add predictors.
- Run count test.
- Hide nonsignificant results.
Example 98
Summary: Creates and analyzes contingency tables for failure modes, incorporating multiple response by ID and supercategories, with frequency and sample size columns.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Multiple Response by ID( :failure ),
Supercategories(
:failure(
{Group( "First Three", {"contamination", "corrosion", "doping"} ), Group(
"Last Few",
{"metallization", "miscellaneous", "oxide defect", "silicon defect"}
)}
),
),
Freq( :N ),
Sample Size( :SampleSize ),
ID( :ID ),
X( :clean, :date )
);
obj << Rate Per Case Responding( 1 );
obj2 = dt << Categorical( Multiple Response by ID( :failure ), Freq( :N ), Sample Size( :SampleSize ), ID( :ID ), X( :clean, :date ) );
dtCont1 = obj << Save Contingency Table;
dtCont2 = obj2 << Save Contingency Table;
selRows = dtCont1 << Select Where( :failure == "First Three" | :failure == "Last Few" ) << Invert Row Selection << Get Selected Rows;
obj << close window;
obj2 << close window;
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Define multiple response by ID.
- Define supercategories for failure.
- Set frequency column.
- Set sample size column.
- Set ID column.
- Include clean and date variables.
- Set rate per case responding.
- Create second categorical analysis object.
- Save first contingency table.
- Save second contingency table.
- Select specific rows in first table.
- Invert row selection.
- Get selected rows.
- Close first analysis window.
- Close second analysis window.
Example 99
Summary: Analyzes and creates reports for categorical data by opening a JMP data table, running a categorical analysis, retrieving the report object, extracting journal information, and defining comparison oracles.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Structured( :Employee Tenure, :Age Group ), Compare Each Cell( 1 ), Compare Each Cell FDR( 1 ), );
rpt = obj << Report;
jrn = rpt[Alignment Grid Box( 1 )] << Get Journal;
comparisons = (rpt[Alignment Grid Box( 1 )] << Get Gridcell Data( "Comparisons" ))[1]["Data"]["Comparisons"];
comparisonsFDR = (rpt[Alignment Grid Box( 1 )] << Get Gridcell Data( "Comparisons FDR" ))[1]["Data"]["Comparisons FDR"];
compOracle = {"B,C,D", "C,D", "", "", "", "", "", "C,D", "a,C,D", "D", "a,D", "a", "", "a", "*", "*", "A,b,D*", "A,b,D*", "A*", "A,B*", "*",
"*", "*", "*", "*", "A,B*", "A,B*", "A,B,C*"};
compFDROracle = {"B,C,D", "C,D", "", "", "", "", "", "C,D", "C,D", "D", "D", "", "", "", "*", "*", "A,D*", "A,D*", "A*", "A,B*", "*", "*",
"*", "*", "*", "A,B*", "A,B*", "A,B,C*"};
obj << close window;
Code Explanation:
- Open data table.
- Run categorical analysis.
- Retrieve report object.
- Extract journal from report.
- Get comparisons data.
- Get FDR comparisons data.
- Define comparison oracle.
- Define FDR comparison oracle.
- Close analysis window.
Example 100
Summary: Creates and analyzes categorical comparisons in a JMP report, extracting data from grid boxes to facilitate further exploration.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured(
:Brush Delimited + :Floss Delimited, :Frequency of Teeth Cleaning + :Number of Fillings,
<<Specify Comparison Groups( "A/B/C/D/E/F/G/H" )
),
Legend( 0 ),
Compare Each Cell( 1 )
);
rpt = obj << report;
compTable1 = (rpt[Alignment Grid Box( 1 )] << Get Gridcell Data( "Comparisons" ))[1]["Data"]["Comparisons"];
compTable2 = (rpt[Alignment Grid Box( 1 )] << Get Gridcell Data( "Comparisons" ))[2]["Data"]["Comparisons"];
compTable3 = (rpt[Alignment Grid Box( 1 )] << Get Gridcell Data( "Comparisons" ))[3]["Data"]["Comparisons"];
compTable4 = (rpt[Alignment Grid Box( 1 )] << Get Gridcell Data( "Comparisons" ))[4]["Data"]["Comparisons"];
obj << close window;
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Define structured comparison groups.
- Disable legend display.
- Enable cell comparison.
- Retrieve analysis report.
- Extract comparisons data from grid box 1.
- Extract comparisons data from grid box 2.
- Extract comparisons data from grid box 3.
- Extract comparisons data from grid box 4.
- Close analysis window.
Example 101
Summary: Analyzes and creates reports for categorical data, generating expected letters and compare means for specified grid cells.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured( :Position Tenure + :Age Group, :I am working on my career + :Brush ),
Mean Score( 1 ),
Mean Score Comparisons( 1 )
);
rpt = obj << report;
exp_Letter = {"A", "B", "C", "D", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "E", "F", "G", "H", "I", "J", "K"};
GridCellBox_Num = [10, 20, 30, 40];
exp_CompareMeans = {};
For( i = 1, i <= 2, i++,
journal = Parse(
rpt["I am working on my career+Brush By Position Tenure+Age Group", GridCellBox( GridCellBox_Num[i] )] << get journal
);
expr = Extract Expr( journal, strings( Wild(), Wild(), Wild(), Wild() ) );
For( j = 1, j <= 4, j++,
exp_CompareMeans = Insert( exp_CompareMeans, Arg( expr, j ) )
);
);
For( i = 3, i <= 4, i++,
journal = Parse(
rpt["I am working on my career+Brush By Position Tenure+Age Group", GridCellBox( GridCellBox_Num[i] )] << get journal
);
expr = Extract Expr( journal, strings( Wild(), Wild(), Wild(), Wild(), Wild(), Wild(), Wild() ) );
For( j = 1, j <= 7, j++,
exp_CompareMeans = Insert( exp_CompareMeans, Arg( expr, j ) )
);
);
dt1 = obj << Save Mean Scores;
act_Letter = dt1:"Letter" << get values;
act_CompareMeans = dt1:"Compare Means" << get values;
Code Explanation:
- Open data table.
- Perform categorical analysis.
- Generate report object.
- Define expected letters.
- Define grid cell numbers.
- Initialize compare means list.
- Loop through grid cells 1-2.
- Parse journal from report.
- Extract expressions from journal.
- Insert extracted expressions into compare means list.
- Loop through grid cells 3-4.
- Parse journal from report.
- Extract expressions from journal.
- Insert extracted expressions into compare means list.
- Save mean scores to new table.
- Retrieve actual letters from new table.
- Retrieve actual compare means from new table.
Example 102
Summary: Creates a categorical analysis object to explore structured responses and save frequencies, utilizing JMP's Categorical platform.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured(
:Age Group,
Empty(),
Aligned Responses(
:I am working on my career, :I want to see the world, :My home needs some major improvements,
:I have vast interests outside of work, :I want to get my debt under control, :I come from a large family
)
),
Legend( 0 ),
Share Chart( 0 ),
Mean Score( 1 )
);
dtFreq = obj << Save Frequencies;
expectedSampleGroups = {"I am working on my career, All", "I want to see the world, All", "My home needs some major improvements, All",
"I have vast interests outside of work, All", "I want to get my debt under control, All", "I come from a large family, All"};
obj << close window;
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Define structured categorical variables.
- Set empty group.
- Align response variables.
- Disable legend.
- Disable shared chart.
- Enable mean score display.
- Save frequencies to new table.
- Close categorical analysis window.
Example 103
Summary: Creates and analyzes categorical data from a structured dataset, generating frequency tables and expected sample groups.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured(
:"What is your gender?"n,
Empty(),
Aligned Responses( :"I like the color blue."n, :"I like the color red."n, :"I like the color orange."n )
),
Legend( 0 ),
Share Chart( 0 ),
Mean Score( 1 )
);
dtFreq = obj << Save Frequencies;
expectedSampleGroups = {"I like the color blue., All", "I like the color red., All", "I like the color orange., All"};
obj << close window;
Close( dtFreq, nosave );
obj = dt << Categorical(
Structured(
Empty(),
:"What is your gender?"n,
Aligned Responses( :"I like the color blue."n, :"I like the color red."n, :"I like the color orange."n )
),
Legend( 0 ),
Share Chart( 0 ),
Mean Score( 1 )
);
dtFreq = obj << Save Frequencies;
expectedSampleGroups = {"I like the color blue., What is your gender? = Female", "I like the color blue., What is your gender? = Male",
"I like the color red., What is your gender? = Female", "I like the color red., What is your gender? = Male",
"I like the color orange., What is your gender? = Female", "I like the color orange., What is your gender? = Male"};
obj << close window;
Close( dtFreq, nosave );
obj = dt << Categorical(
Structured(
Empty(),
Empty(),
Aligned Responses( :"I like the color blue."n, :"I like the color red."n, :"I like the color orange."n )
),
Legend( 0 ),
Share Chart( 0 ),
Mean Score( 1 )
);
dtFreq = obj << Save Frequencies;
expectedSampleGroups = {"I like the color blue., All", "I like the color red., All", "I like the color orange., All"};
obj << close window;
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Save frequencies to new table.
- Define expected sample groups.
- Close categorical analysis window.
- Close frequency table without saving.
- Create another categorical analysis object.
- Save frequencies to new table.
- Define expected sample groups.
- Close categorical analysis window.
Example 104
Summary: Analyze employee tenure and age group to generate a report with mean score comparisons, suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Structured( :Employee Tenure, :Age Group ), Mean Score( 1 ), Mean Score Comparisons( 1 ) );
rpt = obj << report;
journal = Parse( rpt["Age Group By Employee Tenure", GridCellBox( 10 )] << get journal );
color = Arg( Extract Expr( journal, coloruse( Wild() ) ) );
Code Explanation:
- Open data table;
- Perform categorical analysis.
- Structure analysis by "Employee Tenure" and "Age Group".
- Calculate mean score for each group.
- Compare mean scores between groups.
- Retrieve analysis report.
- Parse report for specific grid cell.
- Extract journal from grid cell.
- Find color usage expression in journal.
- Assign extracted color to variable.
Example 105
Summary: Creates a categorical analysis report, incorporating structured variables and mean score comparisons to visualize employee tenure and age group data.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Structured( :Employee Tenure, :Age Group ), Mean Score( 1 ), Mean Score Comparisons( 1 ) );
obj << Crosstab Transposed( 1 );
rpt = obj << report;
journal = Parse( rpt["Age Group By Employee Tenure", GridCellBox( 10 )] << get journal );
color = Arg( Extract Expr( journal, coloruse( Wild() ) ) );
Code Explanation:
- Open table.
- Create categorical analysis.
- Set structured variables.
- Enable mean score.
- Enable mean score comparisons.
- Transpose crosstab.
- Generate report.
- Extract specific grid cell.
- Get journal from grid cell.
- Extract color usage expression.
Example 106
Summary: Creates a categorical analysis object to visualize Age Group by Employee Tenure, with additional features for mean score and comparisons.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( X( :Employee Tenure ), Responses( :Age Group ), Share Chart( 1 ), Mean Score( 1 ), Mean Score Comparisons( 1 ) );
rpt = obj << report;
journal = Parse( rpt["Age Group By Employee Tenure", GridCellBox( 10 )] << get journal );
color = Arg( Extract Expr( journal, coloruse( Wild() ) ) );
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Set X variable to "Employee Tenure".
- Set response variable to "Age Group".
- Enable Share Chart option.
- Enable Mean Score option.
- Enable Mean Score Comparisons option.
- Generate report from analysis object.
- Extract specific grid cell content.
- Parse and extract color usage expression.
Example 107
Summary: Creates a categorical analysis object from a data table, defining oracle titles and suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Multiple Delimited( :failureS ), ID( :ID ), X( :clean, :date ) );
oracleTitles = {"Categorical", "Multiple Delimited(failures) By clean*date", "Test Each Response, Poisson", "clean, date, failures",
"Test Each Response, Binomial", "clean, date, failures", "Compare Each Cell - Details", "clean, date, failures"};
oracleTitles = {"Categorical", "Multiple Delimited(failures) By clean", "Test Each Response, Poisson", "clean, failures",
"Test Each Response, Binomial", "clean, failures", "Compare Each Cell - Details", "clean, failures", "Multiple Delimited(failures) By date",
"Test Each Response, Poisson", "date, failures", "Test Each Response, Binomial", "date, failures", "Compare Each Cell - Details",
"date, failures"};
oracleTitles = {"Categorical", "Multiple Delimited(failures) By clean*date", "Test Each Response, Poisson", "clean, date, failures",
"Test Each Response, Binomial", "clean, date, failures", "Compare Each Cell - Details", "clean, date, failures",
"Multiple Delimited(failures) By clean", "Test Each Response, Poisson", "clean, failures", "Test Each Response, Binomial",
"clean, failures", "Compare Each Cell - Details", "clean, failures", "Multiple Delimited(failures) By date", "Test Each Response, Poisson",
"date, failures", "Test Each Response, Binomial", "date, failures", "Compare Each Cell - Details", "date, failures"};
oracleTitles = {"Categorical", "Multiple Delimited(failures) By clean*date", "Test Each Response, Poisson", "clean, date, failures",
"Test Each Response, Binomial", "clean, date, failures", "Compare Each Cell - Details", "clean, date, failures"};
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Define oracle titles array.
- Update oracle titles array.
- Update oracle titles array again.
- Update oracle titles array once more.
- Set final oracle titles array.
Example 108
Summary: Creates two categorical analysis objects to analyze and format data for further exploration, utilizing frequency variables, structured analyses, and custom formatting options.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Freq( :varnish pct ),
Structured( Empty(), :blade mfg, Empty() ),
Format Elements( Shares and Rates( Percent, 7, 2 ), Frequencies( Fixed Dec, 7, 3 ) )
);
obj2 = dt << Categorical(
Freq( :varnish pct ),
Structured( Empty(), :blade mfg ),
Frequencies Format( "Fixed Dec", 7, 3 ),
Shares and Rates Format( "Percent", 7, 2 )
);
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Set frequency variable.
- Define structured analysis.
- Format shares and rates.
- Format frequencies.
- Create second categorical analysis object.
- Set frequency variable.
- Define structured analysis.
- Format frequencies and shares/rates.
Example 109
Summary: Creates a categorical analysis object to explore relationships between country, size, sex, and marital status in a dataset.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Include Responses Not in Data( 1 ),
Structured( :country * :size, :sex * :marital status ),
Share Of Responses( 0 ),
Compare Each Cell( 1 ),
Share Chart( 0 ),
Legend( 0 ),
Test Response Homogeneity( 1 ),
Total Responses( 0 )
);
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Include responses not in data.
- Define structured analysis: countrysize, sexmarital status.
- Disable share of responses.
- Enable compare each cell.
- Disable share chart.
- Disable legend.
- Enable test response homogeneity.
- Disable total responses.
Example 110
Summary: Analyze employee tenure and age, generating a report that compares mean scores for various responses.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Structured( :Employee Tenure, :Age Group ), Mean Score( 1 ), Mean Score Comparisons( 1 ) );
rpt = obj << report;
Code Explanation:
- Open data table.
- Perform categorical analysis.
- Structure analysis by tenure and age.
- Calculate mean scores.
- Compare mean scores.
- Generate analysis report.
Example 111
Summary: Analyze categorical data by structuring responses based on gender and saving frequency results, while suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured(
:"What is your gender?"n,
Empty(),
Aligned Responses( :"I like the color blue."n, :"I like the color red."n, :"I like the color orange."n )
),
Legend( 0 ),
Share Chart( 0 ),
Mean Score( 1 )
);
dtFreq = obj << Save Frequencies;
expectedSampleGroups = {"I like the color blue., All", "I like the color red., All", "I like the color orange., All"};
obj << close window;
Code Explanation:
- Open data table.
- Run categorical analysis.
- Structure analysis by gender.
- Align responses for color preferences.
- Disable legend display.
- Disable shared chart option.
- Enable mean score calculation.
- Save frequency results.
- Define expected sample groups.
- Close analysis window.
Example 112
Summary: Analyze and visualize employee tenure and age group data, generating a report with mean score comparisons and color-coded journal extraction.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( Structured( :Employee Tenure, :Age Group ), Mean Score( 1 ), Mean Score Comparisons( 1 ) );
rpt = obj << report;
journal = Parse( rpt["Age Group By Employee Tenure", GridCellBox( 10 )] << get journal );
color = Arg( Extract Expr( journal, coloruse( Wild() ) ) );
dt = Open("data_table.jmp");
obj = dt << Categorical( Structured( :Employee Tenure, :Age Group ), Mean Score( 1 ), Mean Score Comparisons( 1 ) );
obj << Crosstab Transposed( 1 );
rpt = obj << report;
journal = Parse( rpt["Age Group By Employee Tenure", GridCellBox( 10 )] << get journal );
color = Arg( Extract Expr( journal, coloruse( Wild() ) ) );
dt = Open("data_table.jmp");
obj = dt << Categorical( X( :Employee Tenure ), Responses( :Age Group ), Share Chart( 1 ), Mean Score( 1 ), Mean Score Comparisons( 1 ) );
rpt = obj << report;
journal = Parse( rpt["Age Group By Employee Tenure", GridCellBox( 10 )] << get journal );
color = Arg( Extract Expr( journal, coloruse( Wild() ) ) );
Code Explanation:
- Open data table;
- Create categorical analysis.
- Generate mean score report.
- Extract journal from report.
- Parse journal for color usage.
- Open data table;
- Create categorical analysis.
- Enable crosstab transposition.
- Generate mean score report.
- Extract journal from report.
Example 113
Summary: Creates two categorical analysis objects to analyze employee data, incorporating structured analysis with interaction and various formatting options.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured( :Position Tenure * :Gender, :I am working on my career + :Brush ),
Share Confidence Interval( 1 ),
Mean Score( 1 ),
Std Dev Score( 1 ),
Format Elements( Shares and Rates( Percent, 7, 2 ), Frequencies( Fixed Dec, 7, 3 ) ),
Means Decimals( 2 )
);
obj2 = dt << Categorical(
Structured( :Position Tenure * :Gender, :I am working on my career + :Brush ),
Share Confidence Interval( 1 ),
Mean Score( 1 ),
Std Dev Score( 1 ),
Shares and Rates Format( "Percent", 7, 2 ),
Frequencies Format( "Fixed Dec", 7, 3 ),
Means Format( "Fixed Dec", 7, 2 )
);
cellItemsOld = cellItemsNew = {};
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Define structured analysis with interaction.
- Enable share confidence interval.
- Enable mean score calculation.
- Enable standard deviation score calculation.
- Set format for shares and rates.
- Set format for frequencies.
- Set means decimals to 2.
- Repeat steps 2-9 for second analysis object.
Example 114
Summary: Creates a new table 'S1053610' with nominal, ordinal, and continuous columns, and calculates relative risk for categorical analysis.
Code:
dt = Open("data_table.jmp");
obj = Categorical( Freq( :Count ), Structured( :First Survey, :Second Survey ) );
obj << Relative Risk( 1, {"Approve"}, {"Approve"} );
Close( dt, No save );
dt = New Table( "S1053610",
Add Rows( 36 ),
New Column( "Cheese",
Character( 1 ),
"Nominal",
Set Values(
{"A", "A", "A", "A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "B", "B", "B", "C", "C", "C", "C", "C", "C", "C",
"C", "C", "D", "D", "D", "D", "D", "D", "D", "D", "D"}
)
),
New Column( "Response",
Numeric,
"Ordinal",
Format( "Fixed Dec", 5, 0 ),
Set Property( "Supercategories", {Group( "Top Two", {8, 9}, Hide ), All, Mean, Std Dev} ),
Set Values( [1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9] )
),
New Column( "Count",
Numeric,
"Continuous",
Format( "Fixed Dec", 5, 0 ),
Preselect Role( Freq ),
Set Values( [0, 0, 1, 7, 8, 8, 19, 8, 1, 6, 9, 12, 11, 7, 6, 1, 0, 0, 1, 1, 6, 8, 23, 7, 5, 1, 0, 0, 0, 0, 1, 3, 7, 14, 16, 11] )
),
New Column( "Response nosuper",
Numeric,
"Ordinal",
Format( "Fixed Dec", 5, 0 ),
Set Values( [1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9] )
)
);
obj = dt << Categorical( Freq( :Count ), Structured( :Cheese, :Response nosuper * :Response ), Include Responses Not in Data( 1 ) );
rpt = obj << report;
Code Explanation:
- Open table "data_table".
- Create categorical analysis object.
- Calculate relative risk for "Approve".
- Close table without saving.
- Create new table "S1053610".
- Add 36 rows to new table.
- Add "Cheese" column with nominal data.
- Add "Response" column with ordinal data.
- Add "Count" column with continuous data.
- Add "Response nosuper" column with ordinal data.
Example 115
Summary: Calculates relative risk between 'Approve' responses in First Survey and Second Survey, using categorical data structured by First Survey and Second Survey.
Code:
dt = Open("data_table.jmp");
obj = Categorical( Freq( :Count ), Structured( :First Survey, :Second Survey ) );
obj << Relative Risk( 1, {"Approve"}, {"Approve"} );
Code Explanation:
- Open data table;
- Create categorical object.
- Set frequency to :Count.
- Structure by First Survey, Second Survey.
- Calculate relative risk.
- Compare "Approve" from both surveys.
Example 116
Summary: Creates and creates a report for a categorical analysis for Age Group, utilizing structured variables, alpha level, base count minimum, and base count warning.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured( :Age Group, :I am working on my career, ),
Uppercase Alpha Level( 0.03 ),
Base Count Minimum( 44 ),
Base Count Warning( 60 ),
Compare Each Cell( 1 )
);
obj << savescripttodatatable;
rpt = obj << report;
obj2 = dt << runscript( "Categorical" );
rpt2 = obj2 << report;
Code Explanation:
- Open table.
- Create categorical analysis.
- Set structured variables.
- Define alpha level.
- Set base count minimum.
- Set base count warning.
- Compare each cell.
- Save script to data table.
- Generate report.
- Run script again.
- Generate second report.
Example 117
Summary: Creates a categorical report to analyze structured data, incorporating gender and age group as effects.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured( :Gender * :Single Status + :Age Group, :I want to see the world + :I want to get my debt under control ),
Compare Each Cell( 1 )
);
rpt = obj << report;
Code Explanation:
- Open data table.
- Create categorical object.
- Define structured analysis.
- Compare each cell.
- Generate report.
Example 118
Summary: Creates a categorical analysis to predict career advancement based on gender, with interactive filtering and relative risk calculations.
Code:
dt = Open("data_table.jmp");
cat = Categorical(
X( :Gender ),
Responses( :I am working on my career ),
Legend( 0 ),
Relative Risk( 1, {"Agree"}, {"M"} ),
Local Data Filter( Add Filter( columns( :I want to see the world ), Where( :I want to see the world == 1 ) ) )
);
AgreeRR = [1.01029988150579 0.869976221793149 1.17325718220986];
NoFilterRR = [1.0302066772655 0.894378426763271 1.18666301212489];
DisagreeRR = [1.23076923076923 0.792372325175638 1.91171858390248];
For( i = 1, i <= 10, i++,
cat << Remove Local Data Filter();
u = Random Uniform( 1 );
If(
u < 0.33333333333333,
cat << Local Data Filter( Add Filter( columns( :I want to see the world ), Where( :I want to see the world == 1 ) ) ),
u >= 0.33333333333333 & u < 0.66666666666666,
cat << Local Data Filter( Add Filter( columns( :I want to see the world ), Where( :I want to see the world == 2 ) ) ),
);
);
Code Explanation:
- Open data table.
- Create categorical analysis.
- Set X variable.
- Set response variable.
- Hide legend.
- Calculate relative risk.
- Add local data filter.
- Define AgreeRR array.
- Define NoFilterRR array.
- Define DisagreeRR array.
Example 119
Summary: Creates a categorical object to analyze and visualize the relationship between Gender, Age Group, and Single Status in a data table.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical(
Structured( :Gender * :Single Status, :Age Group ),
Frequency Chart( 1 ),
Legend( 0 ),
Relative Risk( 1, {}, {} ),
Local Data Filter( Mode, Add Filter( columns( :Gender ), Where( :Gender == 1 ) ) )
);
obj << updatewindow;
rpt = obj << report;
Code Explanation:
- Open table.
- Create categorical object.
- Define structured variables.
- Generate frequency chart.
- Disable legend.
- Calculate relative risk.
- Add local data filter.
- Update window.
- Retrieve report.
- Assign report to variable.
Example 120
Summary: Creates a categorical analysis report for employee data, incorporating gender and responses to predict annual salary.
Code:
Open("data_table.jmp");
Cat = Categorical( X( :sex ), Responses( :country ) );
Cat << Share Chart( 0 );
rep = Report( Cat );
Code Explanation:
- Open data table;
- Define categorical analysis.
- Set share chart option off.
- Generate report object.
Example 121
Summary: Creates a crosstabulation report to analyze categorical data, incorporating gender and country as effects.
Code:
dt = Open("data_table.jmp");
Cat = Categorical( X( :sex ), Responses( :country ) );
Cat << Crosstab Transposed( 1 );
rep = Report( Cat );
Code Explanation:
- Open data table.
- Define categorical analysis.
- Set X variable to sex.
- Set response to country.
- Create crosstabulation.
- Transpose crosstabulation.
- Generate report object.
Example 122
Summary: Creates a categorical analysis report to visualize the relationship between sex and age, utilizing the Categorical platform in JMP.
Code:
dt2 = Open("data_table.jmp");
Cat2 = Categorical( X( :sex ), Responses( :age ) );
rep = Report( Cat2 );
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Set sex as predictor variable.
- Set age as response variable.
- Generate report for analysis.
Example 123
Summary: Creates a categorical analysis report from an open data table, incorporating frequency charts and share charts to visualize response patterns.
Code:
dt = Open("data_table.jmp");
Cat = Categorical(
Freq( :N ),
Sample Size( :SampleSize ),
ID( :ID ),
X( :clean, :date ),
Multiple Response by ID( :failure ),
Frequencies( 1 ),
Share Of Responses( 1 ),
Rate Per Case( 1 ),
Share Chart( 1 ),
Frequency Chart( 1 ),
Legend( 1 ),
Test Each Response( 1 )
);
rep = Report( Cat );
Code Explanation:
- Open data table;
- Define categorical analysis parameters.
- Execute categorical analysis.
- Generate report from analysis.
Example 124
Summary: Creates a categorical analysis report to visualize and analyze responses from a multiple-delimited question, incorporating frequencies, share of responses, and rate per case.
Code:
dt = Open("data_table.jmp");
Cat = Categorical(
ID( :ID ),
X( :clean, :date ),
Multiple Delimited( :failureS ),
Frequencies( 1 ),
Share Of Responses( 1 ),
Rate Per Case( 1 ),
Share Chart( 0 ),
Frequency Chart( 0 ),
Legend( 0 ),
Test Each Response( 1 )
);
rep = Report( Cat );
test1 = [8.46577628973955, 1.0464962875291, 7.20615293666683, 4.52601207203459, 10.2381048678878, 11.520396075057, 7.53393801725972];
test2 = [0.132365487570605, 0.958729023419547, 0.205754380610095, 0.476410674168705, 0.0687630087355663, 0.0419844399852416,
0.183860872995198];
Code Explanation:
- Open data table.
- Define categorical analysis.
- Set ID variable.
- Specify X variables.
- Handle multiple delimited responses.
- Enable frequencies.
- Enable share of responses.
- Enable rate per case.
- Disable share chart.
- Disable frequency chart.
Example 125
Summary: Creates a categorical analysis report from a data table, specifying X variables, indicator groups, and formatting options.
Code:
dt = Open("data_table.jmp");
Cat = Categorical(
X( :clean, :date ),
Indicator Group( :contamination, :corrosion, :doping, :metallization, :miscellaneous, :oxide defect, :silicon defect ),
Frequencies( 1 ),
Share Of Responses( 1 ),
Rate Per Case( 1 ),
Share Chart( 1 ),
Frequency Chart( 0 ),
Table Format( 0 ),
Table Transposed( 1 ),
Legend( 0 )
);
rep = Report( Cat );
Code Explanation:
- Open data table;
- Create categorical analysis object.
- Set X variables: clean, date.
- Define indicator groups for categories.
- Enable frequencies calculation.
- Enable share of responses.
- Enable rate per case.
- Enable share chart.
- Disable frequency chart.
- Disable table format.
- Enable transposed table.
- Disable legend.
- Generate report from analysis.
Example 126
Summary: Creates a categorical analysis report, incorporating response frequencies and suppressing detailed diagnostic plots.
Code:
dt = Open("data_table.jmp");
Cat = Categorical(
Sample Size( :SampleSize ),
X( :clean, :date ),
Response Frequencies( :contamination, :corrosion, :doping, :metallization, :miscellaneous, :oxide defect, :silicon defect ),
Frequencies( 1 ),
Share Of Responses( 1 ),
Rate Per Case( 1 ),
Share Chart( 1 ),
Frequency Chart( 1 ),
Legend( 1 )
);
rep = Report( Cat );
test1 = [23, 23, 17, 31, 30, 36];
Code Explanation:
- Open data table.
- Create categorical analysis.
- Set sample size column.
- Define X variables.
- Specify response frequencies.
- Enable frequencies display.
- Enable share of responses display.
- Enable rate per case display.
- Enable share chart display.
- Enable frequency chart display.
Example 127
Summary: Creates a categorical report from a structured data table, combining 'Single Status' and 'School Age Children', and including 'Gender' as a variable.
Code:
dt = Open("data_table.jmp");
obj = Categorical( Structured( :Single Status + :School Age Children, :Gender ) );
rpt = Report( obj );
Code Explanation:
- Open table "data_table".
- Create categorical object.
- Structure categorical variables.
- Combine "Single Status" and "School Age Children".
- Include "Gender" variable.
- Generate report object.
- Assign report to variable.
Example 128
Summary: Creates a categorical analysis object to visualize employee tenure and age group, utilizing the Categorical platform in JMP.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( X( :Employee Tenure ), Responses( :Age Group ), Share Chart( 1 ) );
rpt = obj << Current Report();
rpt << get xml;
Comparison_lev = {"A/B", "C/D"};
Code Explanation:
- Open data table.
- Create categorical analysis object.
- Assign responses variable.
- Generate share chart.
- Retrieve current report.
- Convert report to XML.
- Define comparison levels.
Example 129
Summary: Creates a categorical analysis to compare employee tenure and age groups, generating t-tests and p-values for each level.
Code:
dt = Open("data_table.jmp");
obj = dt << Categorical( X( :Age Group ), Responses( :Employee Tenure ), Share Chart( 1 ), Legend( 0 ), Compare Each Cell( 1 ) );
dtTests = obj << Save TTests and PValues;
Summarize( dtTests, unq_level = by( :Level ) );
Insert Into( unq_level, ">54" );
act_comp_lev = dtTests:Compare Levels << get values;
act_comp_col = dtTests:Compare Column << get values;
act_with_col = dtTests:With Column << get values;
act_comp_col_lev = Substitute( act_comp_col,
"A", unq_level[1],
"B", unq_level[2],
"C", unq_level[3],
"D", unq_level[4],
"E", unq_level[5],
"F", unq_level[6],
"G", unq_level[7]
);
act_with_col_lev = Substitute( act_with_col,
"A", unq_level[1],
"B", unq_level[2],
"C", unq_level[3],
"D", unq_level[4],
"E", unq_level[5],
"F", unq_level[6],
"G", unq_level[7]
);
exp_comp_lev = {};
For( i = 1, i <= N Items( act_comp_col_lev ), i++,
exp_comp_lev[i] = act_comp_col_lev[i] || "-" || act_with_col_lev[i]
);
Code Explanation:
- Open table.
- Create categorical analysis.
- Save t-tests and p-values.
- Summarize test data.
- Insert new level.
- Get compare levels.
- Get compare column.
- Get with column.
- Substitute compare column levels.
- Substitute with column levels.
Categorical using Preferences
Summary: Sets default name location, configures header statistics preferences, and opens a data table for analysis.
Code:
Names Default To Here( 1 );
Preferences(
Header Stats(
Show( 1 ),
Track Selection( 1 ),
Row Limit( 1000000 ),
Categorical( {"N Unique", "Mode", "N Missing", "N Rows"} ),
Continuous( {"N", "Mean", "Std Dev", "Median", "Sum"} )
),
Set( Enable Experimental Data Table GUI( 1 ) )
);
dat1 = Open("data_table.jmp");
Code Explanation:
- Set default name location.
- Configure header statistics preferences.
- Show header statistics.
- Track selection changes.
- Set row limit to 1,000,000.
- Define categorical statistics.
- Define continuous statistics.
- Enable experimental data table GUI.
- Open data table.
Categorical using Column
Example 1
Summary: Creates a categorical analysis object for multivariate correlations, grouping by sex and ordering by age in descending order.
Code:
dt = Open("data_table.jmp");
Column( dt, "age" ) << Set Modeling Type( "Continuous" );
obj = dt << Categorical(
By( :sex ),
X( :age ),
Responses( :weight ),
Group Options( Order By( :age, Descending( 1 ), Order Statistic( "Mean" ) ), Return Group( 1 ) ),
Automatic Recalc( 1 )
);
dt << Clear Select << Select Where( :age == 17 & :sex == "M" ) << Delete Rows();
dt << Clear Select << Select Where( :age == 16 & :sex == "M" ) << Delete Rows();
Code Explanation:
- Open data table.
- Set age column to continuous.
- Create categorical analysis object.
- Group by sex.
- Use age as X variable.
- Set weight as response.
- Order by age descending.
- Calculate mean for ordering.
- Enable automatic recalculation.
- Delete rows where age is 17 and sex is M.
- Delete rows where age is 16 and sex is M.
Example 2
Summary: Runs a categorical analysis to explore the relationship between 'age', 'sex', and 'weight' in a data table, using group options to order by 'age' descending and calculate mean for ordering.
Code:
dt = Open("data_table.jmp");
Column( dt, "age" ) << Set Modeling Type( "Continuous" );
obj = dt << Categorical(
By( :sex ),
X( :age ),
Responses( :weight ),
Group Options( Order By( :age, Descending( 1 ), Order Statistic( "Mean" ) ), Return Group( 1 ) ),
Automatic Recalc( 1 )
);
dt << Clear Select << Select Where( :age == 17 & :sex == "M" ) << Delete Rows();
dt << Clear Select << Select Where( :age == 16 & :sex == "M" ) << Delete Rows();
obj << Redo Analysis;
Code Explanation:
- Open data table;
- Set "age" column to continuous.
- Create categorical analysis object.
- Group by "sex".
- Use "age" as predictor.
- Analyze "weight" responses.
- Order by "age" descending.
- Calculate mean for ordering.
- Return top group.
- Automatically recalculate results.
- Clear previous selections.
- Select rows where age is 17 and sex is M.
- Delete selected rows.
- Clear previous selections.
- Select rows where age is 16 and sex is M.
- Delete selected rows.
- Redo the analysis.
Categorical using Data Filter
Summary: Data filtering and categorical analysis to extract insights from a JMP data table, utilizing Data Filter and Categorical functions.
Code:
dt = Open( "$SAMPLE_DATA/data_table.jmp", "private" );
obj = dt << Data Filter(
Add Filter( columns( :Region, :POP ), Where( :Region == {"C", "N"} ) ),
Mode( Select( 0 ), Show( 0 ), Include( 1 ) )
);
txt1 = obj << Get Script;
where1 = Char( Arg( Arg( Arg( txt1, 2 ), 3 ), 2 ) );
dt2 = Open("data_table.jmp");
cat = dt2 << Categorical(
X( :Age Group, :School Age Children ),
Grouping Option( "Each Individually" ),
Responses( :I am working on my career ),
Responses( :My home needs some major improvements ),
Responses( :I have vast interests outside of work ),
Responses( :I come from a large family ),
Crosstab Transposed( 1 ),
Legend( 0 ),
Test Response Homogeneity( 1 )
);
ldf = cat << Local Data Filter(
Location( {607, 87} ),
Mode,
Add Filter(
columns( :Floss Delimited ),
Match Between( 1, 2, Where( :Floss Delimited == {"After Meal", "Before Sleep", "Other"} ) ),
Display( :Floss Delimited, Size( 121, 87 ), Check Box Display )
)
);
txt = ldf << Get Script;
whereClause = Char( Arg( Arg( txt, 2 ), 2 ) );
Code Explanation:
- Open data table;
- Create data filter for Region and POP.
- Set filter mode to Select 0, Show 0, Include 1.
- Extract filter script.
- Extract where clause from script.
- Open data table;
- Create categorical analysis.
- Set X variables: Age Group, School Age Children.
- Set grouping option to Each Individually.
- Define responses and set crosstab options.
Categorical using Log Capture
Example 1
Summary: Runs categorical analysis on 'Reasons Not to Floss' and generates a new table with grouped data, utilizing Log Capture and Collapse Whitespace features.
Code:
dt = Open("data_table.jmp");
lc = Log Capture( obj = dt << Categorical( Free Text( :Reasons Not to Floss << Score Terms by Column( :Gender ) ) ) );
Close( dt, nosave );
dt = New Table( "bygroups",
Add Rows( 39 ),
New Column( "Column 1",
Numeric,
Nominal,
Set Values( [0, 1, 2, 1, 1, 2, 2, 0, 2, 2, 1, 1, 2, 0, 1, 2, 1, 2, ., 1, 2, 0, 0, ., 1, 2, ., ., ., ., ., ., ., ., ., ., ., ., .] )
),
New Column( "by", Numeric, Continuous, Formula( Sequence( 1, 3, 1, 13 ) ) ),
New Column( "Column 3",
Character,
Nominal,
Set Values(
{"a", "a", "b", "b", "c", "c", "a", "a", "b", "b", "c", "c", "a", "a", "a", "b", "b", "c", "", "a", "a", "b", "b", "", "c", "a",
"", "", "", "", "", "", "", "", "", "", "", "", ""}
)
)
);
lc = Collapse Whitespace( Log Capture( obj = Categorical( X( :Column 3 ), Responses( :Column 1 ), By( :by ) ) ) );
Close( dt, nosave );
dt = New Table( "missing",
New Column( "a", character, nominal ),
New Column( "b", character, nominal, setvalues( {"b1", "b2", "b3", "b1"} ) )
);
lc = Collapse Whitespace( Log Capture( obj = dt << Categorical( X( :a ), Responses( :b ), Structured( :a, :b ) ) ) );
Code Explanation:
- Open data table.
- Perform categorical analysis on 'Reasons Not to Floss'.
- Close the original table without saving.
- Create new table 'bygroups'.
- Add rows and columns to 'bygroups'.
- Set values for columns in 'bygroups'.
- Perform categorical analysis on 'bygroups' with 'by' grouping.
- Close 'bygroups' table without saving.
- Create new table 'missing'.
- Add columns and set values to 'missing'.
Example 2
Summary: Analyze categorical data by launching a Categorical platform with structured modeling, comparison groups, and frequency charts.
Code:
dt = Open("data_table.jmp");
lc = Log Capture(
obj = dt << Categorical(
Structured(
:size * :age, :type * :country + :sex,
<<Specify Comparison Groups(
"A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/A1/B1/C1/D1/E1,F1/G1/H1/I1/J1/K1/L1/M1/N1/O1/P1/Q1/R1/S1/T1/U1/V1/W1/X1/Y1/Z1/A2/B2/C2/D2/E2/F2/G2/H2/I2/J2,K2/L2/M2/N2/O2/P2/Q2/R2/S2/T2/U2/V2/W2/X2/Y2/Z2/A3/B3/C3/D3/E3/F3"
)
),
Frequencies( 0 ),
Compare Each Cell( 1 ),
Share Chart( 0 ),
Frequency Chart( 1 ),
Legend( 0 )
)
);
obj << close window;
Code Explanation:
- Open data_table data
- Start log capture.
- Launch Categorical analysis.
- Define structured model.
- Specify comparison groups.
- Set frequencies to 0.
- Enable compare each cell.
- Disable share chart.
- Enable frequency chart.
- Disable legend.
- Close analysis window.
Example 3
Summary: Runs categorical analysis to compare mean scores across structured model terms, utilizing comparison groups and enabling mean score comparisons and cell-by-cell analysis.
Code:
dt = Open("data_table.jmp");
lc = Log Capture(
obj = dt << Categorical(
Structured(
:Salary Group + :Floss,
:Age Group * :Gender * :Single Status + :Employee Tenure * :Single Status * :School Age Children + :Job Satisfaction * :Gender
* :School Age Children, <<Specify Comparison Groups( "A/F,B/G, C/H, D/E/I" )
),
Mean Score Comparisons( 1 ),
Compare Each Cell( 1 )
)
);
obj << close window;
Code Explanation:
- Open data table.
- Create log capture object.
- Launch categorical analysis.
- Define structured model terms.
- Specify comparison groups.
- Enable mean score comparisons.
- Enable compare each cell.
- Close analysis window.
Example 4
Summary: Creates a log capture object to analyze categorical data, specifically reasons not to floss scored by gender.
Code:
dt = Open("data_table.jmp");
lc = Log Capture( obj = dt << Categorical( Free Text( :Reasons Not to Floss << Score Terms by Column( :Gender ) ) ) );
Code Explanation:
- Open table.
- Create log capture object.
- Launch categorical analysis.
- Specify free text variable.
- Include reasons not to floss.
- Score terms by gender column.
Example 5
Summary: Analyze employee tenure and position tenure, filtering data by birth year range and inverting selection.
Code:
dt = Open("data_table.jmp");
Log Capture( obj = dt << Categorical( Rater Agreement( :Employee Tenure, :Position Tenure ) ) );
Log Capture(
ldf = obj << Local Data Filter( Add Filter( columns( :Birth Year ), Where( :Birth Year >= 1938 & :Birth Year <= 1974.188 ) ) )
);
Log Capture( birth_obj = ldf << Get Filter Column( :Name( "Birth Year" ) ) );
Log Capture( birth_obj << Invert Selection );
obj << close window;
Code Explanation:
- Open table.
- Fit categorical analysis.
- Create local data filter.
- Add filter for birth year.
- Capture filter object.
- Invert selection.
- Close analysis window.
Categorical using New Column
Example 1
Summary: Creates a categorical analysis object to fit a standard least squares model with multiple effects and generate a profiler plot, utilizing expected values for names, ages, sexes, heights, weights, and column 6.
Code:
dt = Open("data_table.jmp");
dt << New Column();
expectedName = {"KATIE", "LOUISE", "JANE", "JACLYN", "LILLIE", "TIM", "JAMES", "ROBERT", "BARBARA", "ALICE", "SUSAN", "JOHN", "JOE",
"MICHAEL", "DAVID", "JUDY", "ELIZABETH", "LESLIE", "CAROL", "PATTY", "FREDERICK", "ALFRED", "HENRY", "LEWIS", "EDWARD", "CHRIS", "JEFFREY",
"MARY", "AMY", "ROBERT", "WILLIAM", "CLAY", "MARK", "DANNY", "MARTHA", "MARION", "PHILLIP", "LINDA", "KIRK", "LAWRENCE"};
expectedAge = [12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15,
15, 15, 15, 16, 16, 16, 17, 17, 17];
expectedSex = {"F", "F", "F", "F", "F", "M", "M", "M", "F", "F", "F", "M", "M", "M", "M", "F", "F", "F", "F", "F", "M", "M", "M", "M", "M",
"M", "M", "F", "F", "M", "M", "M", "M", "M", "F", "F", "M", "F", "M", "M"};
expectedHeight = [59, 61, 55, 66, 52, 60, 61, 51, 60, 61, 56, 65, 63, 58, 59, 61, 62, 65, 63, 62, 63, 64, 65, 64, 68, 64, 69, 62, 64, 67,
65, 66, 62, 66, 65, 60, 68, 62, 68, 70];
expectedWeight = [95, 123, 74, 145, 64, 84, 128, 79, 112, 107, 67, 98, 105, 95, 79, 81, 91, 142, 84, 85, 93, 99, 119, 92, 112, 99, 113, 92,
112, 128, 111, 105, 104, 106, 112, 115, 128, 116, 134, 172];
expectedCol6 = [., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., ., .];
obj = dt << Categorical( X( :age ), Responses( :Column 6 ), Legend( 0 ), Compare Each Sample( 1 ), Share Chart( 1 ) );
rpt = obj << report;
Code Explanation:
- Open data table.
- Add new column to table.
- Define expected names list.
- Define expected ages list.
- Define expected sexes list.
- Define expected heights list.
- Define expected weights list.
- Define expected values for column 6.
- Create categorical analysis object.
- Generate report from analysis.
Example 2
Summary: Creates and analyzes a data table with multiple columns, including categorical grouping and formula-based calculations, before saving the results to an Excel file.
Code:
dt = Open("data_table.jmp");
dt << New Column( "new1",
set values( [10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20] )
);
dt << New Column( "new2",
set values(
[100 100 100 100 100 100 100 100 100 100 100 100 100 100 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 300 300
300 300 300 300 300 300 300 300]
)
);
dt << New Column( "new3", set values( [4 4 4 4 4 3 3 3 3 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] ) );
dt << New Column( "new4", Formula( :new1 + 1 ) );
obj = dt << Categorical( Grouping Option( Each Individually ), X( :age, :height, :new1, :new2, :new3 ), Responses( :sex ), Legend( 0 ) );
Log Capture( obj << Save Excel File( "$Temp\checkExcel1.xlsx", Separate Rows for each cellstatistic( 1 ) ) );
Code Explanation:
- Open data table;
- Add new column "new1".
- Set values for "new1".
- Add new column "new2".
- Set values for "new2".
- Add new column "new3".
- Set values for "new3".
- Add new column "new4" with formula.
- Create categorical analysis object.
- Save analysis results to Excel file.
Example 3
Summary: Creates and analyzes a data table with multiple columns, including categorical grouping and formula-based calculations, before saving the results to an Excel file.
Code:
dt = Open("data_table.jmp");
dt << New Column( "new1",
set values( [10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20] )
);
dt << New Column( "new2",
set values(
[100 100 100 100 100 100 100 100 100 100 100 100 100 100 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 300 300
300 300 300 300 300 300 300 300]
)
);
dt << New Column( "new3", set values( [4 4 4 4 4 3 3 3 3 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] ) );
dt << New Column( "new4", Formula( :new1 + 1 ) );
obj = dt << Categorical( Grouping Option( Each Individually ), X( :age, :height, :new1, :new2, :new3 ), Responses( :sex ), Legend( 0 ) );
Log Capture( obj << Save Excel File( "$Temp\checkExcel1.xlsx", Separate Rows for each cellstatistic( 1 ) ) );
newdt = Open( "$Temp\checkExcel1.xlsx" );
Code Explanation:
- Open data table;
- Create new column "new1".
- Set values for "new1".
- Create new column "new2".
- Set values for "new2".
- Create new column "new3".
- Set values for "new3".
- Create new column "new4".
- Define formula for "new4".
- Run Categorical analysis.
- Save results to Excel.
- Open saved Excel file.
Example 4
Summary: Fits a standard least squares model with multiple effects and generates a profiler plot to visualize the relationship between age and Column 6, utilizing categorical analysis and local data filtering.
Code:
dt = Open("data_table.jmp");
dt << New Column();
obj = Categorical(
X( :age ),
Responses( :Column 6, <<Specify Comparison Groups( "A/B/C/D/E" ) ),
Compare Each Cell( 1 ),
Legend( 0 ),
Compare Each Sample( 1 ),
Contents Summary( 1 ),
Local Data Filter( Add Filter( columns( :height ), Where( :height >= 51 & :height <= 63.1 ) ) ),
SendToReport(
Dispatch( {"Column 6 By age"}, "Compare Each Sample", OutlineBox, {Close( 0 )} ),
Dispatch( {"Column 6 By age"}, "Compare Each Cell - Details", OutlineBox, {Close( 0 )} )
)
);
obj << close window;
Code Explanation:
- Open data table.
- Create new column.
- Initialize categorical analysis object.
- Set X variable to age.
- Define response variables.
- Specify comparison groups.
- Enable cell comparisons.
- Disable legend.
- Enable sample comparisons.
- Enable contents summary.
- Add local data filter.
- Close specific report sections.
- Close analysis window.
Example 5
Summary: Creates categorical analysis objects and saves mean scores from two separate analyses, utilizing the Categorical platform in JMP.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Dummy X", Character, "Nominal", Formula( If( :age > 0, "All" ) ) );
obj = dt << Categorical(
Structured( :country * :size, Empty() ),
Share Of Responses( 0 ),
Share Chart( 0 ),
Legend( 0 ),
Total Responses( 0 ),
Mean Score( 1 )
);
obj2 = dt << Categorical(
Structured( :country * :size, :Dummy X ),
Share Of Responses( 0 ),
Share Chart( 0 ),
Legend( 0 ),
Total Responses( 0 ),
Mean Score( 1 )
);
ms1 = obj << Save Mean Scores;
ms2 = obj2 << Save Mean Scores;
Close( ms1, nosave );
Code Explanation:
- Open table.
- Create new column.
- Run categorical analysis.
- Run second categorical analysis.
- Save mean scores.
- Save second mean scores.
- Close first mean scores table.
Example 6
Summary: Creates categorical analysis objects with structured data and calculates mean scores for multiple effects, utilizing the Categorical platform in JMP.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Dummy X", Character, "Nominal", Formula( If( :age > 0, "All" ) ) );
obj = dt << Categorical(
Structured( :country * :size, Empty() ),
Share Of Responses( 0 ),
Share Chart( 0 ),
Legend( 0 ),
Total Responses( 0 ),
Mean Score( 1 )
);
obj2 = dt << Categorical(
Structured( :country * :size, :Dummy X ),
Share Of Responses( 0 ),
Share Chart( 0 ),
Legend( 0 ),
Total Responses( 0 ),
Mean Score( 1 )
);
ms1 = obj << Save Mean Scores;
ms2 = obj2 << Save Mean Scores;
Code Explanation:
- Open data table.
- Create new column "Dummy X".
- Define formula for "Dummy X".
- Perform categorical analysis on country*size.
- Disable share of responses.
- Disable share chart.
- Disable legend.
- Disable total responses.
- Enable mean score.
- Save mean scores from analysis.
Example 7
Summary: Creates categorical columns for multiple response data, utilizing the
New ColumnandCategoricalfunctions in JMP.
Code:
dt = Open("data_table.jmp");
dt << New Column( "Brush Delimited Only 2",
Character,
formula(
If( Contains( :Brush Delimited, "Wake" ), "Wake,", "" ) || If( Contains( :Brush Delimited, "After Meal" ), "After Meal", "" )
),
set property( "Multiple Response", Multiple Response( Separator( "," ) ) )
);
dt << New Column( "Floss Delimited Only 2",
Character,
Formula(
If( Contains( :Brush Delimited, "Before Sleep" ), "Before Sleep,", "" ) || If( Contains( :Brush Delimited, "Other" ), "Other", "" )
),
set property( "Multiple Response", Multiple Response( Separator( "," ) ) )
);
obj = dt << Categorical(
ID( :Response ID ),
Unique Occurrences within ID( 1 ),
X( :Gender ),
Multiple Delimited( :Brush Delimited Only 2 ),
Multiple Delimited( :Floss Delimited Only 2 ),
Legend( 0 ),
);
rpt = obj << report;
Code Explanation:
- Open data table.
- Create new column "Brush Delimited Only 2".
- Set column data type to character.
- Define column formula for brush delimited values.
- Set multiple response property with comma separator.
- Create new column "Floss Delimited Only 2".
- Set column data type to character.
- Define column formula for floss delimited values.
- Set multiple response property with comma separator.
- Perform categorical analysis on data table.
Categorical using Sort Ascending
Example 1
Summary: Creates a frequency table to analyze the distribution of Age Group and Career question responses, utilizing random row indices and categorical analysis.
Code:
dt = Open("data_table.jmp");
randRows = Sort Ascending( J( 0.1 * N Row( dt ), 1, Random Integer( 1, N Row( dt ) ) ) );
randRows2 = Sort Ascending( J( 0.15 * N Row( dt ), 1, Random Integer( 1, N Row( dt ) ) ) );
dt[randRows, "Age Group"] = .;
dt[randRows2, "I am working on my career"] = .;
obj = dt << Categorical( Structured( :Age Group, :I am working on my career ) );
rpt = Report( obj );
ageKeys = Associative Array( dt[0, "Age Group"] ) << Get Keys;
careerKeys = Associative Array( dt[0, "I am working on my career"] ) << Get Keys;
freq_table = [];
For( i = 2, i <= Length( careerKeys ), i++,
freq_row = [];
For( j = 2, j <= Length( ageKeys ), j++,
freq_row = freq_row || N Row(
dt << Select Where( :Age Group == ageKeys[j] & :"I am working on my career"n == careerKeys[i] ) << Get Selected Rows
)
);
freq_table = freq_table |/ freq_row;
);
dt_freq = obj << Save Frequencies;
Code Explanation:
- Open data table.
- Generate random row indices for Age Group.
- Generate additional random row indices for Career question.
- Set selected Age Group values to missing.
- Set selected Career question values to missing.
- Create categorical analysis object.
- Retrieve report from categorical analysis.
- Extract keys from Age Group column.
- Extract keys from Career question column.
- Create frequency table and save frequencies.
Example 2
Summary: Process of generating a categorical analysis report, selecting random rows, and counting responses for Democrats and Republicans.
Code:
dt = Open("data_table.jmp");
randRows = Sort Ascending( J( 0.1 * N Row( dt ), 1, Random Integer( 1, N Row( dt ) ) ) );
randRows2 = Sort Ascending( J( 0.15 * N Row( dt ), 1, Random Integer( 1, N Row( dt ) ) ) );
dt[randRows, "1996 Winner"] = .;
dt[randRows2, "2000 Winner"] = .;
obj = dt << Categorical(
Count Missing Responses( 0 ),
Repeated Measures(
:"1980 Winner"n, :"1984 Winner"n, :"1988 Winner"n, :"1992 Winner"n, :"1996 Winner"n, :"2000 Winner"n, :"2004 Winner"n,
:"2008 Winner"n, :"2012 Winner"n
),
);
rpt = Report( obj );
Responses = {:"1980 Winner"n, :"1984 Winner"n, :"1988 Winner"n, :"1992 Winner"n, :"1996 Winner"n, :"2000 Winner"n, :"2004 Winner"n,
:"2008 Winner"n, :"2012 Winner"n};
freq_table = [];
For( i = 1, i <= Length( Responses ), i++,
numDem = N Row( dt << Select Where( Eval( Responses[i] ) == "Democrat" ) << Get Selected Rows );
numRep = N Row( dt << Select Where( Eval( Responses[i] ) == "Republican" ) << Get Selected Rows );
freq_table = freq_table |/ (numDem || numRep);
);
dt_freq = obj << Save Frequencies;
Code Explanation:
- Open table.
- Generate random rows.
- Generate another set of random rows.
- Clear data in selected rows.
- Clear data in selected rows.
- Perform categorical analysis.
- Create report object.
- Define response variables.
- Initialize frequency table.
- Loop through responses.
- Count Democrat responses.
- Count Republican responses.
- Append counts to table.
- Save frequency table.
Categorical using Is Scriptable
Example 1
Summary: Creates a categorical object for exploratory data analysis, utilizing Is Scriptable to check scriptability and set X variables.
Code:
dt = Open("data_table.jmp");
test = Is Scriptable(
obj = Categorical(
X( :I want to see the world, :My home needs some major improvements, :I have vast interests outside of work ),
Responses( :Gender ),
Legend( 0 ),
Test Response Homogeneity( 1 );
Hide Nonsignificant( 1 );
)
);
Code Explanation:
- Open data table.
- Check if scriptable.
- Create categorical object.
- Set X variables.
- Set response variable.
- Disable legend display.
- Enable test for homogeneity.
- Hide nonsignificant results.
Example 2
Summary: Creates a categorical object from a data table, separating responses by country and checking scriptability.
Code:
dt = Open("data_table.jmp");
test = Is Scriptable( obj = Categorical( X( :sex, :marital status ), Separate Responses( :country ) ) );
Code Explanation:
- Open data table;
- Create categorical object.
- Set X variables: sex, marital status.
- Separate responses by country.
- Check if scriptable.
Categorical using Associative Array
Example 1
Summary: Analyze and visualize job satisfaction data by age group, generating a categorical chart with frequency distributions and expected results.
Code:
dt = Open("data_table.jmp");
bef aa = Associative Array( Window() << get window title );
obj = Categorical( X( :Age Group ), Responses( :Job Satisfaction ), Share
Chart( 0 ), Crosstab Format( 1 ), Legend( 0 ) );
dt1 = obj << Save Frequencies;
mat1 = dt1 << get rows( {1, 2, 3, 4, 5, 6, 7} );
exp = {{:Sample Group = "Age Group = 25-29", :Name( "Job Satisfaction=Not at all satisfied" ) = 6, :Name(
"Job Satisfaction=Somewhat satisfied"
) = 66, :Name( "Job Satisfaction=Extremely satisfied" ) = 41}, {:Sample Group = "Age Group = 30-34", :Name(
"Job Satisfaction=Not at all satisfied"
) = 4, :Name( "Job Satisfaction=Somewhat satisfied" ) = 44, :Name( "Job Satisfaction=Extremely satisfied" ) = 20}, {:Sample Group =
"Age Group = 35-39", :Name( "Job Satisfaction=Not at all satisfied" ) = 1, :Name( "Job Satisfaction=Somewhat satisfied" ) = 27,
:Name( "Job Satisfaction=Extremely satisfied" ) = 21}, {:Sample Group = "Age Group = 40-44", :Name(
"Job Satisfaction=Not at all satisfied"
) = 8, :Name( "Job Satisfaction=Somewhat satisfied" ) = 25, :Name( "Job Satisfaction=Extremely satisfied" ) = 19}, {:Sample Group =
"Age Group = 45-49", :Name( "Job Satisfaction=Not at all satisfied" ) = 5, :Name( "Job Satisfaction=Somewhat satisfied" ) = 24,
:Name( "Job Satisfaction=Extremely satisfied" ) = 23}, {:Sample Group = "Age Group = 50-54", :Name(
"Job Satisfaction=Not at all satisfied"
) = 3, :Name( "Job Satisfaction=Somewhat satisfied" ) = 21, :Name( "Job Satisfaction=Extremely satisfied" ) = 19}, {:Sample Group =
"Age Group = >54", :Name( "Job Satisfaction=Not at all satisfied" ) = 5, :Name( "Job Satisfaction=Somewhat satisfied" ) = 35,
:Name( "Job Satisfaction=Extremely satisfied" ) = 31}};
Code Explanation:
- Open table.
- Create associative array.
- Generate categorical analysis.
- Save frequencies.
- Extract specific rows.
- Define expected results.
Example 2
Summary: Analyze and visualize categorical data, generating a frequency table and extracting specific rows for further exploration.
Code:
dt = Open("data_table.jmp");
bef aa = Associative Array( Window() << get window title );
obj = Categorical( X( :Gender ), Responses( :Job Satisfaction ), Crosstab Format( 1 ) );
dt1 = obj << Save Frequencies;
mat1 = dt1 << get rows( {1, 2} );
exp = {{:Sample Group = "Gender = M", :Name( "Job Satisfaction=Not at all satisfied" ) = 17, :Name( "Job Satisfaction=Somewhat satisfied" )
= 135, :Name( "Job Satisfaction=Extremely satisfied" ) = 107}, {:Sample Group = "Gender = F", :Name(
"Job Satisfaction=Not at all satisfied"
) = 15, :Name( "Job Satisfaction=Somewhat satisfied" ) = 107, :Name( "Job Satisfaction=Extremely satisfied" ) = 67}};
Code Explanation:
- Open data table.
- Create associative array of windows.
- Run categorical analysis.
- Save frequencies to new table.
- Extract specific rows from new table.
- Define expected results.
Example 3
Summary: Response Screening analysis and retrieves PValues table data, converting it to a matrix for further processing.
Code:
dt = Open("data_table.jmp");
bef aa = Associative Array( Window() << get window title );
obj = dt << Response Screening( Y( :First Survey ), X( :Second Survey ), Weight( :Count ), Kappa( 1 ), PValues Table on Launch( 1 ) );
aft aa = Associative Array( Window() << get window title );
aft aa << Remove( bef aa );
aftlst = aftaa << get keys;
For( i = 1, i <= N Items( aftlst ), i++,
If( Contains( aftlst[i], "PValues" ),
dt2 = Data Table( aftlst[i] )
)
);
mat2 = dt2 << get as matrix;
obj1 = dt << Categorical( Freq( :Count ), Rater Agreement( :First Survey, :Second Survey ), );
rpt = Report( obj1 );
kappa_value = 0.69959266802444;
Code Explanation:
- Open data table.
- Create associative array before.
- Run Response Screening analysis.
- Create associative array after.
- Remove unchanged windows.
- Get keys of remaining windows.
- Loop through window keys.
- Find "PValues" window.
- Retrieve data table from "PValues".
- Convert data table to matrix.
Example 4
Summary: Runs response screening and data extraction from a JMP data table, utilizing associative arrays to manage window titles and retrieve specific windows.
Code:
dt = Open("data_table.jmp");
bef aa = Associative Array( Window() << get window title );
obj = dt << Response Screening(
Y( :I am working on my career, :I want to see the world, :My home needs some major improvements ),
X( :Salary, :Age in Years ),
Force X Categorical( 1 ),
PValues Table on Launch( 1 )
);
aft aa = Associative Array( Window() << get window title );
aft aa << Remove( bef aa );
aftlst = aftaa << get keys;
For( i = 1, i <= N Items( aftlst ), i++,
If( Contains( aftlst[i], "PValues" ),
dt2 = Data Table( aftlst[i] )
)
);
mat2 = dt2 << get as matrix;
pval = mat2[0, 2];
lrchq = mat2[0, 9];
exppval = [0.0448587969620063, 0.0000315865719277565, 0.239983810330969, 0.00402880306504693, 0.000662571593958354, 0.173657643350891];
explrchq = [148.599294896027, 91.8735127037343, 131.621917923019, 72.8521121598647, 177.20969029244, 52.6710248009576];
Code Explanation:
- Open data table.
- Create associative array before analysis.
- Perform response screening.
- Create associative array after analysis.
- Remove common windows from associative array.
- Get keys of remaining windows.
- Loop through window keys.
- Identify PValues window.
- Retrieve data from PValues window.
- Extract p-values and R-squared values.
Example 5
Summary: Response Screening analysis on a data table, generating PValues tables and extracting specific values from the results.
Code:
dt = Open("data_table.jmp");
bef aa = Associative Array( Window() << get window title );
obj = dt << Response Screening(
Y( :Salary ),
X( :I am working on my career, :I want to see the world ),
Force Y Categorical( 1 ),
PValues Table on Launch( 1 )
);
aft aa = Associative Array( Window() << get window title );
aft aa << Remove( bef aa );
aftlst = aftaa << get keys;
For( i = 1, i <= N Items( aftlst ), i++,
If( Contains( aftlst[i], "PValues" ),
dt2 = Data Table( aftlst[i] )
)
);
mat2 = dt2 << get as matrix;
pval = mat2[0, 2];
lrchq = mat2[0, 9];
exppval = [0.0448587969620422, 0.239983810330813];
explrchq = [148.59929489602, 131.621917923027];
Code Explanation:
- Open data table;
- Create associative array before analysis.
- Perform Response Screening.
- Set Salary as response variable.
- Set two predictor variables.
- Force Y categorical.
- Enable PValues Table on launch.
- Create associative array after analysis.
- Remove windows present before analysis.
- Get keys from remaining windows.
Example 6
Summary: Executes Response Screening script and extracts PValues data tables from the output.
Code:
Open("data_table.jmp");
bef aa = Associative Array( Window() << get window title );
test = Is Scriptable(
obj = Response Screening(
Y(
:Job Satisfaction, :I am working on my career, :I want to see the world, :My home needs some major improvements,
:I have vast interests outside of work, :I want to get my debt under control, :I come from a large family, :Brush, :Floss
),
X( :Gender, :Single Status, :School Age Children, :Age Group ),
Force X Categorical( 1 ),
Force Y Categorical( 1 ),
PValues Table On Launch( 1 )
)
);
aft aa = Associative Array( Window() << get window title );
aft aa << Remove( bef aa );
aftlst = aftaa << get keys;
For( i = 1, i <= N Items( aftlst ), i++,
If( Contains( aftlst[i], "PValues" ),
dt2 = Data Table( aftlst[i] )
)
);
Code Explanation:
- Open data table;
- Create associative array before running script.
- Run Response Screening script.
- Create associative array after running script.
- Remove windows present before script.
- Get keys from remaining windows.
- Loop through window keys.
- Check if key contains "PValues".
- Assign matching data table to dt2.
- End loop.
Example 7
Summary: Executes Response Screening and Categorical analyses, generating PValues tables and managing data table windows.
Code:
dt = Open("data_table.jmp");
bef aa = Associative Array( Window() << get window title );
test = Is Scriptable(
obj = Response Screening(
Y(
:Job Satisfaction, :I am working on my career, :I want to see the world, :My home needs some major improvements,
:I have vast interests outside of work, :I want to get my debt under control, :I come from a large family, :Brush, :Floss
),
X( :Gender, :Single Status, :School Age Children, :Age Group ),
Force X Categorical( 1 ),
Force Y Categorical( 1 ),
PValues Table On Launch( 1 )
)
);
aft aa = Associative Array( Window() << get window title );
aft aa << Remove( bef aa );
aftlst = aftaa << get keys;
For( i = 1, i <= N Items( aftlst ), i++,
If( Contains( aftlst[i], "PValues" ),
dt2 = Data Table( aftlst[i] )
)
);
Close( dt2, no save );
Close( dt, no save );
dt = Open("data_table.jmp");
bef aa = Associative Array( Window() << get window title );
test = Is Scriptable( obj = Response Screening( Y( 8 :: 394 ), X( :Process ), MaxLogWorth( 1000 ), PValues Table on Launch( 1 ) ) );
aft aa = Associative Array( Window() << get window title );
aft aa << Remove( bef aa );
aftlst = aftaa << get keys;
For( i = 1, i <= N Items( aftlst ), i++,
If( Contains( aftlst[i], "PValues" ),
dt2 = Data Table( aftlst[i] )
)
);
Close( dt2, no save );
Close( dt, no save );
dt = Open("data_table.jmp");
test = Is Scriptable( obj = Categorical( X( :sex, :marital status ), Separate Responses( :country ) ) );
Code Explanation:
- Open data table;
- Create associative array before analysis.
- Perform Response Screening analysis.
- Create associative array after analysis.
- Remove windows from before analysis.
- Get keys from after analysis array.
- Loop through keys to find "PValues".
- Open PValues table.
- Close PValues table without saving.
- Close data_table.jmp without saving.
- Open data table;
- Create associative array before analysis.
- Perform Response Screening analysis.
- Create associative array after analysis.
- Remove windows from before analysis.
- Get keys from after analysis array.
- Loop through keys to find "PValues".
- Open PValues table.
- Close PValues table without saving.
- Close data_table.jmp without saving.
- Open data table;
- Perform Categorical analysis.
Categorical using Set Modeling Type
Summary: Creates a categorical object from a structured data table, utilizing the Brush Delimited column and setting multiple response separator.
Code:
dt = Open("data_table.jmp");
:Brush Delimited << Set Modeling Type( "Nominal" );
:Brush Delimited << Set Property( "Multiple Response", "," );
obj = dt << Categorical( Structured( :Brush Delimited, :Gender ) );
rpt = obj << report;
Code Explanation:
- Open data table.
- Set Brush Delimited as Nominal.
- Define multiple response separator.
- Create Categorical object.
- Generate report.
Categorical using Random Reset
Summary: Creates and customizes a categorical column with random values, followed by data updates and visualization of frequency charts and mean scores.
Code:
dt = Open("data_table.jmp");
Random Reset( 123456789 );
yellowList = {0, 25, 50, 75, 100};
yellowCol = J( 80, 1, yellowList[Random Integer( 1, 5 )] );
dt << New Column( "I like the color yellow.",
Numeric,
"Nominal",
Set Property( "Supercategories", {Group( "Top 2", {75, 100} ), Group( "Bottom 2", {0, 25} )} ),
Set Property( "Value Order", {Custom Order( {100, 75, 50, 25, 0} )}, {Sorted Order( {100, 75, 50, 25, 00} )} ),
Value Labels( {0 = "Strongly Disagree", 25 = "Disagree", 50 = "Neutral", 75 = "Agree", 100 = "Strongly Agree"} ),
Use Value Labels( 1 ),
Set Values( yellowCol )
);
dt << Begin Data Update;
col1 = dt << New Column( dt:I like the color yellow. );
col1 << Set Name( "I like the color yellow. 2" );
dt << Move Selected Columns( {col1}, after( dt:I like the color yellow. ) );
dt << Recode Column(
dt:I like the color yellow.,
{Map Value( _rcOrig, {0, -2, 25, -1, 50, 0, 75, 1, 100, 2}, Unmatched( _rcNow ) )},
Target Column( col1 )
);
col1 << Remove Value Labels;
col1 << Value Labels( {-2, -1, 0, 1, 2}, {"Strongly Disagree", "Disagree", "Neutral", "Agree", "Strongly Agree"} );
dt << End Data Update;
obj = dt << Categorical(
Responses( :I like the color yellow. ),
Frequency Chart( 1 ),
Transposed Freq Chart( 1 ),
Legend( 0 ),
Mean Score( 1 ),
Std Dev Score( 1 )
);
obj2 = dt << Categorical(
Responses( :"I like the color yellow. 2"n ),
Frequency Chart( 1 ),
Transposed Freq Chart( 1 ),
Legend( 0 ),
Mean Score( 1 ),
Std Dev Score( 1 )
);
Code Explanation:
- Open data table.
- Set random seed.
- Define yellow list values.
- Generate random yellow column.
- Create new categorical column.
- Set properties for new column.
- Start data update.
- Duplicate column.
- Rename duplicated column.
- Move duplicated column.
- Recode original column.
- Remove value labels from recoded column.
- Set new value labels for recoded column.
- End data update.
- Create frequency chart for original column.
- Create transposed frequency chart for original column.
- Create mean score plot for original column.
- Create standard deviation plot for original column.
- Create frequency chart for recoded column.
- Create transposed frequency chart for recoded column.
- Create mean score plot for recoded column.
- Create standard deviation plot for recoded column.
Categorical using New Script
Summary: Runs the highlighting of cells in a JMP data table based on specific conditions, including share and mean score thresholds.
Code:
dt = Open("data_table.jmp");
dt << New Script( "Highlight Cells", {Highlight Cells( Share >= 0.8 ), Highlight Cells( Mean Score >= 2.7, Color( "Blue" ) )} );
obj = Categorical( Structured( :Position Tenure + :Age Group, :I am working on my career + :Brush ), Mean Score( 1 ) );
obj << Highlight Cells( Share >= 0.8 );
obj << Highlight Cells( Mean Score >= 2.7, Color( "Blue" ) );
obj << close window;
Code Explanation:
- Open table.
- Create new script.
- Highlight cells with Share >= 0.8.
- Highlight cells with Mean Score >= 2.7 in blue.
- Create categorical analysis object.
- Highlight cells with Share >= 0.8 in object.
- Highlight cells with Mean Score >= 2.7 in blue in object.
- Close window.
Categorical using Get Window List
Summary: Prepares data by opening a data table, selecting all rows, deleting selected rows, and creating a categorical analysis with 'Birth Year' and 'Gender', while updating the window list.
Code:
dt = Open("data_table.jmp");
dt << select all rows;
dt << delete rows;
winList1 = Get Window List();
obj = dt << Categorical( Structured( :Birth Year, :Gender ) );
winList2 = Get Window List();
Code Explanation:
- Open data table;
- Select all rows in the table.
- Delete selected rows from the table.
- Get list of current windows.
- Create categorical analysis with "Birth Year" and "Gender".
- Get updated list of windows.
Categorical using Set Values
Summary: Creates and compares categorical reports in JMP, utilizing a Categorical object to generate frequency charts and transposed frequency charts.
Code:
dt = Open("data_table.jmp");
:FailureS << Set Values( {"X", "X", "X"} );
obj = Categorical(
ID( :ID ),
X( :clean, :date ),
Multiple Delimited( :failureS ),
Frequency Chart( 1 ),
Transposed Freq Chart( 1 ),
Legend( 0 )
);
rpt1 = obj << report;
expr1 = rpt1 << get journal;
:FailureS << Set Property( "Missing Value Codes", "X" );
obj2 = obj << Redo Analysis;
rpt2 = obj2 << Report;
expr2 = rpt2 << Get Journal;
ans = Equal( expr1, expr2 );
Code Explanation:
- Open data table.
- Set FailureS values.
- Create categorical object.
- Generate report.
- Extract journal.
- Set missing value codes.
- Redo analysis.
- Generate new report.
- Extract new journal.
- Compare journals.
Categorical using Multiple Correspondence Analysis
Example 1
Summary: Runs multiple correspondence analysis (MCA) on selected columns, selects rows and excludes the first row, generates categorical reports, and retrieves MCA reports.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Multiple Correspondence Analysis(
Y( :sex, :marital status, :country ),
Z( :size, :type ),
Cross Table( Total %( 0 ), Show Total( 1 ) ),
Cross Table of Supplementary Columns( Total %( 0 ), Show Total( 1 ) )
);
dt << SelectRows( 19 :: 303 );
dt << Exclude( 1 );
obj2 = dt << Multiple Correspondence Analysis(
Y( :sex, :marital status, :country ),
Z( :size, :type ),
Cross Table( Total %( 0 ), Show Total( 1 ) ),
Cross Table of Supplementary Columns( Total %( 0 ), Show Total( 1 ) )
);
objCat = dt << Categorical(
Structured( :size + :type, :sex + :marital status + :country ),
Share Of Responses( 0 ),
Share Chart( 0 ),
Legend( 0 ),
Total Responses( 0 ),
Force Crosstab Shading( 0 )
);
rpt1 = obj1 << Report();
rpt2 = obj2 << Report();
rptCat = objCat << Report();
Code Explanation:
- Open data table;
- Perform MCA on selected columns.
- Select rows 19 to 303.
- Exclude first row.
- Perform MCA again on selected columns.
- Create categorical analysis report.
- Retrieve first MCA report.
- Retrieve second MCA report.
- Retrieve categorical report.
Example 2
Summary: Executes multiple correspondence analyses (MCAs) on a modified dataset, generates reports for each MCA, and extracts specific text from the reports.
Code:
dt = Open("data_table.jmp");
obj1 = dt << Multiple Correspondence Analysis(
Y( :sex, :marital status, :country ),
Z( :size, :type ),
Cross Table( Total %( 0 ), Show Total( 1 ) ),
Cross Table of Supplementary Columns( Total %( 0 ), Show Total( 1 ) )
);
dt << SelectRows( 19 :: 303 );
dt << Exclude( 1 );
obj2 = dt << Multiple Correspondence Analysis(
Y( :sex, :marital status, :country ),
Z( :size, :type ),
Cross Table( Total %( 0 ), Show Total( 1 ) ),
Cross Table of Supplementary Columns( Total %( 0 ), Show Total( 1 ) )
);
objCat = dt << Categorical(
Structured( :size + :type, :sex + :marital status + :country ),
Share Of Responses( 0 ),
Share Chart( 0 ),
Legend( 0 ),
Total Responses( 0 ),
Force Crosstab Shading( 0 )
);
rpt1 = obj1 << Report();
rpt2 = obj2 << Report();
rptCat = objCat << Report();
rpt1[Outline Box( "Contingency Table: Supplementary Columns" )] << Set Open();
rpt2[Outline Box( "Contingency Table: Supplementary Columns" )] << Set Open();
actSupColCount1 = rpt1[Outline Box( "Contingency Table: Supplementary Columns" )][GridMultiCellBox( 2 )] << Get Text;
actSupColCount2 = rpt2[Outline Box( "Contingency Table: Supplementary Columns" )][GridMultiCellBox( 2 )] << Get Text;
actSupColCountCat = rptCat[Outline Box( "?+type" )][GridMultiCellBox( 2 )] << Get Text;
Code Explanation:
- Open data table;
- Perform MCA on selected columns.
- Select rows 19 to 303.
- Exclude selected rows.
- Perform MCA again on modified dataset.
- Create categorical analysis.
- Generate report for first MCA.
- Generate report for second MCA.
- Generate report for categorical analysis.
- Extract specific text from reports.