我正在嘗試自動化我的降級腳本,以便我可以使用相同的腳本將降級模型適應不同的數據。
目前,我已成功使用擬合模型將我想要的模型擬合到我的數據中,並將參數作為列矩陣。
然後,我嘗試將矩陣輸入到退化模型的初始值中,但它只是輸出所有參數不變的模型。 有什麼方法可以將矩陣作為參數值(下面腳本中的初始值)輸入到降級腳本中。
Degradation(
Y( :"Output/mV"n ),
Time( :Time in hours ),
Label( :Unit ID ),
Application( Repeated Measures Degradation ),
Connect Data Markers( 1 ),
Show Fitted Lines( 1 ),
Show Spec Limits( 1 ),
Show Median Curves( 0 ),
Show Legend( 0 ),
No Tab List( 0 ),
Set Upper Spec Limit( . ),
Set Lower Spec Limit( . ),
Set Censoring Time( . ),
Show Residual Plot( 1 ),
Show Inverse Prediction Plot( 1 ),
Inverse Prediction Interval( No Interval ),
Inverse Prediction Alpha( 0.05 ),
Path Specifications(
Nonlinear Path(
Add Formula(
Formula Name( "Model" ),
Formula(
Parameter(
{a = 200, b = -0.00007},
a[Unit ID] * Exp( b[Unit ID] * Time in hours )
),
),<BR />//Trying to enter my matrix of parameters into the model
Initial Values(A_para),
Fitting Method( QuasiNewton BFGS ),
),
Select Formula( "Model" )
),
Run Model( "Model" )
),
Nonlinear Path( 1 ),
Mean Path( 1 ),
SendToReport(
Dispatch(
{"Overlay", "Output/mV Residuals by Time in hours"},
"7",
ScaleBox,
{Min( -80 ), Max( 210 ), Inc( 50 ), Minor Ticks( 4 )}
),
Dispatch(
{"Overlay", "Output/mV Residuals by Time in hours"},
"13",
ScaleBox,
{Min( -80 ), Max( 210 ), Inc( 50 ), Minor Ticks( 4 )}
),
Dispatch(
{"Overlay", "Model Specification"},
"Empty",
TextEditBox,
{Fixed Size( 1, 100, 19 ), Set Text( "Model" )}
),
)
);obj = Fit Curve(
Y( :"Output/mV"n ),
X( :Time in hours ),
Group( :Unit ID ),
);
//Currently this is using a slighlty different fitting method to the one used by the degredation platform
obj << Fit Exponential 2P;
//Next I want to create the table of parameter estimates
dt_p = obj << (Fit[1] << Make Parameter Table);
//Now create a single column matrix of the parameter estimates
col_scale = Column( dt_p, "Scale" );
col_growth = Column( dt_p, "Growth Rate" );
A_scale = col_scale << Get As Matrix;
A_growth = col_growth << Get As Matrix;
A_para = A_scale |/ A_growth;
//Put values into a column to check I've done it right
dt_temp = Data Table( "Stacked and Transposed New Dates Raw Data" );
col_p = dt_temp << New Column( "Parameters" );
col_p << Set Values(A_para);
目前,降級平台無法按照您想要的方式取得矩陣的命名變數。
解法是建構一個表達式,然後求值。
假設你已經有一個矩陣
A_para = [....];
它保存初始值。
解決方法是建構一個如下所示的表達式
code = expr(Degradation(
Initial Values(
A_para
),
Fixed(
....
)
));
現在用實際矩陣取代名稱 A_para,如下所示:
substitute into(code, expr(A_para), A_para);
最後,透過以下方式運行程式碼:
eval(code);
如果您想按原樣使用輸入初始值,我相信您需要將一個矩陣分配給Fixed子句。
請讓我知道進展如何。