New in Wolfram Mathematica 7: Statistical Model Analysis  previous | next 
Compare Models for Probabilities
Fit, plot and compare residual deviances for binomial generalized linear models with a variety of link functions.
In[1]:=

Click for copyable input
data = BlockRandom[SeedRandom[1]; 

   RandomReal[{.8, 1}, 20] Table[(x - 1)/(1 + x), {x, 20}]];
In[2]:=

Click for copyable input
links = {"LogitLink", "ProbitLink", "LogLogLink", "LogComplementLink",

    "ComplementaryLogLogLink", "OddsPowerLink"};

models = Map[

   GeneralizedLinearModelFit[data, {x, x^2}, x, 

     ExponentialFamily -> "Binomial", LinkFunction -> #] &, links];

Column[{Show[ListPlot[data, PlotRange -> All], 

   Plot[Evaluate[Map[Normal, models]], {x, 1, 20}]], 

  Style[Grid[

    Join[{{"Link Function", "Residual Deviance"}}, 

     SortBy[Transpose[{links, 

        Table[fun["ResidualDeviance"], {fun, models}]}], Last]], 

    Dividers -> All], "DialogStyle"]}, Alignment -> Center]
Out[2]=