-------------------------------------------- lines 5-59 of file: example/user/compress.py -------------------------------------------- # {xrst_begin user_compress.py} # {xrst_spell # def # } # {xrst_comment_ch #} # # Using Data Interval Compression # ############################### # # Purpose # ******* # This example shows how to use the # :ref:`compression intervals` option. # # Integrands # ********** # For this example there are one integrand, ``Sincidence`` . # # Nodes # ***** # There is only one node called ``world`` for this example. # There are no random effects because there are no child nodes. # # True Iota # ********* # For this example, the true model incidence rate *iota* is # {xrst_code py} def iota_true(age) : return 0.01 * ( 1 + ((age - 50) / 50)**2 ) # {xrst_code} # # Model # ***** # There is only one rate *iota* and it piecewise linear in age # with knots at the age points 0, 50, and 100. # # Data # **** # There is one data point measuring Sincidence # with the true value of *iota* at times 0.0, 50, 100. # The corresponding age intervals are [0,0], [0,100], [100,100]. # The age interval for the second measurement should be [50,50] # and using interval compression with make it so. # This is a cooked up example where interval compression makes the solution # more accurate. Under normal circumstances, the answer less accurate # but faster to compute. # # Source Code # *********** # {xrst_literal # BEGIN PYTHON # END PYTHON # } # # {xrst_end user_compress.py}