INTC (Intel Corporation) revenues for past few years (source: https://stockrow.com/INTC ) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 53999, 53341, 52708, 55870, 55355, 59387, 62761, 70848, 71965, 77867, 73753, 73273, 75907 -------------------------------------------------------------------- OCTAVE octave:1> format long octave:2> X = [ 1 2011; 1 2012; 1 2013; 1 2014; 1 2015; 1 2016; 1 2017; 1 2018; 1 2019; 1 2020; 1 2021; 1 2022]; octave:3> Y = [ 53999; 53341; 52708; 55870; 55355; 59387; 62761; 70848; 71965; 77867; 73753; 73273]; octave:4> w = inv(X'*X)*X'*Y w = -4887312.92333068978 2455.11538474036 octave:5> [1 2030]*w ans = 96571.3076922437 ***this is an alternate way of solving it; when X's cols > rows. octave:6> w = X'*inv( X*X' + 0.0000001*eye(12,12))*Y w = -4875445.77506429516 2449.63078665733 -------------------------------------------------------------------- JAVA $ javac hw4hint.java $ java hw4hint w = -4887312.923077829, 2455.115384615279 2030 prediction = 96571.30769118667 code: public class hw4hint { public static double[] t(double[] x,int rows, int cols){ double[] o = new double[x.length]; for(int i=0;i