summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-05-11 10:25:51 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-05-11 10:25:51 +0200
commit24c763e80a62e4fa73d4a298083db3e3ec0887a2 (patch)
treebd0ccfa68795f8faac6189c03afe10f29d06e1fe
parent241d4a8570d5f7b766c76ca20e4d2454ba4ee4c8 (diff)
downloaddmc-24c763e80a62e4fa73d4a298083db3e3ec0887a2.tar.gz
dmc-24c763e80a62e4fa73d4a298083db3e3ec0887a2.tar.bz2
dmc-24c763e80a62e4fa73d4a298083db3e3ec0887a2.zip
mean/rand_pred: Use same function prototype as regress_pred
The number of days is implicit in the size of the given price and quantity matrices.
-rw-r--r--mean_pred.m3
-rw-r--r--rand_pred.m3
-rw-r--r--run_tests.m4
3 files changed, 6 insertions, 4 deletions
diff --git a/mean_pred.m b/mean_pred.m
index bc0edd0..4cd3e06 100644
--- a/mean_pred.m
+++ b/mean_pred.m
@@ -1,5 +1,6 @@
-function pred_mat = mean_pred(data, days)
+function pred_mat = mean_pred(price, data)
+ days = size(price, 1) - size(data, 1);
pred_mat = repmat(mean(data), days, 1);
endfunction
diff --git a/rand_pred.m b/rand_pred.m
index 5ed4be3..2e38e80 100644
--- a/rand_pred.m
+++ b/rand_pred.m
@@ -1,5 +1,6 @@
-function pred = rand_pred(data, times)
+function pred = rand_pred(price, data)
+ times = size(price, 1) - size(data, 1);
pred = abs(normrnd(mean(data), sqrt(var(data))));
for i = 1:(times-1)
diff --git a/run_tests.m b/run_tests.m
index c4364ef..ee8853e 100644
--- a/run_tests.m
+++ b/run_tests.m
@@ -6,13 +6,13 @@
train_data = q( 1:28, :);
real_data = q(29:42, :);
-mean_data = mean_pred(train_data, 14);
+mean_data = mean_pred(p, train_data);
regress_data = regress_pred(p, train_data);
quad_data = quad_regress_pred(p, train_data);
log_data = log_regress_pred(p, train_data);
lq_data = [log_data(:,1:334) quad_data(:,335) log_data(:,336:570)];
sevenday_data = repmat(sevenday_pred(train_data, 4), 2, 1);
-random_data = rand_pred(train_data, 14);
+random_data = rand_pred(p, train_data);
[q2, removed] = remove_sevenday_frequency(q(1:14, :));
regress2_data = regress_pred(p([1:14 29:42],:), q2);