TOBIT function error message
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi!
I'm quite new to MATLAB and I get strange error message I can't understand: "Error using MLobjective_1 (line 3) Not enough input arguments." My Code:
clc;
clear;
format('long');
load 'matlabdata'
X=[Y AGE MARRIED WOMAN KIDS ones(length(I),1)];
theta_ini=[0.1 0.1 0.1 1]';
options = optimset('display','iter','maxiter',10000,'maxfunevals',20000,'TolX',1e-12,'TolFun',1e-12);
tic
[theta,fval1,exitflag1,output1]=fminsearch(@(theta) MLobjective_1(theta,I,X),theta_ini,options)
toc
The function:
function f = MLobjective (theta,I,X)
beta=theta(1:4,1);
sigma=theta(5,1);
n=length(I);
for i=1:n;
if I(i,1)==0
lik_contribution(i,1)=(1-normcdf(X(i,:)*beta/sigma));
else
lik_contribution(i,1)=(1/sigma*normpdf(I(i)-X(i)*beta)/sigma);
end;
end
Can someone recognize where is the problem??
Thank you!
1 commentaire
Geoff Hayes
le 26 Avr 2015
Nitay - the error message is telling you that when MLobjective_1 is being called, not enough input arguments are being provided to it. According to the function signature, three inputs are expected (actually the signature is for a function named MLobjective - is this a typo or has a different function been provided?).
Réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!