需要有关列公式的帮助你好,
我想把这个循环转换成等效列公式
Names Default To Here( 1 );
dt = Current Data Table();
// Assuming Column B is column 2
testColumn = Column( dt, 1 );
llCol = dt << New Column( "LL Limit_7.5", Numeric );
ulCol = dt << New Column( "UL Limit_7.5", Numeric );
// Loop through each row starting from row 20
For( i = 20, i <= N Rows( dt ), i++,
data = testColumn[1 :: i]; // Get values from row 20 to the current row
q1 = Quantile( 0.25, data ); // 1st Quartile
q3 = Quantile( 0.75, data ); // 3rd Quartile
// Factor value is 6
factorValue = 7.5;
// Calculate ll and ul
llx = q1 - (q3 - q1) * (factorValue - 0.675) / 1.35;
ulx = q3 + (q3 - q1) * (factorValue - 0.675) / 1.35;
// Set the calculated values in the new columns
llCol[i] = llx;
ulCol[i] = ulx;
);
我试过了,但似乎不正确。有什么建议吗?
newColExpr = Expr(
llCol << Set Formula(
If( Row() >= 20,
Col Quantile( 0.25, Expr( TestColumn( 1, Row() ) ) ) - (Col Quantile( 0.75, Expr( TestColumn( 1, Row() ) ) )
-Col Quantile( 0.25, Expr( TestColumn( 1, Row() ) ) )) * (Expr( factorValue ) - 0.675) / 1.35,
.
)
);
ulCol << Set Formula(
If( Row() >= 20,
Col Quantile( 0.75, Expr( TestColumn( 1, Row() ) ) ) + (Col Quantile( 0.75, Expr( TestColumn( 1, Row() ) ) )
-Col Quantile( 0.25, Expr( TestColumn( 1, Row() ) ) )) * (Expr( factorValue ) - 0.675) / 1.35,
.
)
);
);
Eval( Eval Expr( newColExpr ) );
自动化和脚本回复:需要有关列公式的帮助你能解释一下你想做什么吗?
回复:需要有关列公式的帮助计算 PAT 限制
回复:需要有关列公式的帮助你可以做这样的事情,但我不确定这是否是最好的方法
Names Default To Here(1);
dt = Open("$DOWNLOADS/data_table.jmp");
dt << New Column("Low", Numeric, Continuous, Formula(
As Constant(
factorValue = 7.5;
);
If(Row() < 20,
.
,
m = :Data[1::Row()];
q1 = Quantile(0.25, m);
q3 = Quantile(0.75, m);
q1 - (q3 - q1) * (factorValue - 0.675) / 1.35;
);
));
dt << New Column("High", Numeric, Continuous, Formula(
As Constant(
factorValue = 7.5;
);
If(Row() < 20,
.
,
m = :Data[1::Row()];
q1 = Quantile(0.25, m);
q3 = Quantile(0.75, m);
q3 + (q3 - q1) * (factorValue - 0.675) / 1.35;
);
));
回复:需要有关列公式的帮助
有趣的是,对于 Col Quantiles,首先是列,然后是分位数。
除此之外, Col Quantile将获取所有行 - 而不是行1::currentRow
-> 将产生一个常数值。

newColExpr = Expr(
new column("llCol" ,Formula(
If( Row() >= 20,
Col Quantile( 0.25, Expr( TestColumn( 1, Row() ) ) ) - (Col Quantile( 0.75, Expr( TestColumn( 1, Row() ) ) )
-Col Quantile( 0.25, Expr( TestColumn( 1, Row() ) ) )) * (Expr( factorValue ) - 0.675) / 1.35,
.
)
));
new column("ulCol" , Formula(
If( Row() >= 20,
Col Quantile( 0.75, Expr( TestColumn( 1, Row() ) ) ) + (Col Quantile( 0.75, Expr( TestColumn( 1, Row() ) ) )
-Col Quantile( 0.25, Expr( TestColumn( 1, Row() ) ) )) * (Expr( factorValue ) - 0.675) / 1.35,
.
)
));
);
Eval(Eval Expr( newColExpr )) ;