public double[] power(double[,] x, double[] y, int variables, int watches) { double[] p = new double[watches]; for (int i = 0; i < watches; i++) { _1st_step.y1[i] = Math.Log(y[i]); } for (int i = 0; i < watches; i++) { _1st_step.x1[i, 1] = x[i, 1]; } Regession sle = new Regession(); double[] b = sle.SLE(x, _1st_step.y1, variables, watches); for (int i = 0; i < variables + 1; i++) { _1st_step.b0[i] = b[i]; } for (int i = 0; i <= variables; i++) { b[i] = Math.Exp(b[i]); } for (int i = 0; i < watches; i++) { p[i] = b[0] * Math.Pow(b[1], x[i, 1]); } return(p); }
public double[] repres(double[,] x, double[] y, int variables, int watches) { double[] p = new double[watches]; double[,] o = new double[watches, variables + 1]; for (int i = 0; i < watches; i++) { _1st_step.y1[i] = Math.Log(y[i]); } for (int i = 0; i < watches; i++) { for (int j = 0; j <= variables; j++) { _1st_step.x1[i, j] = Math.Log(x[i, j]); } _1st_step.x1[i, 0] = 1; } Regession sle = new Regession(); double[] b = sle.SLE(_1st_step.x1, _1st_step.y1, variables, watches); for (int i = 0; i < variables + 1; i++) { _1st_step.b0[i] = b[i]; } b[0] = Math.Exp(b[0]); for (int i = 0; i < watches; i++) { p[i] = b[0] * Math.Pow(x[i, 1], b[1]); } return(p); }
public double[] linear(double[,] x, double[] y, int variables, int watches) { double[] p = new double[watches]; Regession sle = new Regession(); double[] b = sle.SLE(x, y, variables, watches); for (int i = 0; i < variables + 1; i++) { _1st_step.b0[i] = b[i]; } for (int i = 0; i < watches; i++) { _1st_step.y1[i] = y[i]; } for (int i = 0; i < watches; i++) { _1st_step.x1[i, 1] = x[i, 1]; } for (int i = 0; i < watches; i++) { p[i] = 0; for (int j = 0; j < b.Length; j++) { p[i] += x[i, j] * b[j]; } } return(p); }