Professional Documents
Culture Documents
12/04/18 04:43 PM D:/Users/mauricio - Gomez/pictu... /jacob.m 1 of 2
12/04/18 04:43 PM D:/Users/mauricio - Gomez/pictu... /jacob.m 1 of 2
12/04/18 04:43 PM D:/Users/mauricio - Gomez/pictu... /jacob.m 1 of 2
m 1 of 2
function f = jacob(mval,theta2)
% This function computes the Jacobian of the implicit function that defines the mean
utility
expmu = exp(mufunc(x2,theta2w));
shares = ind_sh(mval,expmu);
clear expmu
[n,K] = size(x2);
J = size(theta2w,2) - 1;
f1 = zeros(size(cdid,1),K*(J + 1));
f = zeros(size(cdid,1),size(rel,1));
n = 1;
12/04/18 04:43 PM D:\Users\mauricio.gomez\Pictu...\jacob.m 2 of 2
for i = 1:size(cdindex,1)
temp = shares(n:cdindex(i),:);
H1 = temp*temp';
H = (diag(sum(temp')) - H1)/ns;
f(n:cdindex(i),:) = - inv(H)*f1(n:cdindex(i),rel);
n = cdindex(i) + 1;
end