我被困在如何采用样条拟合的导数上。 按照我写的方式,它是直接从公式中提取出来的,但我想让它更健壮。 我如何编写代码以获取样条预测器列的导数?
CWfunc = Function({dt_current}, {default local},
//这部分函数创建了crossweb一致性检查//
dt_sub = dt_current;
显示(dt_sub);
dt_sub << Select Where(:Panel_RS == "Loop Qual Panel 2");
dt_sub2 = dt_sub << 子集(
选择行 (1),
仅选定的列( 0 ),
);
显示(dt_sub2);
dt_sub3 = dt_sub2 << 摘要(
组(:Crossweb_LQ,:Loop Lot_LQ),
平均值(:“斜率(195-250)”n),
频率(“无”),
重量(“无”),
链接到原始数据表( 0 )
);
dt_sub3:"Crossweb_LQ"n << 设置数据类型("Numeric");
dt_sub3:“Crossweb_LQ”n <<设置建模类型(“连续”);
dt_sub4 = dt_sub3 << 双变量(
Y( :"平均值(斜率(195-250))"n),
X(:Crossweb_LQ),
通过(:Loop Lot_LQ),
拟合样条 (100),
//保存预测
);
splinecol = dt_sub4 << (Curve[1] << 保存预测);
返回(dt_current、dt_sub、dt_sub2、dt_sub3);
);
Derfunc = Function({dt_sub3}, {default local},
dt_sub3 << 新列(“导数”,
数字,
“连续的”,
格式(“最佳”,12),
公式
Num Deriv(Spline Eval(
:Crossweb_LQ,
[1 2.20042178298482 0.057778359275709 0 -0.000683765776914872,
5 2.38777421036511 0.02495760198378 -0.00820518932298666 0.000416694078291779,
9 2.38299001014311 -0.0206825968420827 -0.00320486038348031 0.000748030601767463,
13 2.29685581515222 -0.0104160110250642 0.00577150683773822
-0.0000755519945723868,
17 2.34270055280314 0.0321295479373521 0.00486488290286867 -0.000773631610584581,
21 2.49954444792103 0.0339142938522158 -0.00441869642415559
-0.0000691115769849535,
25 2.56007933961637 -0.00475263323630778 -0.00524803534797586
0.0000699348227685678,
29 2.46157606976071 -0.0433800445272273 -0.00440881747475221
-0.000380207536072129,
33 2.19318152974715 -0.09690054605672 -0.00897130790762231
-0.0000379484318864192,
37 1.65960971935758 -0.170492534048238 -0.0094266890902598 0.00104740989891671,
40 1.09157198267128 0 0 0]
)
);
);
dt_sub3 << 新列(“通过/失败”,
特点,
标称,
);
返回(dt_current、dt_sub、dt_sub2、dt_sub3);
);
Slopefunc = Function({dt_current}, {default local};
dt_sum = dt_current << 总结(
Group( :"Panel Dose (ug/dL)_RS"n, :Loop Lot_LQ, :Foil_LQ),
均值(:CW 校正后的 AR),
频率(“无”),
重量(“无”)
);
显示(dt_sum);
dt_graph = dt_sum <<双变量(
Y( :"平均值(CW 校正 AR)"n),
X( :"面板剂量 (ug/dL)_RS"n),
通过(:Loop Lot_LQ),
分组依据( :Foil_LQ ),
);
显示(dt_graph);
dt_graph << 拟合线;
返回(dt_graph);
);
mainfunc = Function({dt_current}, {defualt local},
output1 = CWfunc(dt_current);
output2 = DerFunc(output1[4]);
output3 = Slopefunc(dt_current);
);