<!-- Copyright 2000 Duncan Temple Lang & Robert Gentleman --> 
<!-- A dtd for expressing model relationships -->

<!ENTITY relationship formula>

<!ELEMENT model (relationships, parameters, data) >
<!ATTLIST model
      name CDATA #IMPLIED 
>

<!ELEMENT relationships (%relationship;)* >

<!ELEMENT formula (LHS, (AS)?, RHS, error) >

<!ELEMENT LHS (symbol | tranformation ) >

<!ELEMENT symbol name >

<!ELEMENT transformation  (operation, (arg)+) >

<!ELEMENT operation (name) >
<!ELEMENT arg  (name) >

<!ELEMENT name #PCDATA >

<!ELEMENT AS  (name) >

<!ELEMENT RHS (predictor) >

<!-- we use math to get us into MathML -->
<!ELEMENT predictor (mathML:math) >

<!ELEMENT parameters (parameter)* >
<!ELEMENT parameter  (name?, value?, start?, prior?, constraints?, type?) >
<!ATTLIST parameter
     id  IDREF #IMPLIED > 

<!ELEMENT value (ANY) >

<!ELEMENT start (ANY) >

<!ELEMENT prior (distribution) >
<!ELEMENT distribution ((name | math), (arg)*)  >

<!ELEMENT constraints (constraint)* >
<!ELEMENT constraint (ANY) >

<!ELEMENT type (ANY) >

<!-- math is an expression that would generate the data -->
<!ELEMENT data (URI | RS:dataframe | RS:namedList | mathML:math ) > 

<!ELEMENT URI #PCDATA >

