cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Use World Cup data to build models, explore spatial relationships, and create informative visualizations in JMP. Register. July 17, 2 pm US Eastern Time.
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
hogi
Level XIII

Percent of Factor for "X and below"

Hi,

In JMP every row know to which bar it belongs in a bar graph. So, it's very easy to calculate % of Factor.

e.g. ratio of female and male students plotted versus age ("X"):

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
Graph Builder(
	Variables( X( :age ), Overlay( :sex ) ),
	Elements(
		Bar(
			X,
			Bar Style( "Stacked" ),
			Summary Statistic( "% of Factor" )
		)
	)
);

hogi_0-1765647317352.png

Is there an easy way to generate a plot showing the percentage of factors, with the ratio of female to male students plotted against age as "X and below"? So, for 12 years old, it would be the same ratio as above (5 vs. 3), and for 17 years old, it would be the total ratio of male and female students: 22 vs. 18.

hogi_2-1765647938041.png

1 ACCEPTED SOLUTION

Accepted Solutions
hogi
Level XIII

Re: Percent of Factor for "X and below"

Workaround via summary table:

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );


dtsum = dt << Summary(Group( :age, :sex ));
dtsum << New Column( "N cumulative", Formula( Col Cumulative sum(:N Rows, :sex)));


Graph Builder(
	Variables( X( :age ), Y( :N cumulative  ), Overlay( :sex ) ),
	Elements(
		Bar(
			X,
			Y,
			Bar Style( "Stacked" ),
			Summary Statistic( "% of Factor" )
		)
	)
);
	

View solution in original post

1 REPLY 1
hogi
Level XIII

Re: Percent of Factor for "X and below"

Workaround via summary table:

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );


dtsum = dt << Summary(Group( :age, :sex ));
dtsum << New Column( "N cumulative", Formula( Col Cumulative sum(:N Rows, :sex)));


Graph Builder(
	Variables( X( :age ), Y( :N cumulative  ), Overlay( :sex ) ),
	Elements(
		Bar(
			X,
			Y,
			Bar Style( "Stacked" ),
			Summary Statistic( "% of Factor" )
		)
	)
);
	

Recommended Articles