嘗試找出如何使用預測公式通過曲線擬合編寫複雜公式的腳本。 如果所有數據都集中在一起,並且只有一個公式,則很簡單,但是如果我將數據分解成較小的集合,就會陷入腳本編寫的困境。 我可以以交互方式進行操作,但是我有許多不同的數據表,因此手動進行操作將非常繁瑣。 (提前致謝)
我已使用JMP示例數據Big Class作為示例
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 180如果我理解正確,這是一種方法。這種方法不在乎公式有多複雜。
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;