- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How can show the slope in the graph?
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 ) ) )
);
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can show the slope in the graph?
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
-Jarmo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can show the slope in the graph?
Thanks!
How is this value obtained in JSL?
0.2326
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How can show the slope in the graph?
Created:
Jul 6, 2024 04:30 AM
| Last Modified: Jul 6, 2024 8:39 AM
(828 views)
| Posted in reply to message from lala 07-06-2024
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
View more...
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);
-Jarmo