FittedModel Objects... How does Mathematica do it?

*To*: mathgroup at smc.vnet.net*Subject*: [mg115432] FittedModel Objects... How does Mathematica do it?*From*: telefunkenvf14 <rgorka at gmail.com>*Date*: Tue, 11 Jan 2011 00:33:11 -0500 (EST)

Group: LinearModelFit (and similar statistical functions) are documented with examples such as: data = {{0, 1}, {1, 0}, {3, 2}, {5, 4}}; lm = LinearModelFit[data, x, x] which returns a FittedModel 'object'. One can then execute code such as lm["FitResiduals"] or lm["RSquared"] to retrieve the properties one desires. 1. How exactly does Mathematica generate/store the objects associated with the head 'lm'?!? I'd *really* appreciate a simple example of how to do this and/or some tips on when/how to use more complicated head structures. 2. And taking that one step further, how does Mathematica generate/ store additional info, such as 'Descriptions' on specific properties? For example, lm["ParameterErrors", "LongDescription"], returns "standard errors for parameter estimates". 3. Does Mathematica immediately calculate and store all these lm{"objects"], or are they generated (where appropriate) only when requested? (And is this really OOP? <-- not intended to start an OOP flame war!) 4. (Possibly related, so I figured I'd include it...) How does Mathematica store all the metadata available on example data sets?--- Is there documentation on how to conform to this standard/approach? For instance: ExampleData[{"Matrix","FIDAP007"}, "Properties"]. (on second thought, I guess this is probably stored in some standard file format, hidden from view...) Thanks for any info and guidance you can provide, -RG