cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
gallardet
Level III

Help with this simple script of fit y by x

Hello. I try to study the relationship of a quantitative variable with multiple quantitative variables. I wrote this script but it doesn't work. I show you the script and the error message. Thank you in advance.

Script

Names Default To Here(1);
dt = Current Data Table();
numericColNames = dt << get column names(string, numeric);
For(i = 38, i <= N Items(numericColNames), i++,
	Bivariate(Y(:Name("ERC [%]")), X((__col__)), Fit Line({Report(0), Line Color({212, 73, 88}), Report(0)}))
);

Error
 
Names Default To Here(1);
dt = Current Data Table();
numericColNames = dt << get column names(string, numeric);
For(i = 38, i <= N Items(numericColNames), i++,
	Bivariate(Y(:Name("ERC [%]")), X((__col__)), Fit Line({Report(0), Line Color({212, 73, 88}), Report(0)}))
);

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Help with this simple script of fit y by x

Ok I think the issues is what I did explain in my second response. If you want it to be a bit more obvious you can define __xcol__

Names Default To Here(1);
dt = Current Data Table();
numericColNames = dt << get column names(string, numeric);
For(i = 38, i <= N Items(numericColNames), i++,
	__col__ = numericColNames[i];
	Bivariate(
		Y(:Name("ERC [%]")),
		X(Eval(__col__)),
		Fit Line({Report(0), Line Color({212, 73, 88}), Report(0)})
	);
);

Also if you are using JMP16+ using For Each is usually better than using just For

-Jarmo

View solution in original post

6 REPLIES 6
jthi
Super User

Re: Help with this simple script of fit y by x

I think you didn't remember to add the error message. Also when posting scripts you should use

jthi_0-1696605661286.png as it makes readability much better (I did edit your message to use this).

 

-Jarmo
jthi
Super User

Re: Help with this simple script of fit y by x

Just looking at your script, it doesn't look like you are using your loop for anything (i isn't being used) besides replicating Bivariate IF you have __col__ defined correctly somewhere. It might be enough if you change

X((__col__))

to

X(Eval(numericColNames[i])),
-Jarmo
gallardet
Level III

Re: Help with this simple script of fit y by x

Names Default To Here( 1 );
dt = Current Data Table();
numericColNames = dt << get column names( string, numeric );
For( i = 38, i <= N Items( numericColNames ), i++,
	Bivariate(
		Y( :Name( "ERC [%]" ) ),
		X( (__col__) ),
		Fit Line( {Report( 0 ), Line Color( {212, 73, 88} ), Report( 0 )} )
	);
);

Not Found in access or evaluation of 'Bivariate' , Bad Argument( {__col__, Role requires at least 1 columns.} ), Bivariate(/*###*/Y( :Name( "ERC [%]" ) ),
	X( __col__ ),
	Fit Line( {Report( 0 ), Line Color( {212, 73, 88} ), Report( 0 )} )
)


gallardet
Level III

Re: Help with this simple script of fit y by x

Sorry.

jthi
Super User

Re: Help with this simple script of fit y by x

Ok I think the issues is what I did explain in my second response. If you want it to be a bit more obvious you can define __xcol__

Names Default To Here(1);
dt = Current Data Table();
numericColNames = dt << get column names(string, numeric);
For(i = 38, i <= N Items(numericColNames), i++,
	__col__ = numericColNames[i];
	Bivariate(
		Y(:Name("ERC [%]")),
		X(Eval(__col__)),
		Fit Line({Report(0), Line Color({212, 73, 88}), Report(0)})
	);
);

Also if you are using JMP16+ using For Each is usually better than using just For

-Jarmo
gallardet
Level III

Re: Help with this simple script of fit y by x

Going from 9 to 14 was fantastic. With 14 I'm more than happy. Thank you so much