Thanks!
dt = Open( "$SAMPLE_DATA/Big Class.jmp" ); Graph Builder( Variables( X( Transform Column( "rows", Formula( Row() ) ) ), Y( :height ) ), Elements( Points( X, Y, Legend( 3 ) ), Line Of Fit( X, Y, Legend( 5 ) ) ) );
What do you mean by slope in this case and where you wish to see it? You can for example enable equation for line of fit
How is this value obtained in JSL?
0.2326
If you just need that value I would use Fit Y by X platform or Linear Regression matrix function
Names Default To Here(1); dt = Open( "$SAMPLE_DATA/Big Class.jmp" ); rows = (1::N Rows(dt))`; ys = dt[0, "height"]; {Estimates, Std_Error, Diagnostics} = Linear Regression(ys, rows); slope = Estimates[2];
Edit: Added other options
Names Default To Here(1); dt = Open("$SAMPLE_DATA/Big Class.jmp", Invisible); dt << New Column("R", Numeric, Continuous, Formula(Row())); // Linear Regression() {Estimates, Std_Error, Diagnostics} = Linear Regression(dt[0, "height"], dt[0, "R"],); // lr_eq = Eval Insert("height = ^Estimates[1]^ + ^Estimates[2]^ * R"); lr_s1 = Estimates[2]; // Bivariate + Fit Line biv = dt << Bivariate(Y(:height), X(:R), << Fit Line, Invisible); biv_eq = Report(biv)[Outline Box("Linear Fit"), Text Edit Box(1)] << get text; biv << close window; biv_s1 = Regex(biv_eq, "\s([0-9\.]+)*\D+$", "\1"); //biv_s2 = Word(-2, eq, " +*"); // Graph Builder + Line Of Fit + Equation(1) gb = dt << Graph Builder( Size(525, 454), Show Control Panel(0), Variables(X(:R), Y(:height)), Elements(Points(X, Y, Legend(3)), Line Of Fit(X, Y, Legend(5), Equation(1))), Invisible ); tseg = Report(gb)[FrameBox(1)] << Find Seg(Text Seg(1)); gb_eq = tseg << get text; gb << Close Window; gb_s1 = Regex(gb_eq, "\s([0-9\.]+)*\D+$", "\1"); //gb_s2 = Word(-2, eq, " +*"); Close(dt, no save); Show(lr_s1, biv_s1, gb_s1);