MindMap Gallery JMP script reading notes mind map
An article about JMP script reading notes mind map, JMP software script notes, recording functions and instructions. It is full of useful information. Friends in need should quickly collect it!
Edited at 2023-11-24 09:50:52This is a mind map about bacteria, and its main contents include: overview, morphology, types, structure, reproduction, distribution, application, and expansion. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about plant asexual reproduction, and its main contents include: concept, spore reproduction, vegetative reproduction, tissue culture, and buds. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about the reproductive development of animals, and its main contents include: insects, frogs, birds, sexual reproduction, and asexual reproduction. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about bacteria, and its main contents include: overview, morphology, types, structure, reproduction, distribution, application, and expansion. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about plant asexual reproduction, and its main contents include: concept, spore reproduction, vegetative reproduction, tissue culture, and buds. The summary is comprehensive and meticulous, suitable as review materials.
This is a mind map about the reproductive development of animals, and its main contents include: insects, frogs, birds, sexual reproduction, and asexual reproduction. The summary is comprehensive and meticulous, suitable as review materials.
"JMP Script Study Notes"
3. Programming basics - operators
Logical Operators
JSL language elements
Special cases of comparison tests
all/any/is missing
Missing values
For most comparisons and logical operations, missing values also propagate missing values. Except OR and AND.
Explanation of missing values: When the value of the data cannot be known, it can be considered as missing values, or all possible values can be considered.
Note: You cannot compare directly with explicit missing values, only with variables, matrices, or other values that may contain missing values. For direct comparison, use missing or zero or missing
Only numeric missing values are considered missing. Missing character values can only be treated as strings of length 0, not as missing values.
short circuit behavior
JMP's comparison operators and logical operators are short-circuit operators, that is, they will stop working as soon as the result is returned.
It should be noted: ① When the latter parameter depends on the previous parameter. ② Overly cumbersome calculations lead to calculation errors in JMP. ③When depending on the last parameter to be executed. Be careful about placing assignment statements so that they are not placed inside expressions that never execute.
date operator
Date and time operators
Date/time data is handled internally as seconds since midnight on January 1, 1904.
construction date
Use Date DMY(1,12,2003),today()
Extract date part
For example, day, year, day of week, week of year, time of day, etc.
date arithmetic
Perform common arithmetic operations on date/time data.
Convert date/time units
The operators in minutes, in hours, in days, in weeks, and in years are used to re-express time intervals using units other than seconds.
Query function: Determine what types of data elements you have
To check whether a global variable has been assigned a value, use is empty() The Type function will return a string named the result value type. is scriptable() will check whether the previous result is scriptable.
programming function
1. summary(I=1,50,body), iterative operation, the first parameter is the starting value, the second is the limit value, and the third is the body function, and the loop is executed until the limit value is exceeded. Compute the sum of body functions
2. Normal distribution (p, mean, sigma), returns a normal distribution probability value less than p. If the mean and standard deviation are not specified, the standard normal distribution is considered.
3. Use the debugger, the first line is /*debug run*/, or /*debug step*/.
4. Comprehensive expression
The glue or ; semicolon operator evaluates each argument consecutively and returns the result of the last argument. The semicolon is a terminator in other languages, but in JSL it is only a binary operator used to combine expressions. The result returned is the rightmost expression result.
First function first is similar to glue function, except that it returns the first parameter instead of the last parameter.
root(n,《a=2》) returns the a-th root of n
5. Iteration: JSL provides For, while, summary and product to iterate operations according to specified conditions.
For(init,while,iter,body), the function for will calculate the init expression, but only once. The while expression is then tested. If not true, it breaks. As long as while is true, the body and iter expressions are executed.
Confusion warning! If you have learned C, pay close attention to how JSL and C use semicolons and commas difference. In JSL, For is a function that separates parameters with commas and then concatenates them with semicolons. function; in C language, for is a function that uses semicolons to separate parameters and then uses commas to connect their special clauses.
while(condition,body), while is a function related to for, it can repeatedly test the condition, and as long as the condition is true, its main script will be executed.
Find the smallest power of 2 greater than x x=287; y=1; while(y<x,y*=2);show(y);
summation(initial argument, limit argument, body expression) returns the sum of the calculated values of the body expression, each time increasing the variable from the initial argument until it is greater than or equal to the limit argument.
Product is similar to summation, except that it multiplies the main results instead of adding them.
6. Conditional functions: JSL provides 5 functions to conditionally execute scripts, including IF, MATCH, CHOOSE, interpolate and step
if (condition 1, result 1, condition 2, result 2..., else result), calculate the conditions in order until the first non-zero result is returned, and return the corresponding result statement, otherwise will return elsesult results.
Note: This function will continue to evaluate if at least one condition evaluates to missing, and will only return a missing value if none of the clauses evaluate to true and at least one condition returns a missing value (instead of Compute else result clause). The solution is to add a condition at the end that is always true.
y = Match(x, v1, expr1, v2, expr2, ..., exprElse) finds the first vN parameter equal to x and calculates and returns the corresponding exprN parameter. If there is no value equal to x, calculate and return exprElse parameter.
y=choose(i, expr1, expr2,..., exprElse), calculates and returns the i-th expr parameter. If there is no i-th expr parameter, calculates and returns the exprElse parameter.
interpolate(x, x1, y1, x2, y2, ....) or interpolate(x, xmat, ymat) will linearly interpolate the y value corresponding to the given x value between two points.
It should be noted that the x points need to be arranged in ascending order
step(x, x1, y1, x2, y2,...), calculates the y corresponding to a given x through step function fitting instead of linear fitting between points. It will return the maximum value less than or equal to x. The yi parameter corresponding to xi.
It should be noted that the x points need to be arranged in ascending order
7. Catching exceptions
throw() function, the script will stop running on its own. If you want to skip an error-prone part of your script, you can include it in a Try() expression. try(expr, "catchexpr"), when the first expression raises the expression by evaluating throw, it will immediately stop evaluating the first expression and return no result, and evaluate the second expression.
8. Macro function
Stored expressions can be used as macro functions. Use expr to store expressions to delay evaluation until the global variable is actually called
9. Local function function
Function({x},expr) specifies local variables in {} and declares expressions directly.
After calling a function, JMP evaluates its arguments and assigns them to the local variable specified by the first argument in the list. JMP will then evaluate the body of the function, which is the second parameter
Local symbols: Variables can be defined as local to a function so that they do not affect the global symbol space. Such functions need to place the values of local variables separately at each level of function call calculation.
functionName=Function({arg1, ...}, {Default Local}, body);Default Local is used to localize the name.
Recursive recurse(x1) calls the defined function recursively until the recursive condition is reached.
factorial = function({a},if(a==1,1,a*recurse(a-1))); This function is to calculate the factorial of a, a*a-1*a-2*...*1
The Local function allows you to handle local variables without affecting the surrounding namespace, for example, the called script has a variable with the same name as the global variable. The general form is: Local({list_of_variables_or_assignments}, body ); all names in body will be parsed locally.
The include function is used to open a script file, parse the script, and execute the script. Generally means include ("pathname" <<<parse only>)
Loading and saving text files load text file ("PATH") and save text file ("Path", text) can be used to process text files in JSL.
XML parsing operation---unknown on time,
Dynamic link library DLL file, JSL has three commands to load the DLL and then call the functions exported by the DLL.
10. Main menu commands (only available for Windows)
main menu ("Command" <window name>) Note: Use English, not Chinese, ah ah ah ah
Lists and expressions
A list refers to an object that is used to store multiple items of different types, including numbers, text strings, expressions, matrices, and even other lists. A list is just a function list with parameters. list returns uncalculated values. eval list returns the calculated
list assignment
{a,b,c}={1,2,3}; {a,b,c} =10, {{a},{b,c}}, abc increases by 1 -- decreases by 1
JMP supports any structure of the list as long as the arguments are consistent and ultimately numeric.
Number of items in the list, N = N items(A)
ListThe following table is used to extract specified items from a list. The first element is [1].
If the list is an assignment list or a function list, you can also use quoted names as subscripts: X={a(1),b(3),c(5)}; show(X["a"]);
Find an item in a list. LOC(list, value) returns the subscript matrix of all values in the list that are equal to value.
Store scripts in global variables. The main use of expr is to store scripts (like macros) in global variables.
For example dist=expr(distribution(column(height)))
If you execute a script, you only need to use dist;
Only at the outermost level of the formula can eval work.
nameexpr looks for the expression stored in its argument. But it does not calculate, and only unwraps one level to get the expression.
Perform multiple substitutions, xstring = "def", eval insert("abc^xstring^ghi"), the result is "abcdefghi".
An expression that evaluates a list, eval list (list) in which all items are evaluated.
Evaluates expressions within expressions. eval expr is used to evaluate expressions within other expressions, but returns the expression including the result. And eval evaluates the expression within the expression, and then evaluates the expression.
Parse strings into expressions and vice versa.
Parsing only involves scanning strings into language expressions according to grammar. Suppose I have read a valid JSL expression into a string and now want to evaluate it, the function parse will return the expression. To calculate it, use the Eval function.
Otherwise, use char to convert the JSL expression into a string. For example: y=char(expr("a=1")). In addition, char also allows setting field width and decimal place parameters.
To convert a string into a numeric value, you need to use num
Processing lists/processing expressions
Positional operators: refer to operators that can act directly on lists or expressions. They all have from or into in their names. The first parameter of a positional operator must be an L value, an entity (such as a global variable) whose value is set.
Non-positional operators: Must declare the list directly or refer to a name that can be used to calculate the list. The name does not contain from or into. The processed list or expression will be returned without changing the original list given in the first argument.
Substitute: Both substitute and substitute into can be used to find all items that match a pattern in a list and replace them with another expression. These parameters need to be quoted using expr.
name expr will look up the name and copy it, but not evaluate it
substitute will calculate all parameters and must be quoted correctly
substitute into requires an L value, so the first argument is not referenced
Operators for lists
name resolution
The following object types can be identified by names: 1. Column variables and table variables in data tables 2. Global variables in the session. 3. Scriptable object types 3. Parameters and local variables in formulas
Confusion warning! The current row of the script is the same as the row or data table to be selected (highlighted) in the data table The current cursor position in the window is not relevant
Name binding rules
1. If the name is followed by a pair of parentheses (), it can be regarded as a function 2. Then treat it as a local variable 3. If the prefix is not:, it will be regarded as a global variable 4. If the prefix is not::, it will be regarded as a data table column or table variable. 5. Then, treat it as the platform launch name (e.g. distribution, binary) 6. Then, if it is used as an assignment target (as an L value), a global variable is created and used.
When an unscoped name refers to a table column
When an unscoped name is reparsed, it refers to a column in the data table rather than a global variable.
If the data table has a table variable with that name, that table variable takes precedence
The column scope operator can be used to force names to be resolved into columns
1. Prefix colon: indicates that the name can only refer to table columns or table variables, but not global variables. Prefix: refers to the current data table context.
2. Infix colon: Specify which data table contains the column by extending this notation with a data table reference. Equivalent function as column(data table ref, name), e.g. currentdatatable():name
global scope operator
The global scope operator can be used to force names to be resolved into global variables. The prefix double colon: indicates that the name can only refer to global variables, not table columns. , equivalent function as global
Scoping occurs before using subscripts
Function parsing rules
The name followed by a parameter list in parentheses is the syntax used in many situations in JSL: 1. Built-in function calls. 2. Custom function call, 3. Named parameters. 4. Nesting of objects in scripts, either as options with parameters, as sub-objects containing messages, or for any other purpose identifiable by the object itself.
4. Application-User and JMP communication
Communicate with users
show displays the specified items in the log. Note: The generated message includes the variable name, colon:, and its current value.
print sends the specified message to the log. Note: Only the value of each variable is output, without the variable name and colon.
write sends the specified message to the log. It suppresses quotes outside text strings and does not start a new line unless carriage return (\!r) representation is specified.
wctch draws a window reporting the values of listed global variables. Use the specified parameter ALL to observe the values of all global variables watch(a,b),,,watch(all)
beep causes the user's computer to emit a warning sound
speak read text aloud
Caption pops up a small window that displays a message to the viewer. The first parameter is the {x,y} screen position in pixels (from the top left corner). The second parameter is the text used for the window. The delayed(n) setting will delay the title and all subsequent title windows for this number of seconds until the caption statement sends another delayed. delay(0) can completely stop the delay.
NOTE: Each new Caption will hide the previous one, i.e. only one Caption window will be available at a time. To close the caption without displaying the new one, use the specified parameter Remove,caption(remove).
statusmsg("string"), this command sends a message to the status bar.
wait(n), a way to slow down script playback. Pause for the specified number of seconds before continuing to process the script. System tasks can still be run while waiting. For example, wait(0) allows the results to be displayed immediately; otherwise JMP will wait for the script to end before letting the system update the window.
send email for warning
schedule(time,script) schedules an event to execute the script after n seconds
Open the specified link on web
Get information about an object
show globals lists all global variables defined and their current values
show commands displays a list of all JSL operators in the log
show properties() lists actions sent to scriptable objects
host is() query operator, returns a Boolean result, identifying the current operating system
jmp version() returns the JMP version as a string
dialog box
Divided into modal dialog boxes and non-mode dialog boxes, modal dialog boxes must be answered immediately. Modeless dialog boxes are similar to JMP reports and do not require an immediate reply.
dialog function, the dialog is modal, which means that the user cannot choose, but can only respond to the dialog box.
The new window command constructs a modeless dialog box
Use the built-in dialog box and ignore the required JSL command arguments for the task.
Use the pick dialog
pick file() locates the path information of the file and saves it as a string
The pick directory() command has an optional string displayed as a prompt message
files in directory(path), get the list of file names in the specified directory
common modal dialog box
dialog and column dialog, dialog creates a new dialog box, and column dialog allows the input of column parameters and associated variables of the data table
arrangement
Hlist top aligns and separates its content horizontally. The Vlist will left align and separate the content in vertical columns.
Assign dialog to a variable. JMP will store the list returned by the dialog function in the variable. If the variable is called, the list will be called instead of calling Dialog.
Unload results from the dialog box. Use removefrom to eliminate unnecessary results.
Script method to set JMP preferences
To view the preferences, show preferences(), the all parameter can view all preferences, nonedefault can only view the non-default value preferences, or platform to view the preferences for the platform.
5. Data table
Introduce how to manage data objects: data tables, data columns and rows
Get data table object
Open data table
Open commonly uses path parameters. If there are no parameters, a dialog box will be displayed to prompt the user to locate a file.
..\ can move a folder up one level
Import data from text file
complex
Open database
open database Use ODBC to open the database and extract data to JMP data table
Create new data table
1. dt=newtable("my.jmp")
2. Create a new data table to avoid windows and use the invisible keyword. For example: dt = newtable("abc",invisible,newcolumn("x"),addrows(10))
Objects and Messages
Objects are entities that are created and know how to perform tasks related to themselves. A data table is such an object.
To handle an object in JSL, send a message to the object and let it perform one of its tasks. Messages are commands that can only be understood by objects of a specific type depending on the situation. For example, messages for data table objects include save new column sort, etc.
Data table reference
Reference an open table
Send message to reference
Use the << operator to send a message to an object, which is also the Send function
A series of messages can be stacked in one statement
Run the script to recheck the data table
After the run script command is sent to the data table, it will first find the specified property (that is, the script) and then run it as a JSL script.
Close data table
Use the close command with a data table reference as a parameter.
Restore saved data table
To revert to a recently saved data table, send a Revert message to the data table. Before restoring, you will be asked whether to save the current data table.
Count of open data tables
NTable() can return the number of open data tables
Why do some commands need to be sent to objects while others are used directly?
The New Table and Open commands are used to create objects that do not exist. Once created, these objects know what to do with them, so you can send them messages requesting changes. To close such an object, a command must be used on its container, since objects cannot delete themselves. Close is such a command.
Access data table values
Current data table
Use current data table(name) to make this data table the current data table.
current row
The current row is determined by the value of the pseudo variable of row(). You can assign a value to row(), or you can use the iteration command for each row()
Selected columns
Get a list of selected columns
Select row
To select certain rows, use select rows
Set or get a value by column name
To set the column name of the cell in the current row, please use an assignment statement.
If you want to get the value, just specify the name,
If setting a specific row of a column, rather than the current row, use the row number as a subscript.
Confusion warning! Note that the subscript must be a row that exists in the table. The default line number is 0, so something like :name Languages that reference line 0 in this way will generate an invalid line number error.
Example
table row iteration
What is the current line?
By default, the current line number is 0. The first row in the table is row 1, so row 0 actually exists
row(): operator gets or sets the current row number.
how many rows and columns are there
Nrow and Ncol operators are used to count the number of rows and columns in a data table.
data table message Details on the messages that can be sent to data tables
Name, save and print
set name can be used to specify a table name, or change it to a new name
Names can be retrieved
You can also specify the file name as a parameter to the save function.
Print data table
Log and layout
No need to know at the moment
Create and delete columns
Create new column
To add a new column to an existing data table, please send a NEW column message to the data table reference.
Use the pop-up menu to add multiple columns (prefix name, number of columns, insertion position, data type)
Delete column
Use Delete columns to specify the columns to delete. To delete multiple columns, please list the columns as multiple parameters or lists.
Column reordering
For each row
To iterate a script over each row of the current data table.
dif and lag
Lag returns a value listed n rows before the current row
Dif returns the difference between the value in the current row and the value in the previous n rows
Compare two data tables (example)
See learning script for details
Summarize
This command mainly collects summary statistics of the data table and stores them in global variables, while summary collects summary statistics and displays them in a new data table.
by, grouping basis, formulates the grouping column. The calculation result is always a matrix when the By clause is used, and always a scalar when the By clause is not used.
Count, count, does not require column parameters, but is usually used to specify a column to count the number of non-missing values.
sum, sum, specify column name
mean, mean, specify column name
min, minimum value
max, maximum value
stddev, standard deviation
quantile, quantile, can also specify parameters to specify the quantile, such as 0.1 represents the 10th percentile.
NOTE: exclude rows are excluded from summary calculation
Process metadata
Definition: Metadata includes information such as data sources, comments about each variable, scripts used to process the data, column analysis roles, etc.
table variable
Used to store a single text string value, such as a comment in "Taiwan"
get table variableget table variable
set table variableset table variable
Properties/Scripts
The properties are similar to table variables and are mainly used to store expressions, such as JSL scripts.
For example, to perform an analysis and use the Save Script to Data Table command in the report pop-up menu, the script specified by the analysis platform will be saved in the data table.
Have new table property, set property, get property messages for JSL
Delete variables, properties/formulas
Assume there is a data table dt or column col, in which the property or variable is name, then the following command deletes them
on open nature
When the data table is opened, the On Open script stored as the data table property will be automatically executed.
As a precaution, you should consider suppressing automatic execution when opening data tables received from others:
Script to start on startup
Each time JMP is started, a script is run, named JMPstart.jsl, and placed in the Builtin scripts subfolder of the executable folder.
script
Assuming you need a text representation of a data table, perhaps to email to a colleague or to use as part of a script, you can use get script to obtain a script that will reconstruct the information in the data table
Control formula evaluation
The message suppress formula eval accepts a boolean parameter to specify whether to suppress formula evaluation.
If the runtime script relies on columns with values, to force a single column to be evaluated, send the EvalFormula command to that column
dt<<Run Formulas performs all outstanding formula evaluations, including evaluations that have not been performed or that result from evaluating other formulas.
Set value without using formula
col<<Set Each Value(expression) evaluates the expression for each row of the data table and assigns the result to the column. It does not store expressions as formulas.
Control display updates
Any time you change a value in the data table, the system sends a message to the display location to keep it updated. However, when making many changes in the script, the update time will increase.
Please use Begin Data Update to prevent these update messages from being displayed before making changes. and use End Data Update to publish the message and update the display position after completing the changes
Resize data table
dt << Maximize Display forces the data table to remeasure all columns and scale to the optimally sized window.
Convert between matrix and data table
get as matrix will create matrix A based on the values of all numeric columns in the data table
The as table(matrix) command can be used to create a new data table based on the matrix parameters. The columns are named col1, col2, etc.
Get All Columns As Matrix Returns the values of all columns in the data table in matrix form. Character columns will be numbered horizontally, starting at 1.
set matrix creates a data table, thereby creating the new rows and columns needed to store the matrix values. New columns are named col1, col2, etc.
Commands in the line menu: This section explains how to process messages for rows in a data table
Row messages point to data table references, and most only affect the currently selected row. Many line messages are generally of no use in scripts unless you are writing a script that simulates the interactive use of JMP.
Add row
Use the add rows message to specify the number of rows and after which row to insert
Use a variant of Add rows to specify parameters that generate a list of assignments. Assignments can be separated by commas or semicolons
You can send multiple parameters to generate multiple lists, or even a list containing multiple lists.
Delete row
To delete rows, send the delete rows message and specify the rows to be deleted. To delete multiple rows, provide a list or matrix as argument. Without parameters, the currently selected rows will be deleted. With no parameters and no rows selected, delete rows will do nothing.
Common way to delete bottom x rows of any data table
Select row
select all rows selects all rows in the data table.
Invert Row Selection, inverts the selection state of each row
go to row select a row
Select currently exclude/hide/mark rows
To select non-excluded/hidden/marked rows, stack the select message and the invert-select message in the same statement
To select rows based on data values, use select where and specify logical tests in parentheses. You can use common calculator functions and operators.
The select rows command selects specific rows in the data table based on row numbers. The parameter is a list of row numbers.
Random selection, random selection according to a certain proportion
subtopic
Select Matching Cells selects rows that match the value of the selected row for the currently selected column
Move row
Move the currently selected row to the specified target point
Find row
Returns a matrix of row numbers
Assign colors and labels to rows
The colors and markers messages can set or change the colors and markers used for rows.
Like other line messages, can optionally be stacked with other messages
color by column(:name)/marker by column(:name) sets the color and mark based on the specified column value
Toggle row status
hide
exclude or mark
Note: Messages can be switched. Sending the message again means undoing hiding, undoing exclusion, etc.
Locate selected rows
Next Selected and Previous Selected scroll the data table window up or down so that the next selected row that is not already in view moves into view
Clear selection
clear select cancels the selection, that is, does not select any rows
Process row status
Row status is a special type of data.
Commands in the table menu:
The messages in this section mainly provide a variety of methods for rearranging data tables and making new tables. If no parameters are provided for these messages, common dialog boxes for interaction will be generated.
sort Reorders table rows based on the values of one or more columns and replaces the current table with the results or creates a new table
transpose Create a new data table by transposing the data table, that is, converting rows into columns and columns into rows Note: If no row is specified, the selected row is used; if no row is selected, all rows are used.
If no parameters are specified, the dialog box will be opened.
summaryCreate a table of summary statistics based on the selected grouping column
Note: summary is different from summary. Table columns are created and stored in global variables.
stack Stacking, combining several columns into several rows of one column
split splits a column into multiple columns, first mapping several rows to single rows of other columns
Note: Splitting is not understood in the conventional sense, splitting one column into two columns and aligning them. It is understood that according to the splitting basis as the column name, the column that uniquely identifies the row is used as the row identifier, a table is created, and the columns to be split are filled in it. If the label line is not specified, it will be arranged in order, which is the conventional understanding.
subset creates a new data table based on the specified rows, that is, creates a new subset. If no rows are specified, the selected rows are used, if no selected rows are used, all rows are used
The corresponding row status can be changed in advance
join Horizontal merging, that is, connection operation
You can use Cartesian join, that is, combine two records. Assume that the first table has N records and the second table has m records, then m*n records are generated.
concatenate vertical connection, that is, splicing
Process columns
This section explains the various ways to set, create, and modify columns
Get column names
column name(n) returns the name of column N
Note: The return value is a name value, not a quoted string. This means it can be used anywhere in the script where the actual name would normally be used
To make the name a text string, just surround it with char
get column names retrieves a list of the names of all columns in the data table
Get selected columns
Move columns
data column object
Just like sending data table messages to a data table reference, you can also send column messages to a data column object reference.
The column function returns a data column reference. Its parameters are quoted name/evaluates to the contents of the name
Use show properties to learn about the messages that can be sent to a data column object
Access cell value via column reference
Use subscripts in column references to access values in cells. Usually use an empty subscript to refer to the current line
Send message to column
Similar to sending a message to a data table, declare the object, the double-angle operator <<, and then the message, enclosing the parameters in parentheses. Or use the send function.
Messages can be stacked or listed
Set and get properties
You can use messages that correspond to data table columns to control various properties or characteristics of the column, including its name, data, and metadata.
For example, hide, exclude, label, and scroll lock can be activated through scripts. 1 means turning on the column attribute, and 0 means turning it off.
Represents scroll lock, which locks the column to always display in the first column position
To undo a column selection, submit a clear column selection message to the data table
name
set name can name or rename columns, get name is used to return column names
value
set values is used to set the value of the column. If the variable is a character, the parameter should be a list. If numeric, this is a matrix (vector). get values returns values in list or matrix form, get as matrix is just a synonym.
value label
Value labels provide a descriptive labeling method for displaying abbreviated data
First, use two lists
Second, use a pair list
The third way is to use assignment list
Finally activate the value labels by sending them as messages to the columns using use value labels
Data and modeling types
You can use JSL to set or get the data type of a column. Options include character, numeric and row state
You can set or get the modeling type of the column. The options are coninuous, nominal, ordinal, etc.
Change the data type of a column, specify its format
display format
format messages control numeric and date/time formats. The first parameter is a quoted string from the list of formatting options in the Column Information dialog box. Subsequent parameters depend on the selected format
To get the current format of a row, submit a get format message
Preselect roles
Characters can be pre-selected. Options include none, x, y, weight, and freq. get role returns the current settings
formula
Can set, get and calculate column formulas
Note: Be sure to add commands to evaluate the formula so that the values of these columns are used in the script.
To force the evaluation of a single column, send the eval formula command to that column. This operation can be performed even in the create column command, after the formula clause.
In fact, it is better to wait until you have added a set of formulas and then use the run formulas command to evaluate all the formulas in the appropriate order.
In contrast, the run formulas command is preferable to eval formula because eval formula does not inhibit the re-evaluation of the background task when evaluating the formula. Run formulas only calls this task after all formulas have been evaluated. That is, run formula can avoid secondary evaluation in the background.
Range checking and list checking
List checking and range checking properties can be handled using JSL.
List check: list check
Values outside the range will be designated as missing values
Submitting an empty list check will clear the list check status
Range check range check requires fixed syntax to specify the range
Note: NOT can be added before the LXLX operator, L is the abbreviation of less, e is equal, and T means no equal sign.
Specify age column >=12
To retrieve a list check or range check assigned to a column, send a get list check or get range check message to the column
Please note that you can also use Set Property, Get Property and Delete Property to set, retrieve and remove list checks and range checks. i.e. set column properties
Set, retrieve, and remove column properties
There are a large number of optional metadata properties in the data column. These properties can be set, queried or cleared using get property, set property/delete property messages.
The name of the property involved is always the first argument to Set Property, while the second argument depends on the property being set. Get Property and Delete Property always take a single argument, the property name. Get Property returns the property settings, while Delete Property removes the property from the column entirely.
If you want to set multiple properties, you need to send multiple separate Set Property messages. If desired, multiple messages can be sent stacked in a single JSL statement.
To get a property value, send a Get Property message whose argument is the name of the desired property
locking
To lock and unlock a column, use lock or set lock with a Boolean parameter. get lock returns the current setting.
Lock a column so its value cannot be changed
script
get script returns a script used to create the column
row status operator
Row status is a set of six attributes that all rows in the data table have
Functions implemented by row status
How to assign row status
1. Manual--
2. Numerical method: Set the row status using an expression whose calculation result is the row status value.
How row status works
Most row states (exclude, hide, mark, select) are boolean, that is, they are on or off, that is, 1 or 0. Marking includes 0~15, and color options are 0~84, where 0~15 is basic Color, 16~31 is for darkening of the same color, 32~47 is for brightening, 48~63 is for darker, 64~79 is for highlighting, and 80~84 is for gray.
Row status column and effective row status
The row status column is neither numeric nor character, just row status. And it only stores the row status information, but does not make the information effective.
Row status operators overview
In JSL, you can use the Row state operator to directly get or set the row state. row state(n) can get or set the status of the nth row. If no arguments are given, sets or gets the current row.
To set the current state of a row, please use row state() on the left side of the assignment
To copy several, but not all, current row statuses to the row status column, use a script like the following
where color of is the value that returns the corresponding row status
Feature combination
Multiple state settings are combined by combine states, and the final row state is feature accumulation.
Get the row status of a row
Row status columns can also have multiple characteristic row statuses as their values
Some operators set one feature but eliminate others
color state sets color row state
combine states merge features
excluded state exclude row status,
hidden state hidden row state
hue state returns the row state value with the hue state portion set to the specified value. Need to be used in conjunction with shade state to display effective colors
Shade state returns the row state value with the color light and dark state part set to the specified value. It needs to be used in conjunction with hue state.
labeled state label row state, label of data row
marker state Mark row state, for example, the point becomes ×
selected state selected row state
Other operators set or get features one at a time
A row state knows not one feature, but many features.
color of returns the color component of the specified row status. If it is an L value, it will change the color of the current row of the current data table.
Also includes excluded, hidden, labeled, marker of, selected
Get row status
Place the row status expression to the right of the assignment
Access only a certain part of the row state
Set row status
To access row status, place the row status expression to the left of the assignment (the L value)
Set row status
Set row status combination
Use combine states to gather settings for various states together
Create row status column
Create row status directly in column
Validate row status in column
Details of each row status operator
Exclude, hide, mark and select
This section describes Boolean states, i.e. switching conditions
excluded, hidden, labeled and selected set selected indicators
Its parameter is row state()
Excluded state, hidden state, labeled state and selected state perform opposite operations Gets a row status value or sets a row status condition to true or false based on a parameter.
The above command replaces the current row status with excluded or hidden, etc., and the previous row status will be lost.
Colors and markings
color of returns or sets the color indicator
marker of returns or sets the marker indicator
Color State and Marker State are similar to Color Of and Marker Of, but in opposite directions. The -Of function converts the actual state into an indicator, while the -State function converts the indicator into a state.
If using RGB values, there should be a list for each color, with percentages in red, green, and blue order.
Hue and Darkness
The hue state, along with the shade state, is an alternative to the color state for picking colors.
Hue and Shade do not have the "-Of" operator. Color Of returns the equivalent Color State pointer to the color row state. icon where the state has been set using Hue State and/or Shade State.
The As Row State operator assigns row status through internal numeric codes. This operator simply converts an integer Convert to its equivalent row state
You can use the Set Row States command to submit a code matrix for one-time row state assignments.
calculate
This section explains the functions for precomputed column and row statistics and demonstrates how JSL expressions work behind the scenes in the JMP Formula Calculator
Precomputed statistics
JMP has col maximum, col mean, col minimum, col N missing, col number, col quantile, CV (coefficient of variation), col standardize, col std dev, col sum, maximum, mean, minimum, Nmissing, number, std dev and sum function, these are precomputed functions
Note that precomputed functions ignore excluded row status, so the calculation will include any excluded rows. To follow summary statistics of row exclusions, you can use distribution platforms.
column function
Functions whose names begin with col all work column-wise, or down through the values in a specified column, and return a single number.
row function
Functions listed without "col" work row by row across the values of the specified variable and return column results.
calculator formula
JMP can edit formulas in a structural manner. There is no difference between formula columns created through the calculator window and formulas created through JSL using commands like New column(..., formula()) or col<<formula()
Grammar reference
data table operator
Data table object message
Metadata table object
line command
Data table message for selecting rows
Message for rearranging data table
Data table column message
row status function
Precomputed statistics by column
Row-wise precomputed statistics
6. Platform Create, repeat, and modify analyzes
Explanation: The platform results are located on two levels: the platform itself, which contains the analysis results and corresponds to the analysis commands; and the demonstration display, which corresponds to each set of commands. The third object is the data table itself, which can be included in the current analysis.
For example: 1. Add to the analysis, such as fitting a new line, and send the command to the platform 2. Expand the graphics box and send a command to the display. 3. Highlight the points of certain rows in the data table and send a certain row status command to the data table.
The notation used in this chapter is that uppercase displays the names of command words that need to be used as is, and lowercase displays arguments that are placeholders for actual options.
Launching the Platform Interactively and Obtaining the Equivalent Script
That is, start the platform and save the script. where menu option commands always appear as Boolean options
Platform script syntax
The beginning of all platform scripts is the command used to call the platform, here is oneway. Within the oneway command are two parameters, parameters such as the Y and X column role lists required at startup, and options such as quantiles (1) are Send to the platform after starting the platform
Most options are on/off options with or without a selected mark. The equivalent script with or without the selected mark is a boolean parameter of 1 or 0. Other commands cause various dialog boxes to pop up, where you can specify values or make selections. In a script, such specifications are specified within parentheses and separated by commas, usually in the same order as they appear in the dialog box (top to bottom, left to right).
Send script commands to running analysis
Another syntax is needed to send messages after starting the platform to control the running platform, by send or the equivalent operator <<
First we need an object addressing method
The first and simplest method is to start the platform from a script. The script will assign the object reference to the global variable.
The second method is to assign the value by using a subscript to reference the platform name. This method is suitable for started platforms.
Command and parameter conventions
1. You can ignore the parameters of the Boolean option to switch the state
2. If the menu provides several options separated by commas or slashes, such as means/anova/T test, you can use any command. If several commands have the same alias, the first command takes precedence over the scripting language.
3. If the display is changed, such as adjusting the graphic size, it will not be reflected in the saved script. The saved script only records options related to analysis and does not record demonstration details.
4. If the submenu item represents a command rather than a setting, the corresponding script is the menu item itself without a parent. For example, One-Way Analysis has the menu item Non-parametric and has three commands in the sub-menu, including the Wilcoxon test. In the script, only the sub-item name will be used.
5. If the submenu item is a set value rather than an independent command, provide the parent item in the script and the submenu option as its parameter.
6. The script returned from the platform usually looks different from the script written by yourself. For example, you can use a simple script to start the function, distribution
Send a few messages
To send several messages, you can add more << operators or more Send parameters
Because << is an ignore operator, it merges parameters and works differently than when combining parameters. You can use additional << symbols to stack multiple messages and execute them all in order (from left to right).
You can use grouping parentheses to send a message to the result of sending the message. In this case, the associated grouping has no order.
Another way to stack messages is to send a list of messages
Understand the messages to which objects respond
1. Try the program through the interactive interface, then study the saved scripts.
2. Research the interface in the platform window, and the menu items of the pop-up menu and the status menu have equivalent JSL with the same name and parameters.
3. Go to the "Index" tab in the "JMP Start Page" window, click the "Object Button", find the required object type, and click the corresponding list item.
4. Show properties (object ref) lists all messages that the object can receive in the "Log" window
How to interpret the list generated by show properties
[Sublist] refers to a set of commands placed in a submenu.
[Boolean value] is used to close and open options. Their parameters are usually 1 or 0. If no parameters are specified, the opposite state will be switched.
Actions and New Entity are general-purpose commands that typically result in a dialog box in the user interface being displayed. There are no specific standards for the parameters of the operation. You can try the project in the interface first, and then study the scripts saved by the platform.
[Operation Selection] and [Enums] parameters have specific sets of options.
launch platform
Specify column
If you want to use an expression that will be evaluated for the column parameters, put the name inside the Eval or evallist function
The column parameters of the platform startup script can also be a list with curly brackets { }, so the following scripts are valid
Platform execution command
After sending the command Action to the platform, it just evaluates the expression, no matter what it is. This command allows continuous invocation of the platform.
A total of four platforms are allowed,
Invisible report
Platform startup allows the use of the invisible option, which suppresses the display of windows. Using this option in a model fitting script suppresses the model dialog box and results window.
An error occurred in this instance...the reason is unknown
The invisible option also applies to "Table" menu operations, suppressing window creation (not just hiding). But after using the data table for the first time, it automatically deletes itself when closing the analysis that uses it.
title
Add the title command to the startup request to specify the title.
by group column
In most platforms, a platform can be run repeatedly across one or more subgroups of rows defined by columns.
How to launch a platform using By group and extract results from individual groups
Among them, J(NR,NC,VALUE) creates a matrix of the same elements.
The reference of the platform report is from the display box >> report subtitle >> row number
The where clause is related to saving scripts related to the By group
When saving a script based on a By group, a where clause is added showing which group is used.
Scripts for the entire analysis window, which are linked together
If you submit this script, the same analysis as the By group script will be regenerated, except that the results for each group will be displayed in a separate window. You can use new window and Vlist box to glue the results together
The where clause is applicable to all platforms that support By group processing, and any JSL expression can be its parameter
Analyze objects within objects
Some platforms have substructures that also have objects inside them that are addressable via the internal Send operator.
Common commands for platform windows
The save script command works on almost all platforms
The report command can access the display surface and control appearance information.
First obtain the display frame tree reference, use the subscript to locate the outer frame, and then send a close message to it
platform specific scripts
This section explains the scripting conventions that apply to each JMP platform, in the order in which the Analysis and Graph menus appear. The following terms can be used interactively depending on the focus: command, option, message
by
By parameter is supported on almost all platforms
title
The Title command is available in all platforms and will replace the title
axis
Many platforms mention that messages can be sent to axes within the platform, and the value axis
Test design
Not needed yet
Distribution
Distribution has two layers of objects, Continuous distribution and Nominal distribution objects.
Start mode
The first, basic startup, applies the same options to many variables
The second, detailed startup, each column can be analyzed using different options
The launch platform returns an object reference to the Distribution Analysis collection. References to the Distribution platform can use variable numbers or variable names as subscripts
Options for continuous distribution
quantiles, quantiles, Boolean parameters
moments, summary statistics, boolean parameters
more moments more summary statistics, Boolean parameters
horizontal layout horizontal layout, Boolean parameter
histogram displays histogram, boolean parameter
std error bars histogram option, display error bars, Boolean parameters
count axis histogram option, display count axis, boolean parameter
prob axis, histogram options, display probability axis, Boolean parameters
density axis histogram option, display density axis, Boolean parameter
show percents histogram option, display percentages, boolean parameter
show counts histogram options, show counts, boolean parameters
CDF plot Display CDF plot Boolean parameters
test mean (number), mean test, non-boolean parameter
The mean distribution follows the normal distribution
test std dev (number), standard deviation test, non-boolean parameter
Its standard deviation distribution obeys the chi-square distribution
confidence interval (probability), specifies the confidence interval, non-boolean parameter
Mainly used for hypothesis testing
prediction interval (confidence level, n future observations) prediction interval. You can use Boolean parameters to open the dialog box, or enter startup parameters to start directly.
Its main principle is to predict sampling statistics based on the current probability density function.
tolerance interval Tolerance interval, you can use Boolean parameters, then open the dialog box. Or enter startup parameters to start directly.
The main principle is: fit the probability density function according to the specified distribution, and then predict the sampling statistics
capability analysis (USL (number), LSL (number), Target (number)) Capability analysis, enter specification limit parameters
fit distribution (option) fits the specified distribution, all fits all distributions and compares
ppk capability labeling In capability analysis, switch the label to pp instead of cp Boolean parameter
save (option) save, create a new column in the data table to save
axis settings
There is doubt
histogram color (number) histogram color
Too many, more complicated
Fit y by x
Analyze the distribution of the Y variable based on the value of the variable X
bivariate
The fitted curve can be addressed by subscript curve notation
Messages for sending sub-objects can also be sent directly in the startup statement in the form of a list, after any parameters required by the sub-command.
If you use the group by function to generate curves for the groups identified by the grouping column, the generated script will use a fit where clause to define a subset of each curve. Plotted on the same graph. BY is drawn as two pictures.
Options for fitting functions
show points show points, boolean parameters
fit mean fits the mean line without parameters
fit line fits a straight line, no parameters
fit polynomial (degree) fits the polynomial, and the parameters are power exponents.
fit spline (lambda smoothing parameter) is flexible fitting
fit each value Fit each value, the line passes through the mean of each X corresponding Y set
fit special (xtran(none|log|sqrt|square|reciprocal|exp), ytran (transformation type), intercept (intercept constraint value), slope (slope constraint value), degree (polynomial degree, default is 1))
Special fitting is mainly performed after transforming the X/Y variables. For example, find the natural logarithm of the X variable
fit orthogonal() orthogonal fit
univariate variances, using X/Y samples to calculate the variance
equal variances equal variances
The variance ratio of fit x to y is 0, indicating that there is no error in y
specified variance ratio specified variance ratio
density ellipse (confidence level), draw a normal probability ellipse
nonpar density() Non-parametric density, draw ascending contours according to density.
Supported options
kernel control, displays kernel control Boolean parameters
histogram borders histogram, boolean parameter
paired t test paired t test
This function does not exist in the platform, only JSL has this function
Options for various types of curves
line of fit Whether to display the fitting line Boolean parameter
confid curves fit fits confidence curves, Boolean parameters
confid curves indiv single value confidence curve boolean parameter
line color color of the fitting line
line style Fitting line style, solid line, dotted line, etc.
line width is the width of the fitting line. The parameter is a number.
save predicteds Save predicted values Boolean parameters
save residuals saves the fitting residuals Boolean parameters
remove fit Remove fit, Boolean parameters
oneway
Optional options
quantiles displays quantiles and boxplots Boolean parameters
means/anova mean/standard deviation boolean parameter
/ refers to or, not part of the message
means and std dev() displays the mean and standard deviation, boolean parameters
t test displays the t test report, which can only be used for two levels.
Show options
XAxis and YAxis messages can be used to direct Axis commands to the drawing.
Contingency
Shows how the distribution of categorical responses differs across groups
Options include
mosaic plot displays mosaic plot, boolean parameters
contingency table displays contingency table Boolean parameters
crosstabs display contingency table Boolean parameters
tests show verification boolean parameters
correspondence analysis correspondence analysis Boolean parameters
logistic
A logistic fit shows how the distribution of categorical responses differs as a function of continuous variables
Options
Inverse Prediction( Alpha(.05), //Alpha level Response(Probability to be inversely predicted,...))
matched pairs
Analysis shows how paired variable pairs differ in their means
Options include
fit model
Model Fitting Dialog Box
Not needed yet - 231 pages
nonlinear fit
Nonlinear fitting, by least squares or a custom loss function fitting a model defined by a formula with parameters to be estimated
multivariate
Multivariate Analysis: Display Scatter Plot Matrix
partition
Recursively separate data based on the relationship between Y and x, creating a decision tree
discriminant
Discriminant analysis, classifying multiple y values into various groups of x values
Options
PLS
Partial least squares, used to predict y for multiple x, especially if there are more x than the number of rows
neural net
neural network fitting
Options
hierarchical cluster
hierarchical cluster analysis
The Get Column Names command returns column names as a list of character values. It is useful when doing two-factor clustering, and the names are in the same order as when column clustering.
k-means cluster
k-means cluster analysis for large data sets
time series
Build a time series graph
chart
Plot data for a numeric column or plot statistics
Platform options
Options for each Y
Options for each level
Send the message to the subscripted Y or Level, set the properties of a single y or a single level
Send messages to the X-axis, overlaid Y-axis, or single Y-axis. Here, X Axis refers to the common category axis (defined by shared by all plot cells), Y Axis[i] refers to the i-th Y axis, Y Axis without a subscript applies the command to all Y axes. ch = Chart(X(age), Y(Min(height), Mean(height), Max(height))); ch << (x axis << { axis name("abc"), No Major Tick Mark(0) }); ch << (overlay y axis << show major ticks(0)); ch << (y axis[2] << show major ticks(0));
overlay plot
Overlay several rows or markers on the y-axis based on shared variables on the x-axis
Platform options
To change a specific axis, use the Send operator with Left Axis or Right Axis. To change the selection of a specific variable item, use the Send operator with the name of the Y column.
spinning plot
3D scatter plot
contour plot
Contour map
Options
Grammar reference
7. Display: Creation and positioning results
This chapter explains: 1 Perform graphics programming to draw various elements and create new types of graphics in JMP graphics, 2 Position the display to work with individual items in the report window, and 3 Create a display tree to build a new window with custom results or a custom combination of standard results.
graphics programming
Add scripts for customization in graphics
Example
Add a legend to your graph
Add a legend interactively using the row legend command
Create a new graph from scratch
The graphics script is set in the gragh box command in the new window command
graphic elements
Plot function
The YFunction operator is used to draw smooth functions, YFunction(Sine(x),x)
The contour function is a similar method of representing a three-dimensional function in a two-dimensional space. The last parameter specifies the value of the contour line. It can be a value, a range of values delimited by:, or a value matrix.
normal contour draws the normal probability ascending line for k population and two variables
normal contour is a generalized method for achieving effects such as binary density ellipses
gradient function
Gradient function, fills the graphics with gradient colors of two colors
Get the properties of the graphics box
hsize returns the horizontal size of the graphics box in pixels
vsize returns the vertical size of the graphics box in pixels
xorigin returns the distance from the left to the right of the display box
xrange returns the x value on the left side of the graphics box
yorigin returns the y value of the bottom edge of the display box
yrange returns the distance from the bottom edge of the display box to the top edge
Draw lines, arrows, points, and shapes
The line function draws lines between points
Statement Equivalence
The arrow function draws an arrow between the first point and the second point, arrow({x,y},{x2,y2}) or arrow([x1,x2,x3],[y1,y2,y3])
marker(<rs>,{x1,y1},{x2,y2}....) draws a marker at the specified coordinate position, rs is the shape parameter of the marker, and the coordinates should be a list. At the same time, markersize can modify the size of the markers.
pie draws pie chart sectors, pie(left,top,right,bottom,startangle,endangle)
fill color is the color used to draw the filled area
arc draws an elliptical arc arc(left,top,right,bottom,startangle,endangle)
circle draws a circle using the specified center point and radius, and subsequent parameters specify other radii.
rect draws a rectangle based on the specified diagonal coordinates. Specify four parameter coordinates {left, top, right, bottom} or a pair of lists ({left, top}, {right, bottom}). The fifth parameter is fill, specify 1 or 0, such as rect(1,1,1,1,1)
Any negative fill parameter will produce an unfilled box embedded by a single pixel
oval draws an ellipse in the rectangle specified by the x1, y1, x2, y2 parameters. The fifth parameter is fill, as above, specify 1 or 0
Hline draws a horizontal line across the graph at the specified y value. Vline draws a vertical line at the specified x in the downward direction of the graph
The Y parameter supports drawing multiple lines using a value matrix.
Polygon connects various points and eventually returns the first point, thus closing the polygon and filling the resulting area.
in polygon is used to indicate whether a given point is in the specified polygon
mousetrap, when the mouse is pressed in the graphics and the mouse is not manipulated by other graphics objects, the dragscript expression will be evaluated repeatedly. Before running the script, set the global variable x/y to the mouse value, then restore the initial value. After releasing the mouse, run the mouseupscript expression randomly.
contour uses a coordinate grid to draw contour lines. Given an n x m matrix zGridMatrix that generates values on a surface using n values of xVector and m values of yVector, this function draws the colors defined by zColors defined by the values in zContour contour lines of
Add text
Use text to draw text at a specified location.
color
There are 5 commands to control color
fill color sets the color of the real area
pen color for lines and points
level color returns category color
back color is used to set the text background, similar to erasing the box around the text
<<background color is used to set the background color of graphics
font color for added text
Generate color picker
pick color color picker
If using RGB values, type a list of the percentages for each color, in order red, green, blue.
transparency
In graphics environments, such as frame boxes, use the transparency function to set the transparency level. The parameter alpha can be any number between 0 and 1. 0 means clear and transparent, 1 means completely opaque.
Fill mode
The fill pattern function is now obsolete and has no effect.
line style
Line style can be controlled through numbers 0~4 or names (Solid, Dotted, Dashed, DashDot, DashDotDot), line style (parameter);
For line thickness, use pen size and specify the line width in pixels. Note: For printing, the pen size is considered a multiple of the default line width.
Use pixel controls
First set the Pixel Origin according to the graphics coordinates, and then relative to the origin Pixel coordinates of points using the Pixel Move To or Pixel Line To command. The Pixel command is mainly used to draw random Custom markers for changes in the size or scale of graphics. You can store markers in a script and then call them within any drawing
interactive graphics
The handle and mousetrap functions are used to make interactive graphics that respond to clicks and drags. Another method is to use a button box, slider box, or global box to place buttons or slider controls outside the graphic.
handle, create an interactive graphic that responds to dragging.
If you use a function that handles coordinates, you should adjust the parameters of the handle. Otherwise the handle will escape the mouse
Or use the round function to constrain handle placement with incorrect exponents, such as 5 to the 2.5th power.
A graphic can use multiple handles
Create interactive graphics that respond to mouse clicks
Note that the drag and mouseup before and after respectively represent the click, press and release of the corresponding script. This is worth noting.
Collect coordinate points of graphics
There are 5 drag functions that perform similar functions to handle and mousetrap, but with multiple points at once. 1. drag marker draws n markers 2. Drag line uses n vertices and n-1 line segments to draw a connecting line 3. drag rect draws a filled rectangle using the first two coordinates, ignoring any other coordinates. 4. drag polygon uses n vertices to draw a filled polygon. 5. Drag text draws a text item at the coordinates. If it is a list of text items, draw the i-th list item at the i-th (x, y) coordinate. If the list items are less than the coordinate pair, the remaining points will be repeated. The last item.
Troubleshooting: Interactive graphics are not working as expected, make sure handle or mousetrap coordinates are provided with initial values
picture display type. The picture data type in JSL is used to store pictures of JMP output or formulas.
To create picture data, please send the get picture message to displaybox.
The function Expr As Picture evaluates its argument and creates a picture of the expression, using the same formatting mechanism as the JMP formula editor
Once you have an image, you can use it in two ways 1. Use the displaybox constructor to merge it into the new display tree 2. Use save picture to write it to a file.
Using the << operator, you can send messages to the display being constructed without having to send them as messages after they appear. This allows you to distinguish between computed subparameters and option parameters. It also helps make it clearer which parameters are options and which are scripts to be run in the graph.
Grammar reference
Parameters used to control settings in the graphics box
Function to construct interactive graphics box
A function that plots a function within a graphics box
Function for drawing in pixel coordinates within a graphics box
processing display
JMP reports are built in a hierarchical manner by nesting and gluing various rectangular boxes. To use scripts to process reports, you first need to understand how these boxes work. 1. You need to process the display frame from an existing report. This section first introduces the JMP report, and then explains how to locate it in the report, how to extract data from the report, and how to use JSL to change the report. 2. You need to construct your own reports.
Introduction to display box
Vlistbox glue boxes together vertically
Hlistbox glues boxes together horizontally
Nest Vlistbox and Hlistbox together
tablebox is a special Hlistbox whose elements are string and numeric columns
outlinebox creates an outline hierarchy
picturebox glues axes, boxes and labels together to make graphics
JSL also has some other display box types for customizing the display: buttonbox, slider box, tab box and global box. In addition, there is support for editable text boxes text edit box and for making trees similar to those in the cause-and-effect diagram platform. box hier box
Display box object reference
A special JSL value called a display box reference can own or reference a display box (this book uses db as a placeholder for any display box), dt is a data table, and obj is a scriptable object.
Display box references can be created using report messages to facilitate the top of the display tree associated with scriptable platforms
subscript
If you want to reference another part of the report, the easiest way is to use the subscript operator to find it. It works by searching for a complete string, and the text parameter can also be any expression that evaluates to a string.
It is usually necessary to assign a certain part of the report to a variable to conveniently send messages to it.
If you want to identify items nested several levels below a node, use subscripts in multiple parameters of any of the above types. After the first item is found, JMP looks for the next item within the item, and so on.
Note that various types of subscripts can be concatenated. This selects column 3 of the first table of the box node "Parameter Estimates" under the node "Polynomial Fit Degree = 4".
wildcard
In the column function, you can use the wildcard "?" to indicate a position in the search string that you want to match any character sequence.
Send a message
Display references can be used to send scripts to display elements via the send or << operators
close can switch the frame node back and forth between the closed and open states. Can also contain a boolean parameter, representing 0/1
To understand the message that a show box reference can understand, you can use show properties for that object
Quick search window
Send window messages to find windows nested under other windows
Custom reports
The send to report and dispatch commands can be used together to customize the report appearance. For example, turn on and off the outline node, adjust the size of the graphics box, or customize the color in the graphics box.
send to report contains a list of commands that can be sent to the display tree.
dispatch is used to send commands to a specific part of the display tree. It has four parameters, the first of which is a list of outline nodes that need to be traversed to find the required display tree part. The second and third parameters work together, the second parameter is the name of the display element, and the third parameter is the type of the display element. The fourth parameter is the command to send
Note: If several outline nodes have the same name, JMP will index them. For example, if a bivariate analysis has two quadratic fits (resulting in the same title), when dispatching a command to the second fit, the subscript [2] will be added to this copied title. The best way to handle Send to Report and Dispatch commands is to create customizations interactively using the mouse to run the report first. Then, examine the JMP-generated script.
Platform instance
How to get a single number from a table
It is also possible to get the values from the box as a matrix which can then be used for further calculations and written to a data table. You can also create data tables directly.
Note that when writing scripts, please open the display box tree view so that you can better position the display box and read out the required data.
Adjust axis dimensions
save Picture
The picture box containing the graph needs to be selected, selecting only the graph will discard the axis
Record report log
rbiv<<journal window
window
window finds a window by title and returns a reference to that window.
Syntax reference for targeting reports
Subscript used to display the box
Construct display tree
You can construct your own display using the constructor function and install it in the window. This section will demonstrate how to put the various displays together and how to send messages to them.
basic knowledge
You first need to start the new window, start with a title, and then list the items to be constructed in the window. All display box constructors end with "box"
Example
Assemble partial pseudo-tables of matrix JSL using OutlineBox, HListBox and Matrix Box
Can be programmed to avoid iterating the outline box
Update existing display
Sometimes you don’t know how many display boxes need to be displayed in future reports?
append This message adds a display box to the existing display. For example, in a script, construct a single empty box and then use <<Append to add boxes within it for each variable in the analysis.
The prepend message works similarly to append, except it adds the item at the beginning of the display box instead of at the end.
Using the delete method of the display box will make the display box and all its children disappear.
The sid append message can add a display element to an existing tree. Display box or display segment
To update the numerical column in the display box, use the set values command
Control text wrapping
Usually JMP will automatically wrap the text in the text box. The default wrap point can be overridden with the set wrap(n) message, where n is the number of pixels to be displayed before the wrap point.
You can also use bullet point (1) to use bullet points. This message sent to the text box will place a small bullet point in front of the text and make subsequent lines in the text box indented.
interactive display elements
JMP has three special types of display boxes, which are usually not seen in the JMP platform: button box, slider box, and global box. Used to build custom windows with interactive graphics.
The slider box draws a sliding bar control that is used to select any value of the specified global variable, and its range is determined by the specified min and max. When the slider is moved, the value specified by the current position of the slider will be assigned to the global variable, and the graphics will be updated accordingly. Therefore, the slider box is another method for parameterizing graphics.
button box draws a button using the specified name. When the button is clicked, the script will be executed.
The global box displays the name and current value of JSL global variables. The user can assign a new value to this global variable by editing the value directly in the window and pressing Enter or return to commit the changes.
Example: Combine graphics with two sliders and a button,
Use global box
Modal and non-modal controls
Modeless control
Check box can select any number of items in the check box at the same time
radio box Only one item in the radio button box can be selected at any time
combo box items in combo box are drawn in drop down menu
list box displays a list of display boxes for selection
button box draws a button containing text
tab box draws a dialog pane with tabs
text box draws a non-editable text box. Text boxes are often used as labels for other controls.
text edit box draws an editable text box
col list box returns the display box to select data table columns
line up box returns a display box that neatly arranges its internal display boxes
border box is used to add space around the displaybox parameter
panel box returns a display box with a title and containing other display boxes
The journal box function constructs a display box suitable for gluing together other display boxes to create a display in a window.
Store a list of commands in a global variable and then use a popup box to display the items
Tabbed dialogs are also available in the display tree
Send <<setselected(n) to the tab dialog object, where n is the tab number, which can specify which tab should be selected
Advanced instance
Draws a clone of the clustering platform display box, then launches the platform using the given parameters.
Option box of K-means clustering platform
Send a message to the constructed display
If you give a construct a name, that name becomes a reference to the window, and the window will have the display box inside it. Subscripting lets you send messages to the window's display box.
Build your own display from scratch
Construct a display box containing the platform
It may be necessary to construct another display to simply combine the results in the JMP Analytics Platform
Build a custom platform
Improved this instance by collecting coefficients from the user via a dialog box. This section further develops this example into a complete custom platform, first popping up a dialog box prompting for coefficients, then finding the roots, and finally displaying the results and graphics in a custom window.
log
It's relatively easy to place objects in the log window, but the harder part is knowing how to handle the log itself
Assume that a data table is generated
To log report results, use journal window messages
To save the logs in a file, use
To save the log as Html, use
Grammar reference
The following tables detail the various types of display boxes. First are the commands for constructing display boxes, then the messages that various types of boxes can receive. SliderBox and ButtonBox cannot be used to display tree subscripts (e.g. myWindow[sliderbox(1)] does not work), so they have no messages.
display box constructor
Message for all display boxes
Message for outline box
Message for frame box
message using table frame
Message for text box
Messages for Axis boxes
Message for number col box
Message for string col box
Message for matrix box
Message for nom axis box
8. Matrix, matrix algebra of JMP
Matrix algebra is a concise way of expressing matrix operations on two-dimensional tables of numbers. JSL supports matrix data types and can perform a variety of matrix operations. Most statistical methods can be represented by simple matrix notation, with uppercase bold variables representing matrices and lowercase bold letters generally representing vector matrices.
Basic Information
definition
A matrix is a rectangular list of numerical rows and columns. JSL supports matrix values as well as multiple matrix operators. Statistical methods are generally used in matrix expressions. As used in this chapter, scalars refer to simple non-matrix numeric values. If a matrix has only one row or column, it is generally called a row vector or column vector, sometimes just a vector.
Construct matrix
You can use [] to specify matrix literals, and use spaces or other "whitespace" characters to separate values, and use commas or semicolons to separate rows.
Specify only the sign so that the matrix contains only 1/-1 elements
Construct a matrix using expressions
If you store multiple numeric expressions in a list, you can also use the matrix function to convert them to a matrix.
Special matrix constructor
The function identity can be used to construct an identity matrix of specified dimensions.
Function J can be used to construct a matrix with the specified number of rows and columns as the first two parameters of the matrix and the remaining elements as the third parameter.
The index function is used to generate a row vector of integers from the first parameter to the last parameter. The double colon: is an infix operator with the same effect:
The function shape can be used to reshape an existing matrix by changing its row distribution to a specified dimension.
Delete rows and columns
Rows and columns can be deleted by the following assignment operation
query function
ncol/nrow can return the number of columns and rows in the matrix or data table respectively.
subtopic
Numeric operators
basic arithmetic
Addition, subtraction, multiplication, and division operations can be performed on matrices. The standard multiplication operators become matrix multipliers instead of element multipliers.
If given two matrix arguments, the "*" and "/" infix operators and the equivalent multiply and divide functions will perform matrix multiplication and matrix division operations. But if given a matrix and a scalar, they will perform element-wise multiplication and division. You can also use the matrix mult function to specify matrix multiplication To force element-wise multiplication, use: * or the equivalent emult function, scalar multiplication is commutative, while matrix multiplication is not To force element-wise division, use:/ or the equivalent ediv function
Scalar numeric library functions
Other operators and functions perform operations based on the elements in the matrix. For example, if A is a matrix and B=SQRT(A), the SQRT function is executed on each element in matrix A.
Such functions include
Process value
merge
concat can combine two parallel matrices into a larger matrix, the number of rows must be the same. Equivalent infix operator ||
vconcat can stack two connected matrices together, and the number of columns must be the same. Equivalent infix operator |/
Both concat and vconcat can combine empty matrices, scalars and lists
As an alternative to the coalescing operators ||= and |/=, a||=b is equivalent to a=a||b and a|/b is equivalent to a=a|/b.
Diagonal
diag can be used to create a diagonal matrix from a square matrix or vector
For example, D=[1 -1 1], Diag(D)=[1 0 0, 0 -1 0, 0 0 1]
vecdiag creates vectors from the diagonal elements of a matrix
The trace function will return the sum of the diagonal elements of the square matrix, which is the trace of the matrix:
Transpose
The transpose function is used to transpose a matrix. The back quotes are its equivalent postfix operators, namely A' and At
Matrices and data tables
Matrix data tables can be converted to each other
subscript
You can use the subscript operator to select elements or submatrices in the matrix. The subscript is usually written in square brackets after the matrix and contains the row and column parameters.
single element
The expression A[I,J] means to extract the element of row i and column j and return a scalar number.
Matrix or list subscript
You can also specify a list or matrix of subscripted values, and the result is a matrix of selected rows and columns
single bid
Single subscripting treats a matrix in the same way as converting all rows into a single column, with the columns connected end to end. Double subscript A[i,j] produces the same result as single subscript A[(i-1)*ncol(A) j]
Select all rows or columns
Use the subscript parameter 0 to select all rows and columns
Assignment via subscript
New values can be inserted into the matrix via subscripts. The subscript can be a single subscript, a subscript matrix or list, or a 0 subscript for all rows or columns. The number of selected rows and columns to be inserted must be the same as the dimensions of the insertion parameter, or a scalar that can be repeatedly inserted at the index position.
operator assignment
You can use operators to assign values to matrices or matrix subscripts, such as =
*= A[loc(A<0)]*=-1;
row or column range
Use the index operator to create a range matrix. The operator is::
loc
The loc function can be used to create a matrix consisting of all positions where A is true. It is a column matrix and the positions are single subscripts.
locmin and locmax
Used to return the position of the minimum and maximum elements of the matrix. The position is a single subscript representation.
located
A matrix of positions used to create matrix A where the values at those positions are less than or equal to a given value given in B
Comparisons, range checks, and logical operators
JMP's comparison, range checking, and logical operators can also be used on matrices and produce an element-wise matrix of boolean results.
any operator, if there is a non-zero operator in the matrix, return 1
all operator, all elements in the matrix are non-0 elements, then all returns 1
min returns the smallest element in the matrix, or the smallest value of the matrix specified as argument
max returns the maximum element in the matrix, or the maximum value of the matrix specified as argument
Ranking and sorting
rank can return a column vector of ranks of elements in a row or column vector. These ranks can be used to generate a sorted column vector.
matrix operators
Solve linear systems
Inverse or inv, inverse is used to return the inverse matrix of the square matrix (non-singular matrix parameters), which can also be abbreviated as INV. The product of the matrix and the inverse matrix returns an identity matrix.
Matrices and other data types
Matrices and data tables
Move data from data table into matrix
get as matrix will create a matrix of values based on all numeric columns in the data table. The row number can also be sent to the variable referenced by the data table column.
get as matrix also supports column list parameters, either names or strings
dt << get selected rows can be used to return a matrix consisting of the currently selected rows in the data table
dt <<get rows where(expr) can be used to return a matrix consisting of the row values at that position when the expression is true
Move data from matrix to data table
If col is a variable containing a data table column reference, and x is a column vector of values, the following expression can assign the value of x to the column, since many values are in x
Alternatively, the as table() command can be used to create a new data table based on the matrix parameters, with the columns named col1, col2, and so on.
Matrices and reports
A matrix of values can be extracted from a window report. If the table box is a variable containing a table box reference, get as matrix will create a matrix A consisting of a column vector of values based on that column.
If colbox is a variable that contains a reference to a report table column box, get as matrix will create a matrix A of column vectors of values based on that column.
Statistical examples
regression instance
Suppose you want to perform your own regression calculations without using JMP's built-in tools
Special 1: Image processing applications
Constructor
new image(<width,height>,<existing image>)
Picture object, which can be used to add pictures to frames or display boxes
open(file path,jpg|png|gif|bmp|tif)
Used to open picture objects
item message
obj << add frame
Adds new frames to animated images. The frame contains nothing until SetPixel is used. An optional duration parameter can be specified, which indicates the frame duration in milliseconds. If the duration parameter is omitted, the duration of the current frame will be used as the duration of the new frame. If there are no other frames, the default duration of 100 milliseconds will be used.
crop, crop the picture
Using the specified dimensions, trim the existing image to create it. If there is no L value, replace the original image.
Filter Filters images based on a specified algorithm
Repeated filtering affects image quality
Method 1. Despeckle removes pixels that do not blend with surrounding pixels. For example, black pixels wrapped by white pixels are converted into white pixels.
Method 2, edge edge, all objects outside the outline of the object are darkened
Method 3. Enhance Enhancement Reduce the contrast between pixels in noisy images
Method 4, median replaces the color value of each pixel with the median value of surrounding pixels
Method 5, negate replaces the pixel color with its complementary color
Method 6, normalize removes the percentage of top and bottom color values. The color values are then stretched to fill the rest of the image, a process that increases the intensity of the color.
Method 7. Sharpen to make the edges of pixels clearer
Method 8. Contrast Optimize light and dark colors. Larger values will brighten the image
Method 9. Gamma balances the brightness and RGB ratio of the image. Larger values produce lighter images.
Method 10. Reduce noise Denoising Find the minimum and maximum color values and replace them with values consistent with the surrounding pixels. Larger values will create a smoother image.
Method 11. Gaussian blur Gaussian blur blurs pixels with a specified radius. Specifying a larger radius creates a smoother image. You can also specify sigma in JSL. A larger sigma value will make the image smoother.
Method 12. canny edge detection filter to construct edge images
Different methods can be used interchangeably
flip both Flips the image horizontally and vertically at the same time
flip vertical flips the image upside down
flip horizontal flips the image horizontally
get current frame returns the current frame number, which is 0 for images, or 0 to the frame number minus 1 for GIF images.
get frame durations returns a matrix of pause times between each frame, the specified time is in milliseconds
get n frames returns the number of frames of the image, which can be used to determine whether it is an animation file.
get n loops returns the number of times the animated image should loop through its sequence. A value of zero means it should traverse infinite times
get pixels returns the color matrix represented by the image
get size returns a list containing image width and height
remove frame (frame number) Delete a frame from the animation image, passing the index of the frame to be deleted
rotate(angle) rotates the image by the specified rotation angle, clockwise
save image (filepath, image type) Valid image types are PNG\JPG\GIF\TIFF\BMP\PDF. If the image type is not specified or cannot be understood, the PNG format will be saved.
scale(scale|XScale,yscale) applies a scale factor to the width and height of the image
set current frame (frame) Set the current frame number, the operation will be performed on the current frame
set frame duration (duration) sets the duration of the current frame in the animated image, in milliseconds
set n loops (loops) sets the number of times the animated image should traverse its sequence
set pixels sets the pixel matrix of the image
set size({width, height}) sets the image size according to the specified width and height
transparency (fraction) applies transparency to the image, valid values are between 0 and 1