summaryrefslogtreecommitdiff
path: root/regress_pred.m
blob: 0c66b1e3065f8780b53aef74fac69f5292ca9215 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function pred = regress_pred(price, quantity)

	days = size(price, 1) - size(quantity, 1);
	product_count = size(price, 2);
	test_count = size(quantity, 1);
	test_set = 1:test_count;
	pred_set = test_count+1:size(price, 1);

	pred = zeros(days, product_count);
	for i = 1:product_count
		[m,n] = regress(price(test_set, i), quantity(test_set, i));
		pred(:, i) = m .* price(pred_set, i) + n;
	end

endfunction