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

I am trying to plot bivariate of the new columns created but having issue creating another list.

 

dt = Current Data Table();
//declaring variables
alpha_min = 14;
alpha_max = 18;
inc_val = 0.1;

this is the script, but i want to create bivariate plots of each of them without it showing up as multiple pages and also combine the reports to data table. thanks :)

 

//defining mu col names
mu_col = "mu";

//loop through alpha range and create new cols//
For( alpha = alpha_min, alpha <= alpha_max, alpha += inc_val, 
//define col name
	mu_col_name = mu_col || Char( alpha );
//compute mu val into formula
	New Column( mu_col_name,
		Numeric,
		Continuous,
		Formula( alpha / (alpha + :X) )
	);
);

 

3 REPLIES 3
txnelson
Super User

Re: I am trying to plot bivariate of the new columns created but having issue creating another list.

See if this helps you out

//defining mu col names
mu_col = "mu";

//loop through alpha range and create new cols//
For( alpha = alpha_min, alpha <= alpha_max, alpha += inc_val, 
//define col name
	mu_col_name = mu_col || Char( alpha );
//compute mu val into formula
	Eval(
		Substitute(
				Expr(
					New Column( mu_col_name,
						Numeric,
						Continuous,
						Formula( __alpha__ / (__alpha__ + :X) )
					)
				),
			Expr( __alpha__ ), alpha
		)
	);
);
Jim

Re: I am trying to plot bivariate of the new columns created but having issue creating another list.

Thanks i ended up figuring it out but i would like to create one page of multiple biv plots so i stored them into a list but instead i get multiple pages of one plots. Im not sure where i went wrong 

 

dt = Current Data Table();
//declaring variables
alpha_min = 14;
alpha_max = 18;
inc_val = 0.1;
//create list
alpha_range = {};
For( alpha_val = alpha_min, alpha_val <= alpha_max, alpha_val += inc_val,
	Insert Into( alpha_range, alpha_val )
);

//loop through alpha list and create new mu cols
For( i = 1, i <= N Items( alpha_range ), i++,
	alpha_x = alpha_range[i];
	mu_col_name = mu_col || Char( alpha_x );
	dt << New Column( mu_col_name, Numeric, Continuous, Formula( alpha_x / (alpha_x + :X) ) );
	bp = dt << Bivariate( Y( Expr( Column( mu_col_name ) ) ), X( :Temp ) );
);
// use list to
colListY = {alpha_range};
For( j = 1, j <= 10, j++,
	Insert Into( colListY, "mu" || Char( j ) )
);
New Window( "My output",
	H List Box(
		For( j = 1, j <= 10, j++,
			dt << Bivariate(
				Y( Eval( colListY ) ),
				X( Column( dt, "Temp" ) ),
				Fit Line( {Line Color( {212, 73, 88} )} )
			)
		)
	)
);
txnelson
Super User

Re: I am trying to plot bivariate of the new columns created but having issue creating another list.

Please use the txnelson_0-1690827680078.pngicon at the top of the edit window when entering JSL.  It make is so much easier to read and interpret.

There are 2 issues that I see.

  1. The formula that you are using
    Formula( alpha_x / (alpha_x + :X) )

has a memory variable in it's definition.  Within your JSL, you have that memory variable changing as you move from column to column.  It appears that you are assuming that once you apply the formula to a given column, that the value for alpha_x will be set for the formula and not change.  This is not true.  Whenever the formula is run, it will take the current value of alpha_x and use it.  That is why I specified in my previous response to use a Substitute function to replace the alpha value when the formula is created.

     2. The values in the colListY list are set to mu1, mu2, mu2...etc.  Arn't the Y variable you want to plot named mu14, mu14.1, mu14.2 etc. 

Jim

Recommended Articles