1

I have a model

y = a1 * x1 + a2 * x2 + ... + a20 * x20

y is in range [-100000, 100000]. It is important for me to get regression where I get minimum in relative errors. Absolute errors are less important.

What matlab function should I use? And how huge should be my sample?

And what is the easiest way to calculate R_adj ? Is R_adj a good variable for evaluating model you propose or it that model one should use something else?

4

1 回答 1

1

您是否考虑x过通过相应的y值对您的点进行归一化?您可能需要考虑将 , ,... 拟合到,而
不是将x_i1, x_i2, ...拟合x_i20到您拥有y_i的所有样本。 ix_i1/y_ix_i2/y_2x_i20/y_i1

如果您决定这样做,您需要构建一个X大小为n-by-的矩阵20i第 - 行是第i- 个样本)。然后:

>> n = size(x,1); % number of samples
>> nX = bsxfun( @rdivide, X, y); % divide each sample i with corresponding y_i
>> a = nX \ ones(n,1); % solution using normalization

您可以将此解决方案与非标准化最小二乘法进行比较

>> non_a = X \ y;
于 2013-10-09T09:43:37.843 回答