data=Import["H:\\historicalData_PX.csv","CSV"][[;;,-3]][[2;;]]

g1=ListLinePlot[data[[6;;]]]

modelSize=5;
A=Table[Table[data[[i+j-1]],{j,1,modelSize}],{i,1,35}]
y=data[[6;;40]]

xhat=LeastSquares[A,y]

yhat=A.xhat

g2=ListLinePlot[yhat,PlotStyle->{Red,Dashed}]

Show[g1,g2]

data2=Import["H:\\historicalData_PX2.csv","CSV"][[;;,-3]][[2;;]]

h1=ListLinePlot[data2[[6;;]]];
h2=ListLinePlot[A2.xhat,PlotStyle->{Red,Dashed}];
Show[h1,h2]

A2=Table[Table[data2[[i+j-1]],{j,1,modelSize}],{i,1,21}]