The FAQs page provides answers to users' questions, along with links to other relevant articles within the User Guide.

**How can I define a variable where the value depends on strategy?**

You can easily define variables with values dependent on strategy using the by_strategy(…) function. When you use this function, you must specify a value for each strategy defined on the Strategies page, even if multiple strategies share the same value. If you don’t, the model will generate an error when you run it.

For example, if your model includes three strategies, ‘New_Rx’, ‘Old_Rx’, and ‘No_Tx’, and you want to assign the values 150, 75, and 75, respectively, to a particular variable, your by_strategy(…) function would look like:

Please remember to use the exact names that you assigned to strategies on the Strategies page. Also, please keep in mind R is case sensitive.

**How can I define a variable where the value depends on group?**

You can easily define variables with values dependent on group using the by_group(…) function. When you use this function, you must specify a value for each group defined on the Groups page, even if multiple groups share the same value. If you don’t, the model will generate an error when you run it.

For example, if your model includes two groups, ‘Children’ and ‘Adults’, and you want to assign the values 0.45 and 0.81, respectively, to a particular variable, your by_group(…) function would look like:

Please remember to use the exact names that you assigned to groups on the Groups page. Also, please keep in mind R is case sensitive.

**How can I reference a value stored in a table in my model? **

You can reference a value stored in a hēRo3 table by using the function, look_up(…). This function works similarly to the function, INDEX(…), in Excel, and uses both a row and column reference to identify and extract a value from a table. The arguments of this function, in order, are: (1) the name of the table; (2) a lookup value to indicate the row of interest and the column in which to look for a value; and (3) the name of the column from which you would like to extract the relevant value.

For example, if you wanted to extract the value, 990.3, which is the estimated cost of the adverse event, nausea, from the ‘Adverse_Events’ table shown below,

you would use the function, look_up(…), with syntax as follows:

Please be sure to spell the name of the table, as well as the names of the columns and values, the same way they are spelled in the table itself. Also, please keep in mind R is case sensitive.

**How can I calculate a patient’s current age in my model? **

You can easily calculate current age during any given cycle in a model using a simple formula that references patients’ starting age and the time that has elapsed since model entry. While you can hard code a numeric value for the former, it is best practice to create a variable, ‘start_age’, to refer to this value in formulas. To calculate current age in a given cycle, add the number of years elapsed since model start, which is represented by the hēRo3 keyword, ‘model_year’, to the age of patients at model entry. Because the first year of a model is assigned the value of 1 (and not 0) in hēRo3, it is important to subtract the hēRo3 keyword, ‘cycle_length_years’, from ‘model_year’ in your formula (if you don’t, patient age will be off by 1 year). The formula you would use would be as follows:

Please note that if you are not using annual cycles in your model, current age will not always be an integer.** **

**I want to calculate general population mortality rates in a model from a life table. Is there an easy way to do this in hēRo3?**

You can use the function, define_surv_lifetable(…) to calculate general population mortality rates from a life table (life tables can be copied from any convenient source and pasted into a table in hēRo3). When you use define_surv_lifetable(…), you need to reference the name of the life table, the starting age, the percentage of males in the population at the start of your model, and the unit of time in which mortality rates should be expressed.

Life tables in hēRo3 have to conform to a specific format. They must have a column labelled ‘age’ that contains patient age in years, a column labelled ‘male’ that contains the probability of death for males at each age, and a column labelled ‘female’ that contains the probability of death for females at these ages, *in that order*.

For example, if you had a life table called 'GP_Life_Table', your variable for starting age is ‘start_age’, and 'pct_male' represents the percentage of males in the cohort at the beginning of the model, your formula for calculating general population mortality rates would be as follows:

The final argument in the formula above, ‘output_unit’, refers to the unit of time in which mortality rates should be expressed. For example, if you want to use monthly mortality rates, set ‘output_unit’ to ‘months’. If you want to use annual mortality rates, set ‘output_units’ to ‘years’. You cannot generate quarterly mortality rates, however, since calendar quarters are not a fixed unit of time (ie, there are 92 days between 1 January and 31 March [except in leap years], but there are 91 days between 1 April and 30 June). If your model has quarterly periodicity, however, you can generate quarterly mortality rates by rescaling monthly mortality rates, by using the hēRo3 function, rescale_prob(…).

It is best practice to define and work with survival distributions on the Survival Distributions page, and then refer to them on the Transitions page by the variable names that you have given to them. (If you prefer to perform your survival calculations directly on the Transitions page, you may do so.)

**Is there an easy way to make sure my transitions from a given state sum to 1?**

Although there is no foolproof method to ensure that transitions from a given state sum to 1, hēRo3 has a helpful keyword, ‘C’, to simplify this task. The hēRo3 keyword, ‘C’, is a function that evaluates to 1 minus the sum of all other transitions from a given state (ie, the complement). (It is important to remember that hēRo3 is case-sensitive, and you must enter this function as ‘C’ and not ‘c’.) While you may use the hēRo3 keyword, ‘C’, to express the value of any transition, we think it is most helpful to use it for the probability that patients do * not* leave their current state for another one. Please note that the hēRo3 keyword, ‘C’, may only be used for one transition from a given state; if you use it for more than one transition out of a given state, your model will generate an error and will not run.

**I want to make a variable dependent on time; how can I do that in hēRo3?**

Variables can be made dependent on time simply by referencing one of the hēRo3 keywords for model time. The principal hēRo3 keywords for this are ‘model_day’, ‘model_week’, ‘model_month’, and ‘model_year’.

