@Jeff_Perkinson 、 @ミロ 、
これは議論に関連している - 傾斜関数と切片関数
私はこの議論が参考になると思いました。私は現在JMP 13を使用しているので、JMP 14で開発されたものがある場合、私は必ずしもそれにアクセスできません。
しかし、これが私の質問です。
Clear Log() ; Clear Globals(); Close All(DataTables,"No Save");
Slope = function({x,y},{default local},
If( !(Is Matrix( x ) & Is Matrix( y ) & N Col( x ) == 1 & N Col( y ) == 1),
Show( "x or y arguments are not matrices or they have more than one column" );
Throw();
,
x = J( N Row( x ), 1 ) || x; // put in an intercept column of 1s
beta = Inv( X` * X ) * X` * Y; // the least square estimates
beta[2];
);
);
Intercept = function({x,y},{default local},
If( !(Is Matrix( x ) & Is Matrix( y ) & N Col( x ) == 1 & N Col( y ) == 1),
Show( "x or y arguments are not matrices or they have more than one column" );
Throw();
,
x = J( N Row( x ), 1 ) || x; // put in an intercept column of 1s
beta = Inv( X` * X ) * X` * Y; // the least square estimates
beta[1];
);
); // end of intercept function
x1 = 0.05417099;
x2 = 0.057730865;
y1 = 30.5885;
y2 = 31.5885;
dt = New Table();
dt << New Column("X",Numeric,Continuous,<< Set Values({x1,x2}))
<< New Column("Y",Numeric,Continuous,<< Set Values({y1,y2}));
dt << New Script("Biv",Bivariate( Y( :Y ), X( :X ), Fit Line( {Line Color( {213, 72, 87} )} ) ));
SlopeTest = Slope(Matrix({y1,y2}),Matrix({x1,x2}));
Show(SlopeTest);
InterceptTest = Intercept(Matrix({y1,y2}),Matrix({x1,x2}));
Show(InterceptTest);
1。2変量をとったテストケースで、勾配と切片が一致しないのはなぜですか?
2。関数やその実装にバグがある場合、代替案を提供するのに十分親切になりますか?
あなたの入力の順番は逆です。 関数上でそれはslope(x、y)に行き、あなたが呼ぶとき傾斜(y、x)をしている
やあ @uday_guntupalli 、
あなたはまだ議論を逆にしました。 スクリーンショットを見てください。
@cwillden 、
それは良いキャッチでしたが、結果は変わりませんでした、そして、関数は二変量まで一致しません
SlopeとIntercept関数の引数を逆方向に取得しました。 行列の順序を逆にするだけです。