# Modele cantidad de millas de gasolina en ciudad y en carretera con una distribución normal bivariada

Ajuste cantidad de millas de gasolina para ciudad y carretera a una distribución normal bivariada y compare las distribuciones esperadas y las millas esperadas por galón para millaje en ciudad para distintos millajes en carretera.
 In[1]:= XmidsizeMPG2009 = {{16, 22}, {18, 26}, {17, 25}, {16, 23}, {16, 23}, {14, 19}, {13, 19}, {10, 14}, {10, 17}, {18, 28}, {18, 27}, {17, 25}, {17, 25}, {17, 26}, {17, 26}, {16, 25}, {17, 25}, {15, 22}, {15, 23}, {11, 17}, {11, 17}, {17, 28}, {16, 24}, {16, 25}, {16, 25}, {17, 26}, {18, 26}, {17, 26}, {17, 25}, {17, 26}, {13, 19}, {15, 24}, {17, 26}, {15, 22}, {22, 33}, {22, 30}, {18, 29}, {17, 26}, {26, 34}, {21, 30}, {13, 20}, {19, 27}, {16, 27}, {21, 30}, {13, 20}, {19, 27}, {16, 27}, {24, 30}, {23, 27}, {23, 29}, {21, 25}, {19, 27}, {10, 15}, {9, 16}, {17, 25}, {20, 29}, {20, 28}, {18, 26}, {24, 33}, {25, 33}, {16, 25}, {15, 23}, {22, 32}, {22, 32}, {20, 28}, {23, 30}, {24, 32}, {19, 27}, {19, 26}, {18, 25}, {17, 24}, {16, 24}, {16, 23}, {16, 24}, {16, 23}, {20, 22}, {17, 25}, {20, 29}, {20, 28}, {18, 26}, {17, 24}, {18, 28}, {20, 29}, {21, 30}, {17, 25}, {18, 25}, {23, 32}, {17, 24}, {16, 22}, {15, 22}, {13, 19}, {13, 20}, {20, 27}, {16, 25}, {23, 32}, {23, 31}, {18, 27}, {19, 26}, {35, 33}, {19, 26}, {24, 30}, {21, 29}, {26, 31}, {27, 33}, {24, 32}, {11, 18}, {24, 30}, {24, 32}, {22, 33}, {17, 26}, {26, 34}, {21, 31}, {21, 31}, {19, 28}, {33, 34}, {48, 45}, {19, 29}, {15, 23}, {15, 22}, {16, 25}};
 In[2]:= Xedist = EstimatedDistribution[midsizeMPG2009, BinormalDistribution[{\[Mu]1, \[Mu]2}, {\[Sigma]1, \[Sigma]2}, \ \[Rho]]];
 In[3]:= XPartition[ Table[With[{mu = Round[Expectation[ x \[Conditioned] y == hwy, {x, y} \[Distributed] edist], .1]}, Plot[PDF[edist, {city, hwy}], {city, 0, 50}, PlotRange -> All, PlotStyle -> {Darker@ColorData[10, hwy/5 - 1], Thick}, Filling -> 0, FillingStyle -> Directive[Opacity[.3], ColorData[10, hwy/5 - 1]], Epilog -> Style[Text[ "\!\(\*SubscriptBox[\(\[Mu]\), \(city\)]\) = " <> ToString[mu], Scaled[{If[mu < 25, .7, .3], .8}]], Bold, FontFamily -> "Verdana"], PlotLabel -> Style["Highway mileage = " <> ToString[hwy], Bold, FontFamily -> "Verdana"]]], {hwy, 15, 40, 5}], 2] // GraphicsGrid
 Out[3]=