regression - Matlab multivarible regresison with time dependent variables -
i'm trying develop code find significance of using auxiliary data source improve predictability of final product. have data ready in matlab, preferred program analysis.
i'm trying solve following equation.
p(t,i) = a(i) + b(i)*z(t,i) + c(i)*y(t,i) + d(i)*x(t,i) + e(i)*w(i)
where, p, z, y, x, w known, t , indices , wish find values a, b, c, d , e minimise difference between existing value of p , predicted value of p.
t = 1:20 , ~ 1:250000
eventually set value of e(i) 0 , see how improvement adding variable, before testing random number stream too.
if more detail needed try provide it, many thanks.
i've tried method suggested below because z, y , x values matrices output matrix sol 3 times width of t + 1 element of e. i've read further around , think method should 1 of either generalised linear model or panel regression model i'm not sure how set 1 up. i've re-read examples mathworks few times , still confused.
you can calculate coefficients using mldivide
, matlab give least-squares solution overdetermined system. if understand question correctly, want calculate coefficients every i
, have iterate on i
.
in code, (untested):
for i=1:250000 m = [ones(size(p(:,i))), z(:,i), y(:,i), x(:,i), w(:,i)]; sol = m\p(:,i); a(i) = sol(1); b(i) = sol(2); c(i) = sol(3); d(i) = sol(4); e(i) = sol(5); end
you can find further information in documentation.
Comments
Post a Comment