Initial value problem for fmincon

14 visualizzazioni (ultimi 30 giorni)
Prachi  Singh
Prachi Singh il 11 Mag 2016
Modificato: Walter Roberson il 12 Mag 2016
Hi,
I am trying to estimate 4 parameters for the following problem:
y = p(3) + p(4)*x + e
where e follows a two parameter(p(1), p(2)) weibull distribution.
The weibull parameters have to positive and the e(errors) have to be non-zero. These constraints have been incorporated in the fmincon function.
I have calculated the maximum likelihood :
Code:
--------------------------
clc
clear all
ydata=[-0.0102535; 3.465384; 1.339983; 0.1214859; 0.7818025; 0.7275869; 0.0531813; 5.575462; 3.08733; 1.080223; 1.737704; 2.061353; 0.5685122; 0.2161634; 1.110085; -0.1119129; 2.052543; 6.476873; 16.63553; 2.541557];
xdata=[0.2088342; 0.2623518; 0.2588278; 0.1772731; 0.1788281; 0.2012366; 0.1700758; 0.2797128; 0.2659542; 0.1669172; 0.4481468; 0.3407996; 0.2022935; 0.1687582; 0.2514656; 0.1750669; 0.2683606; 0.5407576; 0.9437701; 0.2935103];
p_initial = [2; 2; 0.1; -1.3];
A = zeros(20,1);
B = ones(20,1);
options=optimset('Display','iter','Algorithm', 'interior-point','MaxIter',10000,'TolX',10^-30,'TolFun',10^-30,'MaxFunEvals',400);
[p,fval] = fmincon(@(p) tryseven((p),xdata, ydata), p_initial,[A A B xdata],[ydata],[],[],[0; 0; -Inf; -Inf],[],[],options)
where @tryseven fucntion is the likelihood function:
function logl = tryseven(p, xdata, ydata)
a = p(1);
b = p(2);
f = p(3);
g = p(4);
h = size(xdata,2)*log(a);
i = size(xdata,2)*log(b);
j = (b-1)*(log(ydata - f - g*xdata));
k = a*((ydata - f - g*xdata).^b);
logl = [-sum(j(:)) + sum(k(:) -h -i)];
end
------------------------------
The problem is that my solution critically depends on the initial values that I choose. Can you tell me how to choose these initial values optimally?
Thanks alot!
Regards,
Prachi

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by