-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathregstresstest.js
43 lines (39 loc) · 1.02 KB
/
regstresstest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var sylvester = require('sylvester'),
ols = require('./ols.js');
function randomreg(n,k){
var Y = sylvester.Matrix.Random(n,1),
X = sylvester.Matrix.Random(n,k),
time = ols.reg(Y,X,true).overall.Time;
return time;
}
console.log("Observation test...");
var sec = 0,
i = 0,
step = 50,
maxobs = 0-step,
obslimit = 1;
while (sec<=obslimit){
maxobs+= step;
i+=1;
var n = (i)*step,
k = 1,
sec = randomreg(n,k);
console.log("N: "+n+", K:"+k+", Sec: "+sec);
}
console.log("Param test...");
var sec = 0,
i = 0,
step = 5,
maxparams = 0-step,
paramslimit = 1;
while (sec<=paramslimit){
maxparams+= step;
i+=1;
var n = (i*step)+2,
k = i*step,
sec = randomreg(n,k);
console.log("N: "+n+", K:"+k+", Sec: "+sec);
}
console.log("Maximum observations in "+obslimit+" second(s) with one parameter: " + maxobs);
console.log("Maximum parameters in "+paramslimit+" second(s) with minimum observations: " + maxparams);
console.log("Stress test complete.");