--------------------------------------- lines 6-103 of file: example/relrisk.py --------------------------------------- {xrst_begin relrisk} {xrst_spell avgint mtexcess sincidence } Example Fitting Relative Risk Data ################################## Nodes ***** The following is a diagram of the node tree for this example (the :ref:`glossary@root_node` is n0):: n0 /-----/\-----\ n1 n2 / \ / \ n3 n4 n5 n6 {xrst_literal # BEGIN node_table # END node_table } Discussion ********** This example is interesting because it gives a prefect fit to the data for all nodes except node n0. This is because there is two levels of random effects for node n0, one level of random effects for node n1 and n2, and no random effects for nodes n3, n4, n5, n6. relative_tolerance ****************** This is the relative tolerance that we will use when checking that the results are correct: {xrst_literal # BEGIN relative_tolerance # END relative_tolerance } The fixed effect values for nodes n1 through n6 are checked to see that they are correct to this tolerance. The random effects for node n3, corresponding to the fit of node n1, is also checked. Note that all the random effects are zero except for the omega constraints. In addition, the leaf nodes n3, n4, n5, and n6 do not have any omega random effects. fit_goal_set ************ The :ref:`glossary@fit_goal_set` is the leaf nodes: {xrst_literal # BEGIN fit_goal_set # END fit_goal_set } rate_true ********* The true value of the rates (for this example) are: {xrst_literal # BEGIN rate_true # END rate_true } Rate Priors *********** The fitted rates for this example are iota and chi (rho is zero and omega is constrained to have its true value). The parent and child priors each fitted rate is set as follows {xrst_literal # BEGIN prior_table # END prior_table } Data Table ********** Each leaf node has two data values, the true value of Sincidence and relrisk for the node. avgint Table ************ Each leaf node has predictions for three avgint values, Sincidence, mtexcess, and relrisk. The values corresponding to the fit for each leaf node is compared to the truth using :ref:`check_cascade_node-name` . Source Code *********** {xrst_literal # BEGIN PYTHON # END PYTHON } {xrst_end relrisk}