Data4DM / BayesSD

Data for Decision, Affordable Analytics for All
9 stars 0 forks source link

Data structure translated but not used in stan function #60

Closed hyunjimoon closed 2 years ago

hyunjimoon commented 2 years ago

The function dataFunc__std_normal_data_gamma is translated but not used in the vensim_ode_func.

vector vensim_ode_func(real time, vector outcome, real delta, real beta, real alpha, real gamma){
    vector[2] dydt;  // Return vector of the ODE function

    // State variables
    real predator = outcome[1];
    real prey = outcome[2];

    real alpha_mean = 0.8;
    real beta_mean = 0.05;
    real delta_mean = 0.05;
    real gamma_mean = 0.8;
    real predator_birth_rate = delta * prey * predator;
    real predator_death_rate = gamma * predator;
    real predator_dydt = predator_birth_rate - predator_death_rate;
    real prey_birth_rate = alpha * prey;
    real prey_death_rate = beta * predator * prey;
    real prey_dydt = prey_birth_rate - prey_death_rate;

    dydt[1] = predator_dydt;
    dydt[2] = prey_dydt;

    return dydt;
}
hyunjimoon commented 2 years ago

It's vensim file is

alpha=
    alpha mean + std normal data alpha * alpha mean * 0.1
    ~   1/Time [0,?]
    ~   prey birth fraction
    |

std normal data delta:INTERPOLATE:
    ~   Dmnl
    ~       |

beta=
    beta mean + beta mean * 0.1 * std normal data beta
    ~   1/(Time*pred)
    ~   prey death proportionality constant
    |

std normal data beta:INTERPOLATE:
    ~   Dmnl
    ~       |

delta=
    delta mean + std normal data delta * delta mean * 0.1
    ~   1/(Time * prey) [0,?]
    ~   predator birth fraction
    |

gamma=
    gamma mean + std normal data gamma * gamma mean * 0.1
    ~   1/Time
    ~   predator death proportionality constant
    |

alpha mean=
    0.8
    ~   1/Time
    ~       |

beta mean=
    0.05
    ~   1/(Time*pred)
    ~       |

delta mean=
    0.05
    ~   1/(Time * prey)
    ~       |

gamma mean=
    0.8
    ~   1/Time
    ~       |

std normal data alpha:INTERPOLATE:
    ~   Dmnl
    ~       |

std normal data gamma:INTERPOLATE:
    ~   Dmnl
    ~       |

predator birth rate=
    (delta*Prey)*Predator
    ~   pred/Time
    ~       |

predator death rate=
    gamma*Predator
    ~   pred/Time
    ~       |

Predator= INTEG (
    predator birth rate-predator death rate,
        4)
    ~   pred
    ~       |

prey birth rate=
    alpha*Prey
    ~   fraction/Time
    ~       |

prey death rate=
    (beta*Predator)*Prey
    ~   fraction/Time
    ~       |

Prey= INTEG (
    prey birth rate-prey death rate,
        30)
    ~   prey
    ~       |

********************************************************
    .Control
********************************************************~
        Simulation Control Parameters
    |

FINAL TIME  = 12
    ~   seasons
    ~   The final time for the simulation.
    |

INITIAL TIME  = 0
    ~   seasons
    ~   The initial time for the simulation.
    |

SAVEPER  = 
        TIME STEP 
    ~   seasons [0,?]
    ~   The frequency with which output is stored.
    |

TIME STEP  = 0.03125
    ~   seasons [0.001,0.04,0.001]
    ~   The time step for the simulation.
    |