Correlation  and Regression analysis,  (part two)

Needs["Statistics`DescriptiveStatistics`"]

Needs["Statistics`DataManipulation`"]

Needs["Statistics`MultiDescriptiveStatistics`"]

Needs["Graphics`Graphics`"]

Needs["Graphics`MultipleListPlot`"]

Let' s take the data from the lecture notes .

\(\(MH = {
	{"Finland", \ 18045, 
            83.53}, 
		{"The Netherlands", \ 14449.80, \ 
            71.38}, 
		{"Denmark", \ 19842.15, 
            64.79}, 
		{"USA", \ 17670.15, 
            41.21}, 
		{"Spain", \ 7563.70, 
            9.17}, 
		{"Japan", \ 19763.63, 54.98}
	};\)\)

TableForm[MH]

\(ListPlot[Column[MH, {3, 2}], \ 
      AxesLabel -> {"Mental Health", \ "GDP"}, 

      Prolog\  -> \ AbsolutePointSize[5]]\)

r = Correlation[Column[MH, 2], Column[MH, 3]]

b = 
      r*(StandardDeviation[Column[MH, 2]]/
            StandardDeviation[Column[MH, 3]])

a  =  Mean[Column[MH, 2]]  -  b*Mean[Column[MH, 3]]

Predict = Table[{x, a + b*x}, {x, 10, 80, 10}]

TableForm[Predict]

\(MultipleListPlot[Column[MH, {3, 2}], 
      Predict, \ \ 
	\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ PlotJoined\  -> \ {False, \ 
          True}, 
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ AxesLabel\  -> \ {"Mental Health", "GDP"}]\)