I think the first few lines are self explanatory, they just build up a list of rules and wrap them in head dispatch. In this particular example the rules pertain to fitted models and particular test results but the dispatch mechanism is quite general.
Basically dispatch here is a way of creating a property extraction mechanism similar in spirit to that of FittedModel with the key-value behavior of Dispatch.
Lets start in a fresh kernel...
dispatch[list_][field_] := field /. list
dispatch[list_]["Properties"] := list /. Rule[field_, _] :> field
dispatch /: ReplaceAll[fields_, dispatch[list_]] := fields /. list
Here is a list of dummy properties to work with.
propList = {"P1" -> 1, "P2" -> 2, "P3" -> 3};
Notice that dispatch[list] will remain unevaluated unless a sub value is requested.
dispatch[propList]
(* dispatch[{"P1" -> 1, "P2" -> 2, "P3" -> 3}] *)
The Format statement is just a way of hiding this output so that if we had a really long list of properties we wouldn't need to see them all.
Format[dispatch[list_], StandardForm] :=
HoldForm[dispatch]["<" <> ToString@Length@list <> ">"]
out = dispatch[propList]
(* dispatch[<3>]*)
Now lets look at what each of the previous definitions are doing. The first replaces the property 'field' with its value given in the list of rules. (NOTE: As was pointed out by @Martin John Hadley this sort of assignment (via SubValues) is not often documented but you will find it frequently used for property extraction. Look here for a detailed discussion about this sort of thing.)
out["P2"]
(* 2 *)
The second gives a list of field/property names contained in the dispatch object.
out["Properties"]
(* {"P1", "P2", "P3"} *)
The third definition allows dispatch to work like Dispatch by overloading ReplaceAll using TagSetDelayed creating an up value. Thus, if a list of properties is given we can replace them with their values contained in the dispatch object.
{"P2","P1","P3"} /. out
(* {2, 1, 3} *)
dispatchcreated inWithcontains a list of rules. The left-hand side of the rules are property names (in this case BreuschPagan and WhitesHeteroskedasticity) the right hand side are the values (here injected usingWith). – Andy Ross Mar 31 '14 at 13:16