cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
fr2007
Level II

creating a new datasheet and copying values into it in JSL

hi

i have a dataset with 50 numbers. I want to calculate the mean of the data set and place the mean value in a different new datasheet "Summary". Again I want to calculate sum of the 50 numbers and place it in the same new datasheet "Summary". Can some one help me how to place these mean and sum values in new datasheet "Summary"?

Thanks,

14 REPLIES 14
ms
Super User (Alumni) ms
Super User (Alumni)

Re: creating a new datasheet and copying values into it in JSL

The line dt2 = As Table( m ); creates the table. What does your log say?

The script here assumes you have a Table called "Data" and a column with your data also with name "Data".

ms
Super User (Alumni) ms
Super User (Alumni)

Re: creating a new datasheet and copying values into it in JSL

I used that file when writing the script. I just pasted the values in the text file into a new JMP table (you ca also open it from within JMP), renamed the file from "untutled" to "Data" and gave the column the name "Data". Try again!

fr2007
Level II

Re: creating a new datasheet and copying values into it in JSL

yes. I got the final sheet, but what does the fraction line do? Does that create a formula for the random sample?

fr2007
Level II

Re: creating a new datasheet and copying values into it in JSL


And each time if I want to see the subset of 10 values from which mean and STD Dev. is calculated, can I have that option?

ms
Super User (Alumni) ms
Super User (Alumni)

Re: creating a new datasheet and copying values into it in JSL

Sorry, I inverted the fraction. It should read

fraction = k / N Rows( dt );

This fraction (a number between 0 and 1) is calculated only because the random selection requires a fraction argument.

Here is a version that also puts each subsample in the output table. After the mean and SD columns you should see ten columns with the ten randomly picked data for each iteration.

dt = Data Table( "Data" );

k = 10; //Set sample size

n = 100; //Set number of iterations

fraction = k / N Rows( dt );

m = J( n, 2 + k ); //Initiate a matrix for holding means and SDs

//Loop: make random subset n times

For( i = 1, i <= n, i++,

  dt << select randomly( fraction );

  m[i, 1] = Mean( dt:Data[dt << get selected rows] );

  m[i, 2] = Std Dev( dt:Data[dt << get selected rows] );

  m[i, 3 :: 2+ k] = transpose(dt:Data[dt << get selected rows]);

);

//Move data into new table

dt2 = As Table( m );

dt2 << set name( "Summary Data" );

Column( dt2, 1 ) << set name( "Mean" );

Column( dt2, 2 ) << set name( "StdDev" );