Friday, December 27, 2019

Exercises with Linear Models


data=Values[Normal[ResourceData["Global Obesity Rates"][[All,3;;4]]]];
lm=LinearModelFit[data,x,x]; lm[{"BestFit","ParameterTable","RSquared"}]
TableForm[{ListPlot[{data,Table[{x,lm["BestFit"]},{x,0,.5,.005}]},ImageSize->400,
PlotStyle->{Gray,{Blue,Opacity[.1]}},Filling->{1->{2}}],
ListPlot[lm["CookDistances"],Filling->Axis,ImageSize->400],
ListPlot[Transpose[{data[[All,1]],lm["CookDistances"]}],
ImageSize->400,Filling->Axis]}]


No comments:

Post a Comment