@Jeff_Perkinson , @Milo ,
Ceci est en référence à une discussion - Fonctions de pente et d'interception
J'ai trouvé cette discussion utile. J'utilise actuellement JMP 13, donc s'il y a des développements dans JMP 14, je n'y ai pas nécessairement accès.
Mais voici mes questions:
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. Pourquoi la pente et l'interception ne correspondent-elles pas au cas de test que j'ai pris à deux variables?
2 Si la fonction ou son implémentation ont un bogue, auriez-vous la gentillesse d’offrir une alternative?
L'ordre de vos entrées est en arrière. Sur la fonction, il y a pente (x, y) et quand vous appelez vous faites pente (y, x)
Hey @uday_guntupalli ,
Vous avez toujours les arguments inversés. Voir la capture d'écran:
@cwillden ,
Bien que ce soit une bonne prise, cela n'a pas changé les résultats et la fonction ne correspond pas à bivariée
Vous avez les arguments en arrière pour la fonction Slope and Intercept. Il suffit d'inverser l'ordre des matrices.