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
emmablue
Level III

how to calculate standard deviation across multiple columns?

Is it possible to use JMP to calculate standard deviation across multiple columns? I could only figure out how to do the calculation in the same column. 

 

firstsecondthirdCV
2.4507122.4411282.430674 
1.2671391.2584291.260132 
2053.4592062.3412067.839 
1.7522831.7619821.763598 
1.1081771.1137781.115453 
1.2322381.2252361.232238 
2.4711462.4654442.456794 
3 ACCEPTED SOLUTIONS

Accepted Solutions

Re: how to calculate standard deviation across multiple columns?

You're looking for the "Std Dev" function.

 

Jordan_Hiller_0-1719513951606.png

 

https://www.jmp.com/support/help/en/18.0/#page/jmp/statistical-functions.shtml#

 

See attached data table as well.

View solution in original post

jthi
Super User

Re: how to calculate standard deviation across multiple columns?

Do you mean by row? You can for example use Std Dev function and list the columns

Std Dev(:first, :second, third)
-Jarmo

View solution in original post

txnelson
Super User

Re: how to calculate standard deviation across multiple columns?

If you are attempting to calculate the Coefficient of Variation for each row, it would be:

txnelson_0-1719514502263.png

names default to here(1);
dt=
New Table( "example",
	Add Rows( 7 ),
	New Column( "first",
		Numeric,
		Set Values(
			[2.4507119999999998, 1.267139, 2053.4589999999998, 1.752283, 1.108177,
			1.2322379999999999, 2.4711460000000001]
		)
	),
	New Column( "second",
		Numeric,
		Set Values(
			[2.441128, 1.258429, 2062.3409999999999, 1.7619819999999999,
			1.1137779999999999, 1.225236, 2.4654440000000002]
		)
	),
	New Column( "third",
		Numeric,
		Set Values(
			[2.4306739999999998, 1.260132, 2067.8389999999999, 1.763598, 1.115453,
			1.2322379999999999, 2.4567939999999999]
		)
	)
);

dt << new column("CV", formula( stddev(:first,:second,:third)/mean(:first,:second,:third)));

If you want to calculate the STD for the complete data table matrix it would be

names default to here(1);
dt=
New Table( "example",
	Add Rows( 7 ),
	New Column( "first",
		Numeric,
		Set Values(
			[2.4507119999999998, 1.267139, 2053.4589999999998, 1.752283, 1.108177,
			1.2322379999999999, 2.4711460000000001]
		)
	),
	New Column( "second",
		Numeric,
		Set Values(
			[2.441128, 1.258429, 2062.3409999999999, 1.7619819999999999,
			1.1137779999999999, 1.225236, 2.4654440000000002]
		)
	),
	New Column( "third",
		Numeric,
		Set Values(
			[2.4306739999999998, 1.260132, 2067.8389999999999, 1.763598, 1.115453,
			1.2322379999999999, 2.4567939999999999]
		)
	)
);

totalSTD = stddev(dt[0,0]);
show(totalSTD);
)
Jim

View solution in original post

3 REPLIES 3

Re: how to calculate standard deviation across multiple columns?

You're looking for the "Std Dev" function.

 

Jordan_Hiller_0-1719513951606.png

 

https://www.jmp.com/support/help/en/18.0/#page/jmp/statistical-functions.shtml#

 

See attached data table as well.

jthi
Super User

Re: how to calculate standard deviation across multiple columns?

Do you mean by row? You can for example use Std Dev function and list the columns

Std Dev(:first, :second, third)
-Jarmo
txnelson
Super User

Re: how to calculate standard deviation across multiple columns?

If you are attempting to calculate the Coefficient of Variation for each row, it would be:

txnelson_0-1719514502263.png

names default to here(1);
dt=
New Table( "example",
	Add Rows( 7 ),
	New Column( "first",
		Numeric,
		Set Values(
			[2.4507119999999998, 1.267139, 2053.4589999999998, 1.752283, 1.108177,
			1.2322379999999999, 2.4711460000000001]
		)
	),
	New Column( "second",
		Numeric,
		Set Values(
			[2.441128, 1.258429, 2062.3409999999999, 1.7619819999999999,
			1.1137779999999999, 1.225236, 2.4654440000000002]
		)
	),
	New Column( "third",
		Numeric,
		Set Values(
			[2.4306739999999998, 1.260132, 2067.8389999999999, 1.763598, 1.115453,
			1.2322379999999999, 2.4567939999999999]
		)
	)
);

dt << new column("CV", formula( stddev(:first,:second,:third)/mean(:first,:second,:third)));

If you want to calculate the STD for the complete data table matrix it would be

names default to here(1);
dt=
New Table( "example",
	Add Rows( 7 ),
	New Column( "first",
		Numeric,
		Set Values(
			[2.4507119999999998, 1.267139, 2053.4589999999998, 1.752283, 1.108177,
			1.2322379999999999, 2.4711460000000001]
		)
	),
	New Column( "second",
		Numeric,
		Set Values(
			[2.441128, 1.258429, 2062.3409999999999, 1.7619819999999999,
			1.1137779999999999, 1.225236, 2.4654440000000002]
		)
	),
	New Column( "third",
		Numeric,
		Set Values(
			[2.4306739999999998, 1.260132, 2067.8389999999999, 1.763598, 1.115453,
			1.2322379999999999, 2.4567939999999999]
		)
	)
);

totalSTD = stddev(dt[0,0]);
show(totalSTD);
)
Jim