Assume you have a model that uses monthly periodicity, and you would like assign different costs to patients receiving a particular drug based on how long they have been taking it—for example, to assign the cost of induction therapy (‘induction_cst’) to the first 6 months, and thereafter, to assign the cost of maintenance therapy (‘maintenance_cst’) in all subsequent months. You would use the hēRo3 keyword, ‘model_month’, in a formula for drug cost that would look as follows:

This formula evaluates to ‘indcution_cst’ for the first 6 cycles of your model, and evaluates to ‘maintenance_cst’ for all subsequent cycles.

**When I try to run my model, I get an error message and my model will not run. What should I do?**

The User Guide provides a listing of many common error messages and what might be causing them, available here. There is also a slide deck on this topic, called “Tips & Tricks to Use When Debugging Models in hēRo3”, that you might find helpful. If after consulting these resources, you still are unable to get your model to run, you can always reach out to support@heroapps.io for assistance.

**If I want to apply a cost during the first year of my model, but not during any subsequent years, how can I do this?**

You can easily assign patients a cost only during the first year of your model by referencing one of the hēRo3 keywords for model time—specifically, ‘model_day’, ‘model_week’, ‘model_month’, or ‘model_year’.

For example, if your model has monthly periodicity and you would like to assign patients a monitoring cost only during the first year of treatment, you could use the hēRo3 keyword, ‘model_month’, in a formula that looks as follows:

In this example, patients would be assigned a monthly cost of monitoring, ‘cst_monitoring_m’, during the first 12 cycles of your model (ie, one year) and a cost of 0 in all subsequent cycles. You could enter this formula directly on the Values page, or you could create a variable on the Parameters page and reference it on the Values page. Either method is acceptable, so long as you use a consistent approach.

If your model uses annual cycles, rather than monthly cycles, your formula might look as follows:

By multiplying the monthly monitoring cost by the hēRo3 keyword, ‘cycle_length_months’, you are multiplying the monthly cost by the number of months in an annual cycle in this model. This calculates a total cost of monitoring over one year, based on the value specified for ‘cst_monitoring_m’ (ie, the monthly cost of monitoring). If you do not multiply the monthly cost by the hēRo3 keyword, ‘cycle_length_months’, you will apply the monthly cost of monitoring only once during the entire first year of your model.

**How can I calculate a sum product using the values stored in a table?**

There is an easy way to do a sum product in hēRo3, much as you can do so in Excel.

Assume you would like to calculate a total cost of all adverse events for a particular strategy in your model (say, ‘New_Rx’), and your adverse event data is stored in a hēRo3 table that contains, for several different types of adverse events, their probabilities of occurrence and their associated costs; your table might look as follows:

In table above, column A contains the names of all adverse events in your model, columns B, C, and D contain the probabilities of experiencing these events among patients receiving ‘No_Tx’, ‘Old_Rx’, and ‘New_Rx’, respectively, and column E contains the estimated cost of each adverse event.

Since there are no adverse events associated with ‘No_Tx’, you do not need to calculate the total cost of adverse events for this strategy. You can calculate a total expected cost of adverse events for ‘Old_Rx’ by multiplying the probability of each adverse event for this strategy (column C) times the corresponding cost of each event (column E), which is the same for all strategies. Your formula would look as follows:

You would have a similar formula for ‘New_Rx’, which would differ from the formula above only in the respect that the probabilities of each event would be drawn from the ‘New_Rx’ column; this formula would therefore look as follows:

Both of these formulas return the sum product of the relevant column containing probabilities for a given strategy and the cost of each adverse event, which does not vary between the strategies. If the unit costs of adverse events differed between strategies (eg, due to differences in severity), your table would contain two columns of costs—one to be used for ‘Old_Rx’, and the other to be used for ‘New_Rx’.

**I’m uncertain what method of half-cycle correction to use in my model; what’s the difference between the three methods on the Settings page?**

The method of half-cycle correction that you choose determines when during model cycles patients will transit between health states―at the beginning of each cycle, at the end of each cycle, or at the midpoint of each cycle. The three methods of half-cycle correction that you may choose from are as follows:

- With the Start method, patients are assumed to transition between health states at the
of every cycle; state membership during any given cycle is calculated__beginning__health-state transitions have occurred.__after__ - With the End method, patients are assumed to transition between health states at the
of every cycle; state membership during any given cycle is calculated__end__health-state transitions have occurred.__before__ - With the Life-Table method, which hēRo3 defaults to unless you select another method, patients are assumed to transit between health states at the
of each cycle, and state membership during any given cycle is calculated as the average of health-state membership before and after transitions have occurred.__midpoint__

If you have a model that has very short cycles (eg, daily or weekly), nominal differences between the three methods are typically small. If you have a model with very long cycles (eg, annual), however, the three methods can produce noticeably different results. It also is important to know that if you use the Start method and your model incorporates mortality, some patients will immediately die at model entry and not contribute any membership time to any state other than ‘dead’.

**I don’t know which method of discounting to choose on the ****Settings ****page in my model; what’s the difference between the three methods?**

The discounting method that you choose determines how outcomes and costs are discounted in your model to reflect the time value of money (as well as health). The three methods of discounting that you may choose from are as follows:

- With the Start method, which hēRo3 defaults to unless you select another method, discount factors for outcomes and costs during each model cycle are based on the value of time at the
of every cycle.__beginning__ - With the End method, discount factors for outcomes and costs during each model cycle are based on the value of time at the
of every cycle.__end__ - With the Midpoint method, discount factors for outcomes and costs are based on the value of time at the
of every cycle.__midpoint__

