Simultaneously fitting two non-linear equations with shared model coefficients

2 次查看(过去 30 天)
I have a pair of non-linear equations with shared model coefficients , representing a two-compartment model, that needs to be fitted to two different datasets of different sizes:
where (representing surviving fraction) is a response variable, (representing dose in Gy) and (representing dose gradient in Gy/cm) are independent variables and is a model coefficient for dataset . Here, the variables for dataset are all known and of size , while for dataset are all known and of size , where . The response variables lies within the range , whereas the independent variables are all positive.
How can I estimate the model coefficients (i.e. )?
Many thanks in advance for any guidance and consideration!
Attempt:
D_p = ... ; % size (1 x N_p)
D_v = ... ; % size (1 x N_v)
G_p = ... ; % size (1 x N_p)
G_v = ... ; % size (1 x N_v)
SF_p = ... ; % size (1 x N_p)
SF_v = ... ; % size (1 x N_v)
x0 = [0.1, 0.01, 0.00001, 0.00001]; % [alpha, beta, delta_p, delta_v]
x = lsqnonlin(@(params) modelfunc(params, D_p, D_v, G_p, G_v, SF_p, SF_v), x0);
function [F] = modelfunc(params, D_p, D_v, G_p, G_v, SF_p, SF_v)
alpha = params(1);
beta = params(2);
delta_p = params(3);
delta_v = params(4);
f_p = SF_p - exp(-alpha.*D_p - beta.*(D_p.^2) + delta_p.*G_p);
f_v = SF_v - exp(-alpha.*D_v - beta.*(D_v.^2) + delta_v.*G_v);
F = [f_p; f_v];
end
  7 个评论
Star Strider
Star Strider 2023-7-19
Another option is something like this:
res(~isfinite(res)) NaN;
res = fillmissing(res,'nearest');
Choose whatever fillmissing fill method is most appropriate.
De Ar
De Ar 2023-7-19
Had some normalization problems with SF_p and SF_v - it is now fixed. The range of "res" is between -1 and 1. Still, when running lsqnonlin(@(params) modelfunc(params, D_p, D_v, G_p, G_v, SF_p, SF_v), [0,0,0,0]), I am getting:
Error using lsqncommon
Objective function is returning undefined values at initial point. lsqnonlin cannot continue.

请先登录,再进行评论。

回答(1 个)

Matt J
Matt J 2023-7-19
编辑:Matt J 2023-7-19
Since the error message is complaining about the initial point, you should check the value of modelfunc() at the initial point.
Generally speaking though, your initial guess looks somewhat arbitrary. Since your model is log-linear, I would choose the initial point by fitting log(SF) to a linear model, using lsqlin, which doesn't require an initial guess. You should also consider putting bounds or linear inequality constraints on the parameters to prevent the underflow and overflow of the exp() operations which Torsten was referring to.
  3 个评论
Torsten
Torsten 2023-7-25
  1. Check your input arrays D_p, D_v, G_p, G_v, SF_p, SF_v for Inf or NaN values (any(isinf(D_p)),any(isnan(D_p)),...)
  2. Use F = [f_p, f_v]; instead of F = [f_p; f_v];
  3. Try
D_p = ... ; % size (1 x N_p)
D_v = ... ; % size (1 x N_v)
G_p = ... ; % size (1 x N_p)
G_v = ... ; % size (1 x N_v)
SF_p = ... ; % size (1 x N_p)
SF_v = ... ; % size (1 x N_v)
x0 = [0.1, 0.01, 0.00001, 0.00001]; % [alpha, beta, delta_p, delta_v]
res = modelfunc(x0, D_p, D_v, G_p, G_v, SF_p, SF_v)
and inspect "res" for Inf or NaN values (any(isinf(res)),any(isnan(res)))
Matt J
Matt J 2023-7-25
编辑:Matt J 2023-7-25
The reason I did not fit log(SF) to a linear model is because SF contains 0 values, which are quite essential in the analysis.
SF should never be zero if SF=exp(....something...). Those data should probably be discarded.
However, I am still getting..Objective function is returning undefined values at initial point.
My advice on that has not changed: "you should check the value of modelfunc() at the initial point."

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Support Vector Machine Regression 的更多信息

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by