---------------------------------------------- lines 5-275 of file: xrst/model/data_like.xrst ---------------------------------------------- {xrst_begin data_like} {xrst_spell ij ll } Data Likelihood and Weighted Residuals ###################################### Notation ******** i = We use :math:`i` to denote the :ref:`data_table@data_id` for a row in the data table. a_i === We use :math:`a_i` to denote the corresponding :ref:`data_table@age_lower` value. b_i === We use :math:`b_i` to denote the corresponding :ref:`data_table@age_upper` value. d_i === We use :math:`d_i` to denote the :ref:`data_table@density_id` and :ref:`data_table@eta` value corresponding to :math:`i`. I_i === We use :math:`I_i` to denote the corresponding :ref:`data_table@integrand_id` value. s_i === We use :math:`s_i` to denote the corresponding :ref:`data_table@time_lower` value. t_i === We use :math:`t_i` to denote the corresponding :ref:`data_table@time_upper` value. w_i === We use :math:`w_i (a, t)` for the weighting as a function of age and time that corresponds to the :ref:`data_table@weight_id` for this *data_id* . .. math:: \bar{w}_i = \int_{a(i)}^{b(i)} \int_{s(i)}^{t(i)} w_i (a,t) \; \B{d} t \; \B{d} a x_ij ==== We use :math:`x_{i,j}` to denote the corresponding :ref:`covariate` values where :math:`j` denotes the :ref:`covariate_table@covariate_id` . Note that the covariate :ref:`covariate_table@reference` has already been subtracted from these values. y_i === We use :math:`y_i` to denote the corresponding :ref:`data_table@meas_value` value. Minimum CV Standard Deviation, Delta_i ====================================== Let *minimum_meas_cv* be the integrand table :ref:`integrand_table@minimum_meas_cv` corresponding to this integrand :math:`I_i`. Let :ref:`data_table@meas_std` and :ref:`data_table@meas_value` correspond to this data table :ref:`data_table@data_id` . The minimum cv standard deviation is defined by :math:`\Delta_i =` ``max`` ( *meas_std* , *minimum_meas_cv* * | *meas_value* | ) Fixed Effects, theta ==================== We use :math:`\theta` to denote the vector of :ref:`fixed effects` . Random Effects, u ================= We use :math:`u` to denote the vector of :ref:`random effects` . There is a different random effects vector :math:`u` for each child. The *node_id* for each data point determines the random effects for :ref:`data_table@node_id@Child Data` . Note that there are no random effects for :ref:`data_table@node_id@Parent Data` . This corresponds to :math:`u = 0`. Average Integrand, A_i(u, theta) ================================ Let :math:`A_i ( u , \theta )` denote the :ref:`average integrand` for this *data_id* . Measurement Noise Covariates **************************** K_i === There is a set of rows in the mulcov table such that :ref:`mulcov_table@integrand_id` is equal to :math:`I_i` and :ref:`mulcov_table@mulcov_type` is equal to ``meas_noise`` . We use :math:`K_i` to denote the corresponding set of :ref:`mulcov_table@covariate_id` values for which this is the case. gamma_j (a, t) ============== For each covariate index :math:`j \in K_i` , we use :math:`\gamma_j (a, t)` to denote the piecewise linear function corresponding to the :ref:`group covariate multiplier` variables for the corresponding :ref:`mulcov_table@mulcov_id` . Note that these are only :ref:`mulcov_table@mulcov_type@meas_noise` covariate multipliers. Average Noise Effect, E_i(theta) ================================ We define the average noise effect by .. math:: E_i ( \theta ) = \frac{1}{\bar{w}_i} \int_{a(i)}^{b(i)} \int_{s(i)}^{t(i)} \left( \sum_{j \in K_i} x_{i,j} \gamma_j (a, t) \right) w_i (a,t) \; \B{d} t \; \B{d} a Adjusted Standard Deviation, sigma_i(theta) ******************************************* For :math:`j \in K_i` it should hold that :math:`0 \leq x_{i,j}`, and :math:`0 \leq \gamma_j (a, t)` so that :math:`\Delta_i` is less than or equal :math:`\sigma_i ( \theta )` defined below. It is important to realize that :math:`\sigma_i ( \theta )` has the same units as the data. Scaling ======= For some cases below, :math:`E_i ( \theta )` multiplies the :ref:`Delta_i` instead of multiplying :math:`y_i`. This avoids have no effect when :math:`y_i` is zero. It is also possible to scale :math:`E_i ( \theta )` by any factor one chooses by changing the value of the covariates :math:`x_{ij}`; see the definition of :math:`E_i ( \theta )` above. Add Variance or Standard Deviation ================================== Adding standard deviations requires fewer floating point operations (for every data point) but this is not expected to be significant. In addition, if the covariate value is one, the covariate multipliers have the same units as the data. On the other hand, an initial value of zero does not work well in this case because the derivative of the object with respect to the multiplier is zero. Adding variances does not have this problem, but when the covariate value is one, the covariate multipliers have data squared units. add_std_scale_none ================== If *meas_noise_effect* is ``add_std_scale_none`` (add standard deviations and no scaling) the adjusted standard deviation is .. math:: \sigma_i ( \theta ) = \Delta_i + E_i (\theta) add_std_scale_all ================= If :ref:`option_table@meas_noise_effect` is ``add_std_scale_all`` (add standard deviations and scale all cases) the adjusted standard deviation is .. math:: \sigma_i ( \theta ) = \Delta_i [ 1 + E_i (\theta) ] add_var_scale_none ================== If *meas_noise_effect* is ``add_var_scale_none`` (add variances and no scaling) the adjusted standard deviation is .. math:: \sigma_i ( \theta ) = \sqrt{ \Delta_i^2 + E_i (\theta) } add_var_scale_all ================= If *meas_noise_effect* is ``add_var_scale_all`` (add variances and scale all cases) the adjusted standard deviation is .. math:: \sigma_i ( \theta ) = \Delta_i \sqrt{ 1 + E_i (\theta) } Transformed Standard Deviation, delta_i(theta) ********************************************** The transformed standard deviation is .. math:: \delta_i = \left\{ \begin{array}{ll} \log[ y_i + \eta_i + \sigma_i ] - \log( y_i + \eta_i ) & \R{if \; log \; density} \\ \sigma_i & \R{otherwise} \end{array} \right. Weighted Residual and Likelihood ******************************** The :ref:`weighted residual` is a function of the random effects :math:`u` and the fixed effects :math:`\theta`, .. math:: R [ y_i \W{,} A_i ( u, \theta ) \W{,} \delta_i ( \theta ) \W{,} d_i ] The likelihood is .. math:: \B{p}( y_i | u , \theta ) = \exp \left( D [ y_i \W{,} A_i ( u, \theta ) \W{,} \delta_i ( \theta ) \W{,} d_i ] \right) see the log-density function :ref:`D` . {xrst_end data_like}