\(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\R}[1]{ {\rm #1} }\)
remission¶
View page sourceExample Estimation With Remission and No Incidence Data¶
For this example everything is constant in time so the functions below do not depend on time.
Nodes¶
The following is a diagram of the node tree for this example. The root_node is n0, the fit_goal_set is equal to the leaf set {n3, n4, n5, n6}:
n0
/-----/\-----\
n1 n2
/ \ / \
n3 n4 n5 n6
fit_goal_set¶
fit_goal_set = { 'n3', 'n4', 'n5', 'n6' }
Rates¶
The non-zero dismod_at rates for this example are iota, rho, and omega. For rate equal to iota, rho, and omega, we use rate(a, n) to denote the value for rate as a function of age a and node n.
Covariate¶
There are not covariates for this example.
Random Effects¶
For each node, there is a random effect on iota an rho that is constant in age and time. Note that the total effect for a leaf is the sum of its random effect plus its parents random effect.
s_n¶
We use s_n to denote the sum of the random effects for node n. The code below sets this sum using the name sum_random:
size_level1 = 0.2
size_level2 = 0.2
sum_random = { 'n0': 0.0, 'n1': size_level1, 'n2': -size_level1 }
sum_random['n3'] = sum_random['n1'] + size_level2;
sum_random['n4'] = sum_random['n1'] - size_level2;
sum_random['n5'] = sum_random['n2'] + size_level2;
sum_random['n6'] = sum_random['n2'] - size_level2;
Simulated Data¶
Random Seed¶
The random seed can be used to reproduce results. If the original value of this setting is zero, the clock is used get a random seed. The actual value or random_seed is always printed.
# random_seed = 1629371067
random_seed = 0
if random_seed == 0 :
random_seed = int( time.time() )
random.seed(random_seed)
print('remission: random_seed = ', random_seed)
rate_true(rate, a, t, n, c)¶
For rate equal to iota, rho, omega, this is the true value for rate in node n at age a, time t, and covariate values c. The time and covariate list are not used.
def rate_true(rate, a, t, n, c) :
effect = sum_random[n]
if rate == 'iota' :
return (1 + a / 100) * 1e-3 * math.exp(effect)
if rate == 'rho' :
return (1 + a / 100) * 1e-1 * math.exp(effect)
if rate == 'omega' :
return (1 + a / 100) * 1e-2 * math.exp(effect)
return 0.0
y_i¶
The simulated integrand for this example are Sincidence, and prevalence. The data is simulated without any noise but it is modeled as having noise.
n_i¶
Data is only simulated for the leaf nodes; i.e., each n_i is in the set { n3, n4, n5, n6 }. Since the data does not have any nose, the data residuals are a measure of how good the fit is for the nodes in the fit_goal_set.
a_i¶
For each leaf node, data is generated on the following age_grid:
age_grid = [0.0, 20.0, 40.0, 60.0, 80.0, 100.0 ]
Omega Constraints¶
The omega_constraint routine is used to set the value of omega in the parent and child nodes.
Parent Rate Smoothing¶
iota¶
This is the smoothing used in the fit_node model for iota. Note that the value part of this smoothing is only used for the root_node. This smoothing uses the age_gird and one time point. There are no dtime priors because there is only one time point.
Parent Rate Priors¶
The following is the value and dage priors used for the root_node
for rate in [ 'iota', 'rho' ] :
rate_50 = rate_true(rate, 50.0, None, 'n0', None)
prior_table.append( {
'name': f'{rate}_value_prior',
'density': 'gaussian',
'lower': rate_50 / 10.0,
'upper': rate_50 * 10.0,
'mean': rate_50,
'std': rate_50 * 10.0,
'eta': rate_50 * 1e-3,
} )
prior_table.append( {
'name': f'{rate}_dage_prior',
'density': 'log_gaussian',
'mean': 0.0,
'std': 4.0,
'eta': rate_50 * 1e-3,
} )
The mean and standard deviation are only used for the root_node. The create_shift_db routine replaces them for other nodes.
Child Rate Smoothing¶
This is the smoothing used for the random effect for each child of the fit_node. There are no dage or dtime priors because there is only one age and one time point in this smoothing.
Value Prior¶
The following is the value prior used for the children of the fit_node:
{ 'name': 'child_value_prior',
'density': 'gaussian',
'mean': 0.0,
'std': 1.0,
}
Checking The Fit¶
The results of the fit are checked by check_cascade_node using the avgint_table that was created by the root_node_db routine. The node_id for each row is replaced by the node_id for the fit being checked. routine uses these tables to check that fit against the truth.
Child |
Title |
|---|---|
remission.py |