Script per eseguire formule complicate su nuove colonneCercando di capire come scrivere una formula complicata dall'adattamento della curva usando la formula predittiva. È semplice se tutti i dati sono raggruppati insieme e c'è una sola formula, tuttavia se divido i dati in set più piccoli rimango bloccato con gli script. Posso farlo in modo interattivo ma ho molte diverse tabelle di dati, quindi farlo manualmente diventerà molto noioso. (Grazie in anticipo)
Ho usato i dati di esempio JMP Big Class come esempio
dt = Current Data Table(); //Big Class active
biv = Bivariate(
Y( :height ),
X( :weight ),
by( :sex, :age ),
Fit Special( xTran( "Log" ), {Line Color( {212, 73, 88} )}, save predicteds )
);
biv << (curve[1] << save predicteds);
Column( N Cols( dt ) ) << set name( "Predicted Values" );
dt << NewColumn("Weight_150", set each value(150));
dt << NewColumn("Weight_180", set each value(180));
// Stuck here want to use the "Predicted Values" formula on the new weights columns added
// basically need a script to copy over formula from "Predicted Values" which is now very complicated
// and replace "weight" with "weight_150" and "weight_180" in the formula, creating two new columns <BR />// extrapolated values at 150 and 180Ri: Script per eseguire formule complicate su nuove colonneSe ho capito bene, ecco un modo. Questo approccio non importa quanto sia complicata la formula.
NamesDefaultToHere(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp"); //Big Class active
biv = dt << Bivariate(
Y( :height ),
X( :weight ),
by( :sex, :age ),
Fit Special( xTran( "Log" ), {Line Color( {212, 73, 88} )}, save predicteds )
);
biv << (curve[1] << save predicteds);
Column(dt, N Cols( dt ) ) << set name( "Predicted Values" );
dt << NewColumn("Weight_150", set each value(150));
dt << NewColumn("Weight_180", set each value(180));
myFormula = Column(dt, "Predicted Values") << getFormula;
// Stuck here want to use the "Predicted Values" formula on the new weights columns added
// basically need a script to copy over formula from "Predicted Values" which is now very complicated
// and replace "weight" with "weight_150" and "weight_180" in the formula, creating two new columns
// extrapolated values at 150 and 180
myFormula150 = Substitute(NameExpr(myFormula), Expr(:weight), Expr(:weight_150));
dt << NewColumn( "Predicted Values 150" );
addFormula = Expr(Column(dt, "Predicted Values 150") << setFormula(formulaTBD));
SubstituteInto(addFormula, Expr(formulaTBD), NameExpr(myFormula150));
addFormula;
myFormula180 = Substitute(NameExpr(myFormula), Expr(:weight), Expr(:weight_180));
dt << NewColumn( "Predicted Values 180" );
addFormula = Expr(Column(dt, "Predicted Values 180") << setFormula(formulaTBD));
SubstituteInto(addFormula, Expr(formulaTBD), NameExpr(myFormula180));
addFormula;
dt << runFormulas;