If you have a model that has very short cycles (eg, daily or weekly), nominal differences between the three methods of discounting are typically small. If you have a model with very long cycles (eg, annual), however, the three methods can produce noticeably different results. Notably, with the End method, the discount factors for outcomes and costs in the first model cycle will be a number less than one. If you select the Start method, the discount factors for outcomes and costs during the first model cycle will be equal to one.

**If I want to apply one-time cost at the beginning of a model, how would I do that?**

You can easily apply a one-time cost at the beginning of a model on the Values page. Because this cost is incurred only when patients enter your model, you would not discount it as you would costs that occur in future periods. To add this one-time cost to your model, after you have defined it on the Values page, use the dropdown menu labeled, ‘Type’, to select ‘Model Start’.

**I am not sure how to use ‘User Override Values’ that I see on ****Results pages****. What is this functionality all about? **

The User Override Menu allows you to pin input parameters to the Results pages of a model. If you pin a parameter to the User Override Menu, you can change the value for this parameter ‘on the fly’ on any Results page of a model (ie, you don’t have to return to the Parameters page to make such changes). This functionality can be very useful when you would like to see how a particular parameter affects findings of a model in ‘real time’.

To pin a parameter to the User Override Menu:

- Click the ‘Manage Override Values’ button in the Configuration Sidebar on any Results screen. In the pop-up menu, check every variable that you would like to be pinned to the User Override Menu.
- Use the drag handles to place the selected variables in the order that you would like them to be displayed in the ‘User Override Menu’.
- If you would like to restrict the possible values that an input parameter can have―for example, a set of integers or a list of category names―in the ‘Options’ column for this parameter, set forth the values that this variable may take on as a comma-separated list.
- When done, click ‘OK’.

Another common use case for the User Override Menu would be when you want to share a model with others who will be allowed access to it with View-Only privileges. While users with View-Only privileges ordinarily can run a model but not change values for model parameters, they are able to change the values of model parameters that you pin to the User Override Menu.

If you would like to change the value of a variable in the User Override Menu, simply click on the input field next to it, enter the desired new value, and hit the ‘Enter’ key or click outside the input field. Base case results will be automatically recalculated when you do this. (Note: sensitivity analyses must be rerun manually, however; this ensures that a model does not automatically recalculate multiple times when you might be planning to change the values of several parameters in the User Override Menu.)

**I want to apply a hazard ratio to a survival distribution defined on the Survival Distributions page of a model. Is there an easy way to do this?**

Yes―if you want to apply a hazard ratio to a survival distribution that has already been defined on the Survival Distributions page of a model, there is a hēRo3 function, apply_hr(…), that allows you to do so easily.

For example, if you used an exponential curve to depict progression-free survival (PFS) in patients who are receiving standard of care (SOC), you might have a survival distribution defined on your Survival Distributions page called ‘SOC_PFS_exp’, with a formula that looks something like this:

Now, imagine that a new therapy was expected to extend PFS by 15% compared with SOC. If you created a variable, ‘NEW_pfs_hr’, and set its value to 0.85, you can specify the PFS distribution for the new treatment using the apply_hr(…) function in a formula as follows:

(Note: If you want to add hazards to survival distributions, you should not use the function, apply_hr(…). Hazards can be added to survival distributions using the hēRo3 function, add_hazards(…).)

**I have a series of annual probabilities that I want to convert into monthly probabilities. Is there an easy way to do this in hēRo3?**

Yes―there is a hēRo3 function, rescale_prob(…), that allows you to easily convert probabilities from one measure of time to another.

