模拟和估计概率模型

时间:2015-05-09 20:38:26

标签: matlab regression probability

我正在尝试模拟和估算probit model,但我无法产生预期的结果。这是我到目前为止编写的代码:

N = 10000;
b = [10;-1];

x1 = ones(N,1);
x2 = normrnd(5,1,N,1);
x  = [x1,x2];

u  = randn(N,1);

y  = x*b + u;

y1 = (y>5); 

negLogLik = @(theta) -sum(y1.*log(normcdf(x*theta))+...
                     (1-y1).*log(1-normcdf(x*theta)));
b_hat     = fminunc(negLogLik,[5;-0.8]);

0 个答案:

没有答案