cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar

Summarize function

I need some help utilizing the summarize function and I will use the big class as an example dataset.  The below example works perfect but I need to summarize the data by sex.  When I use the BY(:Sex) operator I keep getting an error.  The purpose of me doing this is to output the results and use this in a calculated reference number per multiple variables for graphing purposes.  .

 

DTData= Open( "$SAMPLE_DATA/Big Class.jmp" );
summarize(
(
Sigma=StdDev(:height),
Avg= mean(:height),
);
show(sigma,avg);

 

 

 

2 REPLIES 2
Byron_JMP
Staff

Re: Summarize function

Here are a couple of examples

 

 

///example from the scripting index for Summarize
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Summarize( exg = By( :sex ), exm = Mean( :height ) );
Eval List( {exg, exm} );

/// I like to put the stats into a data table instead of variables when I'm going to graph the results
Data Table( "Big Class" ) << Summary( Group( :sex ), Mean( :height ), Std Dev( :weight ) );

///Graph Builder summarizes and makes a graph automatically
dt << Graph Builder(
	Size( 249, 298 ),
	Show Control Panel( 0 ),
	Variables( X( :sex ), Y( :height ), Y( :weight ) ),
	Elements(
		Position( 1, 1 ),
		Bar( X, Y, Legend( 3 ), Bar Style( "Side by side" ), Summary Statistic( "Mean" ) )
	),
	Elements(
		Position( 1, 2 ),
		Bar( X, Y, Legend( 4 ), Bar Style( "Side by side" ), Summary Statistic( "Std Dev" ) )
	)
);

 

JMP Systems Engineer, Health and Life Sciences (Pharma)

Re: Summarize function

That works but I can't use it in matrix form for what I'm trying to do.  My goal is to output the mean and Std deviation of a height by the female population in a variables.  I then use those variables for a calculated reference line.    By population changes constantly and having a reference line that is dynamic is handy.  Here is my example.

 

 

DTData = Open( "$SAMPLE_DATA/Big Class.jmp" );
Summarize( sigma = Std Dev( :height ), avg = Mean( :height ) );
siglow = avg - sigma;
sighigh = avg + sigma;
Variability Chart(
	Y( xx ),
	X( :yyy, :zzz ),
	Max Iter( 100 ),
	Conv Limit( 0.00000001 ),
	Number Integration Abscissas( 128 ),
	Number Function Evals( 65536 ),
	Analysis Type( Name( "Choose best analysis (EMS REML Bayesian)" ) ),
	Connect Cell Means( 1 ),
	Show Group Means( 1 ),
	Std Dev Chart( 0 ),
	Points Jittered( 1 ),
	AIAG Labels( 0 ),
	Dispatch(
		{},
		"2",
		ScaleBox,
		{Format( "Best" ), Add Ref Line(
			Eval( siglow ),
			dotted,
			{178, 0, 0},
			"Height Female -1 sigma"
		), Add Ref Line( Eval( sighigh ), dotted, {178, 0, 0}, "Height Female +1 sigma" ),
		Add Ref Line( Eval( avg ), solid, {255, 0, 0}, "mean height female" ),
		Show Major Grid( 1 ), Show Minor Grid( 1 )}
	),
	Where( :what == "why" )
);