How to solve unknown elements of a matrix in mle function?

I have been trying to find the unknown value of a basis function by using mle estimation method. My basis function consists of basis(x,k) where x is the data and k is the unknown parameter with (5X1) dimension say[k(1), k(2),k(3),k(4),k(5)]. My liklihood function estimation is like:
function Z=bbasis(x,k)
k=[k(1), k(2),k(3),k(4),k(5)];
z=[];
for i=1:5
Z=[x-k(i)];
z=[z,Z];
end
end
x=rand(20,1);
y=rand(20,1);
F=ones(20,1);
f = @(x,w) (2*3.1416)^-(20)*(det(bbasis(x,w)*rand(10,10)*bbasis(x,w)'))^(-.5)*exp(-.5*(y-F)'*inv(bbasis(x,w)*rand(10,10)*bbasis(x,w)')*(y-F))
lk=mle(x,'pdf','f','start',[0 0 0 0 0 ])
*I am getting the following error:*
Error using mlecustom (line 93)
The 'pdf' parameter value must be a function handle or a cell array
containing a function handle.
Error in mle (line 237)
phat = mlecustom(data,varargin{:});

3 Comments

You have your dimension mismatch problem I guess. bbasis(x,w) returns a 1*20 vector according to your code. Hence multiplyinh 1*20 matrix by rand(10,10) is wrong. You may need to check your pdf function again.
Thanks, I corrected that dimensional mismatch problem and redefine pdf which should be okay. But it is still giving me the same error.
have you updated the changes in the question above? If yes, then still there is dimension problem. bbasis1 returns 20*1 matrix and multiplying that with rand(10,10) is wrong. I suggest you to try giving some sample inputs to your pdf function and see if that works before working on mle first.

Sign in to comment.

Answers (0)

Asked:

on 26 Sep 2018

Commented:

on 4 Oct 2018

Community Treasure Hunt

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

Start Hunting!