---------------------------------------------------- lines 5-74 of file: example/user/zsum_mulcov_meas.py ---------------------------------------------------- # {xrst_begin user_zsum_mulcov_meas.py} # {xrst_comment_ch #} # # Constrain Sum of Subgroup Measurement Covariate Multipliers to Zero # ################################################################### # # See Also # ******** # :ref:`user_zsum_child_rate.py-name` , # :ref:`user_zsum_mulcov_rate.py-name` # # Purpose # ******* # This example demonstrates using # The :ref:`option_table@Zero Sum Constraints@zero_sum_mulcov_group` # to improve the speed and accuracy of estimation of the fixed effects. # # Problem Parameters # ****************** # {xrst_literal # begin problem parameters # end problem parameters # } # Note that the measurement coefficient of variation *measurement_cv* # is very small so that a small number of data points can be used. # You should be able to increase the coefficient of variation by a factor, # so long as you increase the number of data points by the factor squared. # # Data Simulation # *************** # The true rate for the parent region ``north_america`` , # used for simulating data, are # *iota_parent* and *rho_parent* problem parameters. # The # :ref:`model_variables@Random Effects, u@Subgroup Covariate Multipliers` # for ``canada`` is *subgroup_mulcov* # and for the ``united_states`` is ``-`` *subgroup_mulcov* . # These multipliers effect the rates (not the measurements). # # Nodes # ***** # There are just three nodes for this example, # The parent node, ``north_america`` , and the two child nodes # ``united_states`` and ``canada`` . # The child rate effects are constrained to be zero # to simplify the example. # # Model Variables # *************** # The non-zero fixed effects for this example are # :ref:`rate_table@rate_name@iota` and *rho* # for the parent node ``north_america`` . # The non-zero random effects are the subgroup measurement covariate multipliers # for the ``united_states`` and ``canada`` . # The parent rates and subgroup covariate multipliers use a grid with # one point in age and two points in time. Thus there are six model variables # for each rate, two for the parent rates and four for the # covariate multipliers. # The resulting rates will be constant # in age and constant in time except between the two time grid points # where it is linear. # # Source Code # *********** # {xrst_literal # BEGIN PYTHON # END PYTHON # } # # {xrst_end user_zsum_mulcov_meas.py}