@Jeff_Perkinson , @Milo ,
Esto es en referencia a una discusión - Funciones de pendiente e intercepción.
He encontrado que esta discusión es útil. Actualmente estoy usando JMP 13, así que si hay desarrollos realizados en JMP 14, no necesariamente tengo acceso a ella.
Pero, aquí están mis preguntas:
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. ¿Por qué la pendiente y la intersección no coinciden con el caso de prueba que he tomado wrt bivariate?
2. Si la función o su implementación tienen un error, ¿sería lo suficientemente amable como para ofrecer una alternativa?
El orden de tus entradas es al revés. En la función va pendiente (x, y) y cuando llamas estás haciendo pendiente (y, x)
Oye @uday_guntupalli ,
Todavía tienes los argumentos invertidos. Vea la captura de pantalla:
@cwillden ,
Si bien fue una buena captura, no cambió los resultados y la función no coincide con la bivariada.
Obtuvo los argumentos hacia atrás para la función Pendiente e Intercepción. Basta con invertir el orden de las matrices.