For example, if you have an annual probability ('event_prob’) that you would like to convert to a monthly probability, you can do so with the following formula:

**Can I build a Markov model in hēRo3 with multiple lines of therapy?**

Yes. However, because there are countless possible modeling frameworks that incorporate multiple lines of therapy, there is no single best approach for setting up a Markov model of this nature. In general, one can characterize three alternative approaches for building models in hēRo3 with multiple lines of therapy, as follows: (1) depicting each line of therapy as its own separate health state (this approach is generally best for models that are relatively simple); (2) depicting each line of therapy with a set of health states that employ the __same structure for each line__; and (3) depicting each line of therapy as a set of health states using a __distinct structure for each line__.

To illustrate the first approach (ie, in which each line of therapy is depicted using a single health state), imagine that you wanted to consider two alternative strategies for using Drug A, Drug B, and Drug C as first-line therapy (L1), second-line therapy (L2), and third-line therapy (L3). One strategy involves the use of Drug A as L1, Drug B as L2, and Drug C as L3, and the alternative strategy involves the use of Drug B as L1, Drug C as L2, and Drug A as L3.

You could set up this model by creating three health states, ‘L1’, ‘L2’, and ‘L3’, and two strategies, ‘S1’and ‘S2’ (in this simple model, we will assume that patients can switch therapy, but never stop receiving treatment). You undoubtedly want to include a health state, ‘Dead’, for patients who die. Because this model depicts two strategies that use the same drugs, albeit in a different order, you may want to specify model parameters that are specific to each line of therapy and strategy (ie, one parameter value for each unique combination of line of therapy and strategy), rather than by drug, as the same drug may have different parameter values (eg, efficacy) in different lines of therapy (eg, expectations of clinical response may be greater when a drug is used as L1 than as L2, and correspondingly, greater when it is used as L2 than as L3).

In the above circumstance, you could create a table containing efficacy values (or any other parameter, for that matter) for Drug A, Drug B, and Drug C in strategies S1 and S2, respectively, and then use the hēRo3 function, look_up(…), to pull the appropriate values from this table into your model. The table that you would create—for example, named ‘Tx_Efficacy’—should include a row for each line of therapy (ie, L1, L2, and L3), and a column for each strategy (ie, S1, S2). Your table might look as follows:

And the value for the efficacy of Drug A in S1 (ie, as L1) would be obtained using the hēRo3 function, look_up(…), with the following arguments:

Now, let’s consider a slightly different decision problem in which patients are initially treated medically, and if they fail medical therapy, might be referred for surgery. Let’s further assume that two drugs—Drug A and Drug B—are the two medications used for medical therapy, and that you want to compare one strategy that involves use of Drug A on a first-line basis (again, L1), followed by Drug B as second-line therapy (L2), with patients failing both therapies being referred for surgery, while the other strategy involves use of Drug B as L1 and Drug A as L2, with surgery again being used in patients who fail both of these treatments. This model will likely need to employ a distinct set of health states to depict surgical intervention, but it can depict first- and second-line therapy similarly.

To set up this model, you could create two strategies (eg, ‘S1’ and ‘S2’) and depict them using the following health states: ‘L1’, ‘L2’, ‘Surgery_Success’, ‘Surgery_Fail’, and ‘Dead’. In this model, you would likely want to establish model parameters specific to line of therapy, strategy, and, where appropriate, surgical outcome. Much like the approach described above, you could create a table for each type of variable (eg, ‘Tx_Efficacy’), which you would then populate with a column for each strategy (ie, S1, S2) and a row for each health state (ie, L1, L2, Surgery_Success, Surgery_Failure). You could then reference this table to populate model parameters for treatment efficacy. An approach with multiple health states per line of therapy is more flexible, as it allows each line of therapy to employ a distinct set of health states, as needed; however, this approach also can make a model more difficult to quality check, as it can add complexity to the set-up.

For models that entail multiple—but identical—health states for each line of therapy, there is a middle ground between the two modeling approaches described above. Imagine that, as in the first example, you wanted to consider two different strategies for using Drug A, Drug B, and Drug C as first-line (L1), second-line (L2), and third-line (L3) treatment. One strategy would involve the use of Drug A as L1, Drug B as L2, and Drug C as L3, while the comparison strategy would involve the use of Drug B as L1, Drug C as L2, and Drug A as L3. This time, though, let’s assume that some patients may discontinue treatment and not progress immediately to the next line of therapy. We might create a series of health states, as follows: ‘L1_ON’ for those actively receiving L1, ‘L1_OFF’ for those who have discontinued L1 but have not yet progressed to L2, ‘L2_ON’ for those actively receiving L2, ‘L2_OFF’ for those who have discontinued L2 but have not yet progressed to L3, ‘L3_ON’ for those actively receiving L3, ‘L3_OFF’ for those who have discontinued L3 and have exhausted their treatment options (you also would want to include a state, ‘Dead’, in your model assuming patients can die). Once again, you can set up tables for each variable (eg, ‘Tx_Efficacy’) and use the function, look_up(…), to pull the appropriate values into your model for the two strategies you want to compare.

The above-described approach can be quite useful when the same structure can be used to depict health states in each line of therapy. Using parallel health-state frameworks for each line of therapy, with common formulas and nomenclature, where appropriate, will enable you to check your model more rapidly for errors.

Please be aware that if you use any of the hēRo3 keywords for state time (ie, ‘state_day’, ‘state_week’, ‘state_month’, ‘state_year’, and ‘state_time’), they will evaluate based on the time spent in each health state and not time spent in each line of therapy.

We also recommend that you take a look at the template, ‘Webinar Model – Advanced Markov’, in the Model Templates section of your hēRo3 Workspace to see an example of a Markov model that incorporates multiple lines of therapy.

**When I run my model, I get an ‘out of memory’ error message; what should I do to fix this problem?**

hēRo3 performs all calculations using advanced and powerful AWS compute servers. If you get this error message, it means that your model is so large that it hit a memory limit during computations. There are several things you might want to try to resolve an ‘out of memory’ error message, including:

- Reducing the number of groups included in a model if you have a number of them.
- Reducing the number of strategies included in a model if you have several.
- Reducing the time horizon of your analyses.
- Increasing the cycle length of your model if it is currently short (eg, changing it from daily to weekly, or weekly to monthly, etc). Please be aware that if you change the cycle length of a model, you also may need to make other changes to it to ensure that your calculations are being done correctly.
- If you are running a Markov Cohort Model that employs time dependency (ie, uses any of the hēRo3 keywords for state time), try capping the number of tunnel states in the MTS column on the States page. If you have already specified a value for MTS on the States page, try using a smaller value.
- If you are running a DSA, try reducing the number of variables that are included in these analyses.
- If you are running scenario analyses, try reducing the number of scenarios you are examining.
- If you are running a PSA, try reducing the number of simulations.

**If I am building a Partitioned Survival Model (PSM) in hēRo3, how can I define a survival distribution on the Survival Distributions page using Kaplan-Meier data stored in a hēRo3 table?**

You can easily define a survival distribution on the Survival Distributions page using Kaplan-Meier (KM) data stored in a table, using the hēRo3 function, define_surv_table(…). To use this function, you must have a table that contains two columns: one labelled ‘time’ that contains various time points for which you have survival probabilities; and another labelled ‘survival’ that contains the survival probability at each point in time.

Let’s assume you have defined a table, called ‘surv_probs_mos’, in your hēRo3 model that contains the probability of survival at various points in time (in this instance, months), which looks like the following:

If you wanted to create a distribution for overall survival using the KM data stored in the above table, you can do so by creating a new variable, ‘OS_KM’, and defining the formula for this variable using the hēRo3 function, define_surv_table(…), as follows:

For PSMs in hēRo3, you can estimate the proportion patients alive by referencing the survival distribution, ‘OS_KM’, directly in the formula bar on the Transitions page. The unit of time that is specified under the column ‘Time Unit’ on the Transitions page should correspond to the unit of time that you use in the table containing your KM data to describe how survival changes over time. In the above example, since survival was expressed in your KM data in terms of months, you would specify ‘months’ here.

For information on how to use KM data in a Markov Cohort Model, please see the FAQ ‘If I am building a Markov Cohort Model in hēRo3, how can I define a survival distribution on the Survival Distributions page using Kaplan-Meier data stored in a hēRo3 table?’.

**If I am building a Markov Cohort Model in hēRo3, how can I define a survival distribution on the Survival Distributions page using Kaplan-****Meier data stored in a hēRo3 table?**

You can easily define a survival distribution on the Survival Distributions page using Kaplan-Meier (KM) data stored in a table, using the hēRo3 function, define_surv_table(…). To use this function, your table must contain two columns: one labelled ‘time’, which contains various time points for which you have survival probabilities; and another labelled ‘survival’, which contains the survival probability at each point in time.

Let’s assume you have defined a table, called ‘surv_probs_mos’, in your hēRo3 model that contains the probability of survival at various points in time (in this instance, months), which looks like the following:

If you wanted to create a distribution for survival using the KM data stored in the above table, you can do so by creating a new variable, ‘Surv_KM’, and defining the formula for this variable using the hēRo3 function, define_surv_table(…), as follows:

Now, let’s assume your Markov cohort model has two health states, ‘Sick’ and ‘Dead’, and you want to use the survival distribution, ‘Surv_KM’, to estimate the probability of transitioning from the ‘Sick’ state to the ‘Dead’ state. You can do so using the hēRo3 function, event_prob(…), in a formula on the Transitions page as follows:

The arguments of the hēRo3 function, event_prob(…), are as follows: (1) a survival distribution; (2) the start time of an interval (eg, a month); and (3) the end time of an interval. The unit of time (ie, days, weeks, months, years) used in the second and third arguments of the event_prob(…) function should correspond to the unit of time that you use in the table containing your KM data.

Please note that model time in hēRo3 begins with 1, and not 0, and thus it is necessary to subtract one cycle length (eg, ‘cycle_length_months’) from ‘model_month’ to correctly designate the start time as the beginning of a given cycle. Because time in hēRo3 begins with 1, and not 0, you do not have to adjust the model time at the end of a cycle. This is because the entire duration of the last model cycle will already be counted using one of the hēRo3 keywords for model time (eg, ‘model_month’).

For information on how to use KM data in a Partitioned Survival Model, please see the FAQ ‘If I am building a Partitioned Survival Model (PSM) in hēRo3, how can I define a survival distribution on the Survival Distributions page using Kaplan-Meier data stored in a hēRo3 table?’.

**I have a hēRo3 model that uses annual cycles. I would like to create a variable for general population mortality by age, using a life table that reports the number of persons alive by year of life, beginning with a birth cohort of 100,000 persons. How can I do this in hēRo3?**

If your model uses annual cycles, you can easily calculate mortality probabilities to use in it based on information from a life table, using the hēRo3 function, ‘look_up(…)’. Let’s assume that your model has a table called, 'Life_Table', that shows, beginning with a cohort of 100,000 live births, the number of persons surviving to each calendar age (up to 100 years). Your table might look as follows:

What you need in your model is the probability of death in the current year, as well as during each future year of life. To calculate annual probabilities of death, beginning with the number of persons surviving to each calendar age stored in your life table, you first need to divide the number of persons surviving to each age by the number of persons surviving to the next year; this would give you the annual probability of survival at each age. To calculate these probabilities using the data in the table, 'Life_Table', you would need to divide the number of persons alive at each age by the number of persons alive who are one year older; this would give you the probability of survival at each age. Then, you need to subtract the annual survival probabilities from 1 to obtain annual probabilities of death.

To begin calculating annual probabilities of death, create a variable for current age. To calculate current age in a given cycle, add the number of years elapsed since model start, which is represented by the hēRo3 keyword, ‘model_year’, to the age of patients at model entry. Because hēRo3 assigns the value of 1 (and not 0) to the first year of a model, it is important to subtract the hēRo3 keyword, ‘cycle_length_years’, from ‘model_year’ in your formula (if you don’t, patient age will be off by 1 year). (The keyword ‘cycle_length_years’ represent the length of a model cycle, in years). This can be done using a formula, as follows:

What you need in your model is the probability of death in the current year, as well as during each future year of life. To calculate annual probabilities of death, beginning with the number of persons surviving to each calendar age stored in your life table, you first need to divide the number of persons surviving to each age by the number of persons surviving to the next year; this would give you the annual probability of survival at each age. To calculate these probabilities using the data in the table, 'Life_Table', you would need to divide the number of persons alive at each age by the number of persons alive who are one year older; this would give you the probability of survival at each age. Then, you need to subtract the annual survival probabilities from 1 to obtain annual probabilities of death.

To begin calculating annual probabilities of death, create a variable for current age. To calculate current age in a given cycle, add the number of years elapsed since model start, which is represented by the hēRo3 keyword, ‘model_year’, to the age of patients at model entry. Because hēRo3 assigns the value of 1 (and not 0) to the first year of a model, it is important to subtract the hēRo3 keyword, ‘cycle_length_years’, from ‘model_year’ in your formula (if you don’t, patient age will be off by 1 year). (The keyword ‘cycle_length_years’ represent the length of a model cycle, in years). This can be done using a formula, as follows:

Next, because you will need to divide the number of persons surviving to each age by the number of persons surviving to the next year of life, you need to create a variable for patient's current age plus one year. Because the first year of a model is assigned a value of 1, you can calculate a patient’s current age plus one year using the same formula shown above, without ‘cycle_length_years’, as follows:

For more information on how to create a variable to represent a patient’s current age in a model, please see the FAQ, “How can I calculate a patient’s current age in my model?”

Now that you’ve created variables for current age, and current age plus one year, you can create a variable that will pull the number of persons surviving at each age from your life table using the hēRo3 function, ‘look_up’. You will need to create two variables—one that will pull the number of persons alive at every current age, and another that will pull the number of persons alive at every current age plus one year, as follows:

Next, to calculate an annual probability of survival, divide the number of persons alive at each age by the number of persons alive who are 1 year older, which can be done in a formula as follows:

Finally, subtract the annual probability of survival from 1 to yield the annual probability of death at each age, as follows:

If you would like to see the output generated by ‘p_mortality’, you can do so using the ‘Export to Excel’ feature in hēRo3, which generates a comprehensive workbook containing all intermediate and final calculations in your model. The monthly mortality probabilities that you just calculated can be found on a sheet labelled, ‘Calc - Params’. Export to Excel in hēRo3 is a useful feature that can be used to make certain that your formulas are evaluating the way you intended.

**I have a hēRo3 model that uses monthly cycles. I would like to create a variable for general population mortality by age, using a life table that reports the number of persons alive by year of life, beginning with a birth cohort of 100,000 persons. How can I do this in hēRo3?**

If your model uses monthly cycles, you can easily calculate mortality probabilities to use in it based on information from a life table, using the hēRo3 functions ‘floor(…)’, ‘lookup(…)’ and ‘rescale_prob(…)’. Let’s assume that your model has a table called, Life_Table, that shows, beginning with a cohort of 100,000 live births, the number of persons surviving to each calendar age (up to 100 years). Your table might look as follows:

What you need in your model is the probability of death at each month, by age. To calculate monthly probabilities of death, you first need to calculate annual probabilities of death, then rescale your annual probabilities to monthly probabilities. To calculate annual probabilities of death, beginning with the number of persons surviving to each calendar age stored in your life table, you first need to divide the number of persons surviving to each age by the number of persons surviving to the next year; this would give you the annual probability of survival at each age. Next, you need to subtract the annual survival probabilities from 1 to obtain annual probabilities of death. Finally, you need to rescale your annual probabilities of death to yield monthly probabilities of mortality.

To begin calculating annual probabilities of death, create a variable for current age. To calculate current age in a given cycle, add the number of years elapsed since model start, which is represented by the hēRo3 keyword, ‘model_year’, to the age of patients at model entry. Because the first year of a model is assigned the value of 1 (and not 0) in hēRo3, it is important to subtract the hēRo3 keyword, ‘cycle_length_years’, from ‘model_year’ in your formula (if you don’t, patient age will be off by 1 year). Because your model uses a monthly periodicity, patients’ current age will not always evaluate to a whole number in every model cycle. Since your life table contains the number of persons alive by age in years, you need to adjust your variable for current age so that it always evaluate to a whole number. This can be done using the function, ‘floor(…)’, in a formula, as shown below:

For more information on how to create a variable to represent patients’ current age in a model, please see the FAQ, “How can I calculate a patient’s current age in my model?”

Next, because you will need to divide the number of persons surviving to each age by the number of persons surviving to the next year of life, you need to create a variable for patient current age plus one year. This can be done using a formula similar to the one used to generate current age, with the exception that you now need to add one year to patient’s starting age, as shown below:

Now that you’ve created variables for current age, and current age plus one year, you can create a variable that will pull the number of persons surviving at each age from your life table, which can be done using the hēRo3 function, ‘look_up’. You will need to create two variables—one that will pull the number of persons alive at every current age, and another that will pull the number of persons alive at every current age plus one year, as follows:

Next, to calculate an annual probability of survival, divide the number of persons alive at each age by the number of persons alive who are one year older, which can be done in a formula as follows:

Then, subtract the annual probability of survival from 1 to yield the annual probability of death at each age, as follows:

Finally, because your model uses monthly cycles, you must rescale annual probabilities of death to monthly probabilities, using the function ‘rescale_prob(…)’, as shown below:

If you would like to see the output generated by ‘p_mortality_rescale’, you can do so using the ‘Export to Excel’ feature in hēRo3, which generates a comprehensive workbook containing all intermediate and final calculations in your model. The monthly mortality probabilities that you just calculated can be found on a sheet labelled, ‘Calc - Params’. Export to Excel in hēRo3 is a useful feature that can be used to make certain that your formulas are evaluating the way you intended.

**How can I add a cost to a model that is applied when patients transition from one health state to another?**

You can easily assign patients a cost when they transition from one health state to another by defining a value on the Values page, and selecting ‘Transition’ as the variable ‘Type’. This will cause a one-time cost to be assigned to patients when they move from one health state to another.

To illustrate, assume that you want to apply a cost of terminal care in the cycle when patients die (ie, when they transition to the ‘Dead’ health state). To apply such a cost, create a new value on the Values page such as the one shown below called ‘Terminal_Care_Cost’, and then select ‘Transition’ as the variable ‘Type’. Finally, specify the ‘From’ and ‘To’ states to which this cost of transition should be applied (eg, in the example below, the ‘Well’ and ‘Dead’ states, respectively).

In the above example, a cost of terminal care will be applied to patients when they transition from the ‘Well’ health state to the ‘Dead’ health state.

**The VBP curve in my model is downward sloping, meaning that the price that can be charged for a product goes **__down__ as willingness-to-pay (WTP) goes up. There has to be something wrong with my model; what is it?

*as willingness-to-pay (WTP) goes up. There has to be something wrong with my model; what is it?*

__down__There is nothing necessarily wrong with your model when you get a downward sloping VBP curve. This can happen when the intervention that is of interest to you is * less effective* than the intervention to which you are comparing it. In other words, to get someone to switch from the more effective intervention to the one that is of interest to you, they would have to forgo a health outcome, and their willingness to do so would depend on how much money they would save with the intervention of interest vs how highly they value the health outcome they would forgo. A high WTP threshold means that someone places a very high value on the corresponding health outcome, and would be willing to forgo it only if cost savings were quite substantial (ie, only if the price of the intervention of interest is quite low). On the other hand, a low WTP threshold means that the health outcome that someone would need to forgo is not valued that highly, and hence even modest cost savings might be sufficient to result in a switch to the less costly intervention. In other words, the VBP curve is downward sloping.

**How can I change the willingness-to-pay (WTP) threshold used in base case analyses and sensitivity analyses?**

You can set the WTP threshold used in base case analyses and sensitivity analyses on the Summaries page. To do so, navigate to the Summaries page and enter the WTP threshold that you would like to use in the ‘WTP’ column. Please note that each health outcome on the summaries page may have its own WTP threshold. Also note that this is the only page on which you can change the value for WTP.

**I need to share a model with someone and I would like to limit the parameters that can be changed when my model is run; can I do this in hēRo3, and if so, how?**

If you want to share a model with someone and allow them to change any parameter value, you should share your model with them with ‘view-only’ privileges toggled * off*. However, if you want to limit the parameters that someone can change while running your model, you should first add those parameters that you would like the recipient to be able to change to the User Overrides menu, and then share your model with ‘view-only’ privileges toggled

*.*

__on__To add (or remove) parameters from the User Overrides menu, click ‘+ Manage Override Values’, and then add (or remove) a parameter using the check boxes located to the left of the ‘Names’ column. You can limit the values that can be specified for a given parameter by entering comma separated values in the ‘Options’ column; this will create a dropdown menu containing only those values that you have designated. If you want to allow users to modify a particular parameter, and you do not want to limit the values that they can assign to that parameter, then you should leave the ‘Options’ column blank; this will allow users to assign any value they like to that parameter.

Once you are done adding (or removing) parameters to the User Overrides menu, you can share your model. For more information on sharing model options, please see the article ‘Sharing Models’.

**I want to assign patients who experience a particular event a higher rate of mortality in the year following the event, but then have their mortality rate return to that of persons in the general population; how can I do this in hēRo3?**

You can easily assign patients who experience a particular event a higher rate of mortality in the year following the event, and then have their mortality rate return to that of persons in the general population who were not evented.

To do this, create a health state in your model to which patients transition when they experience the event of interest, give them a higher rate of mortality while they’re in this state, and then have them transition out of this health state after one year.

Let’s assume that you have a Markov cohort model that uses annual cycles, and that it has three health states—‘unevented’, ‘evented’, and ‘dead’. Let’s also assume that all patients enter the model in the unevented state, and can transition between the evented state and the unevented state or death in any given cycle. We can depict this model as follows:

Let’s further assume you’ve created two parameters, ‘gp_mortality’ and ‘excess_mortality’, on the Parameters page. The first parameter defines the annual probability of death among patients who are unevented; the second parameter describes excess mortality that patients experience if they are evented in a given cycle (in other words, mortality among evented patients equals the sum of ‘gp_mortality’ and ‘excess_mortality’). Your Parameters page might look as follows:

Next, you will need to define the probability of transitioning from the evented state to the unevented and dead states on the Transitions page. Patients who are unevented in a given cycle have a probability of transitioning to death equal to ‘gp_mortality’. Patients who are evented in a given cycle have a probability of transitioning to death equal to ‘gp_mortality’ plus ‘excess_mortality’. Since we are assuming that evented patients have an elevated rate of mortality only in the cycle in which their event occurs, in effect we can transition them to the uneveted state in the next cycle. You can define this transition from the evented to the uneveted state as one minus the probability of death. Your Transitions page might look as follows:

The transitions defined above will allow persons who experience an event to transition to the evented health state for one year, during which they will experience an elevated risk of mortality; thereafter, survivors will transition back to the uneveted state in the subsequent cycle.

**I would like one of my outcomes to be the total number of events that patients in a cohort experience. Can I do this in hēRo3—and if so, how?**

Yes, you can easily set up a hēRo3 model to track the number of events patients in a cohort experience.

To do this, create a parameter in your model that represents the probability that patients will experience the event of interest. Then, create a Value on the Values page to tally the number of events that patients experience. Finally, create a Summary on the Summaries page so you can view the number of events that patients experience as an outcome on Results pages. Below, we explain how to do this.

Let’s assume you have a Markov cohort model with two health states, ‘alive’ and ‘dead’. Let’s also assume that all persons entering your model have the same probability of experiencing a particular event of interest, and that the risk of experiencing subsequent events among patients who are already evented is the same as that of patients who have not yet experienced an event. Create a parameter on the Parameter page, ‘event_probability’, that represents the probability of experiencing the event of interest, as shown below:

Let’s assume that you have already defined all relevant transitions between health states in your model, and that your Transitions page looks as follows:

Next, create a Health Value on the Values page to tally the number of events that patients in the cohort have experienced. You can do this by creating a new Value, specifying ‘Health’ in the ‘Category’ column, ‘Residency’ in the ‘Type’ column, ‘alive’ in the ‘State’ column, and giving it a value equal to ‘event_probability’ in the ‘Formula’ column, as shown below:

Finally, create a Health Summary on the Summaries page if you would like to include the number of events patients have experienced as an outcome on Results pages. You can do this by creating a new Summary, describing the outcome, selecting ‘Heath’ in the ‘Category’ column, setting a willingness-to-pay threshold in the ‘WTP’ column, and entering the value, ‘Events’, in the ‘Values’ column, as shown below:

If you would instead like information on setting up your hēRo3 model to tally the total number of persons in a cohort who experience a particular event of interest, please see the FAQ “I would like one of my outcomes to be the number of patients in a cohort who experience a particular event. Can I do this in hēRo3-and if so, how?”

**I would like one of my outcomes to be the number of patients in a cohort who experience a particular event. Can I do this in hēRo3-and if so, how?**

Yes, you can easily set up a hēRo3 model to track the number of patients in a cohort who experience a particular event of interest.

To do this, you should create a health state in your model to which patients transition when they experience the event that you want to track in your model. Then, create a value on the Values page to tally the number of patients who transition to this health state. And finally, you should create a summary on the Summaries page to view the number of patients who experience a particular event of interest as an outcome on Results pages. Below, we explain how to do this.

Let’s assume that you have a Markov cohort model that has three health states—‘unevented’, ‘evented’, and ‘dead’. Let’s also assume that all patients enter the model in the ‘unevented’ state, and may transition to either the ‘evented’ or ‘dead’ health states in any given cycle. Finally, let’s assume that once patients are ‘evented’, they remain so for the remainder of their lives. We can depict this model as follows:

Let’s assume that you have already created a parameter, ‘event_ probability’, that represents the probability that unevented patients experience the event of interest, and that you have defined this probability on the Transitions page (along with all other relevant transitions between health states in your model). Your Transitions page might look as follows:

Now, create a Health Value on the Values page to tally the number of patients in the cohort who experience the event of interest. You can do so by creating a new value, specifying ‘Health’ in the ‘Category’ column, ‘Transition’ in the ‘Type’ column, giving it a value equal to 1 in the ‘Formula’ column, and specifying that this value is assigned when patients transition from the ‘unevented’ to the ‘evented’ health state in the ‘State’ column, as shown below:

This new Value will evaluate to the number of persons in the cohort who experience an event as the model moves from one cycle to the next.

Finally, you should create a Health Summary on the Summaries page if you would like to include the number of patients experiencing an event as an outcome on Results pages. You can do so by creating a new summary, describing the measure, specifying a description of the outcome, selecting ‘Heath’ in the ‘Category’ column, setting a willingness-to-pay threshold for this measure in the ‘WTP’ column, and entering the value, ‘Evented’, in the ‘Values’ column, as shown below:

If you would instead like information on setting up your hēRo3 model to tally the total number of events experienced by patients in a cohort, please see the FAQ, “I would like one of my outcomes to be the total number of events that patients in a cohort experience. Can I do this in hēRo3—and if so, how?”.

**How can I check that the value of a variable in my model is being calculated correctly?**

You can check the calculated value of a variable in a model using hēRo3’s ‘Export to Excel’ functionality, which also can be used to view detailed information about a model’s structure, input values, and Results (as well as intermediate calculations). If you are interested in viewing calculated parameter values for a variable in every cycle of your model, for example, you can find this information in the worksheet , ‘Calc – Params’, which displays calculated parameter values at the end of every cycle in terms of days, weeks, months, and years elapsed. These values are displayed for each strategy, since they may differ according to treatment; if your model uses Groups, calculated values also will be displayed for each group.

Let’s assume that you have a hēRo3 model that contains a variable, ‘gp_mort’, which generates annual probabilities of death for the general population using data from a life table, and you would like to confirm that this variable is being calculated correctly in each cycle of the model.. (For more information on how to generate general population mortality rates using a life table in hēRo3, please see the FAQ, ‘I want to calculate general population mortality rates in a model from a life table. Is there an easy way to do this in hēRo3?’).

To generate a worksheet where you can view these calculations, click the icon located on the Application Toolbar, and select ‘Export as XLSX’. This utility will create an Excel file that, in most instances, will be saved in your Downloads folder. Once you locate and open this file, navigate to the ‘Calc – Params’ worksheet to see all calculated parameter values at the end of each model cycle. (In addition to calculated parameter values, the workbook created by Export to Excel also will contain calculated values for all transitions, unit values, and expected values; it also has tabs that display all input values [exactly as they were entered], all Tables and associated contents [if your model uses Tables], and discounted and undiscounted Results).

In the example illustrated below, columns A-D contain the hēRo3 keywords for ‘model_time’, which show the amount of time elapsed at the end of each cycle since the start of the model, in terms of days, weeks, months, and years, respectively. Column E contains the variable, ‘markov_cycle’, which indicates the number cycles elapsed in your model. The treatment strategy for which each variable is being calculated is shown in Column F. Column G contains the variable representing a patient’s current age; by comparing the values across rows for ‘current_age’, we can confirm that patient age increases with each cycle, as expected. Column H contains the variable ‘gp_mort’, which is the mortality rate for the general population in each cycle of the model. You can compare the rows in columns G and H to see that as patients age, the mortality rate increases. The variable, ‘relapse_prob’, is in the right-most column; it is the annual probability that persons will experience a relapse. We can compare across rows in columns I and G to see that the probability of a relapse increases with increasing age. We can compare the rows in columns F vs I to see that the probability of relapse differs by treatment strategy, as it should in this model.

For more information on Export to Excel and additional export functionality, please see the article, Export.