キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
言語を選択 翻訳バーを非表示
lala
Level IX

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 ) ) )
);

2024-07-06_10-31-27.png

3件の返信3
jthi
Super User

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

jthi_0-1720243785600.png

 

-Jarmo
lala
Level IX

Re: How can show the slope in the graph?

Thanks!

  • How is this value obtained in JSL?

0.2326

2024-07-06_15-29-00.png

jthi
Super User

Re: How can show the slope in the graph?

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);
-Jarmo

おすすめの記事