【问题标题】:Regression in Matlab assuming Student's t Distributed Error TermsMatlab 中的回归假设学生的 t 分布误差项
【发布时间】:2011-01-19 06:09:03
【问题描述】:

我看到可以为 OLS 使用回归/注册统计,并且我找到了 L1-Regression (Laplace) 的在线实现,但我似乎不太明白如何实现 t 个分布式错误项。我已经尝试最大化残差的对数似然,但似乎没有提出正确的答案。

classdef student < handle
   methods (Static)

       % Find the sigma that maximizes the Log Liklihood function given a B
       function s = findLonS(r,df)
           n = length(r);

           % if x ~ t location, scale distribution with df 
           % degrees of freedom, then (x-u)/sigma ~ t(df)
           f = @(s) -sum(log(tpdf(r ./ s, df)));

           s = fminunc(f, (r'*r)/n);
       end

       function B = regress(X,Y,df) 
           [n,m] = size(X);

           bInit = ones(m, 1);

           r = (Y - X*bInit);
           s = student.findLonS(r, df);

           % if x ~ t location, scale distribution with df 
           % degrees of freedom, then (x-u)/sigma ~ t(df)
           f = @(b) -sum(log(tpdf((Y - X*b) ./ s, df)));

           options = optimset('MaxFunEvals', 10000, 'TolX', 1e-16, 'TolFun', 1e-16);
           [B, fval] = fminunc(f, bInit, options); 
       end
   end
end

与 R 实现(我知道它已经过测试并且是准确的)相比,我得到的解决方案是错误的。

任何修复建议或我可以找到现有解决方案的想法?

【问题讨论】:

    标签: matlab distribution regression


    【解决方案1】:

    我的猜测是你必须为给定的b 调整比例s。这要么意味着做一些事情,比如优化b,然后调整s,然后再次优化b,或者可能将你的目标重写为

    f = @(b)(-sum(log(tpdf((Y-X*b) ./ student.findLonS(Y-X*b,df),df))));
    

    【讨论】:

      猜你喜欢
      • 2021-04-08
      • 1970-01-01
      • 2015-06-30
      • 2020-05-25
      • 1970-01-01
      • 2017-10-07
      • 2020-03-10
      • 2016-04-09
      • 2017-05-27
      相关资源
      最近更新 更多