| Algorithm 2: Best subset selection of M co-integrated nodes from N − 1 candidates for each of N nodes |
| 1: # Search for the best subset of M sensors for each individual sensor, i |
| 2: M ← number of sensors in the subset |
| 3: for each sensor i do |
| 4: searchspace ← set of all sensors minus sensor i |
| 5: bestsubset[i] ← NULL |
| 6: for j = 1 to M do {add one more sensor to best subset for i} |
| 7: lowest estimation error ← infinity |
| 8: for each sensor k in searchspace |
| 9: fit linear model to sensor i using (k + bestsubset[i]) |
| 10: if estimation error from linear model < lowest estimation error |
| 11: lowest estimation error ← estimation error from linear model |
| 12: bestsensor ← k; |
| 13: end if |
| 14: end for |
| 15: searchspace ← searchspace − bestsensor |
| 16: bestsubset[i] ← bestsubset[i] + bestsensor |
| 17: end for |
| 18: end for |