Cost-Effectiveness with QALY
Over the last twenty years, the QALY has become one of the most common ways to measure the value of a health outcome. QALY stands for Quality Adjusted Life Years. It puts two things into one number: how long someone lives, and how good that life is. With one number, you can compare two treatments on the same scale. You no longer have to argue separately about extra years and about how the patient feels during those years.
Here is a simple way to picture it. One year lived in perfect health is worth 1 QALY. One year lived at half your normal quality of life is worth about 0.5 QALY. So a treatment that adds years of good health scores higher than one that adds the same number of years spent feeling unwell.
The idea behind the formula
There is more than one way to combine length of life and quality of life. One approach treats a QALY like a complex number. Length of life is the real part. Quality of life (the utility) is the imaginary part. The thinking is that utility is not something you can count or touch the way you count years, so the two parts are not simply multiplied. Instead you take the magnitude of the pair. In plain terms, you square each part, add them, and take the square root:
QALY = square root of (length of life squared + utility squared)

If you want the full reasoning behind this formula, it is laid out in this paper: Problems and solutions in calculating quality-adjusted life years (QALYs).
You do not have to use the complex-number version. There is also the more traditional formula, which is the one most people learn first:
QALY = utility × length of life
This is the simple version. Say a treatment gives 4 years of life at a utility of 0.7. The traditional formula gives 4 × 0.7 = 2.8 QALYs. Both formulas are in the software, so you can pick whichever one your study or your guidelines ask for.

Calculating QALYs in the SpiceLogic Decision Tree software
In the SpiceLogic Decision Tree software, you can set up your payoff so that effectiveness is measured in QALYs. When you do, you pick which of the two formulas the software uses: the traditional utility × length of life, or the complex-number version above. You choose once, and the software uses that same formula everywhere in your tree. So your whole model stays consistent, and you do not have to set the method again at each node.

Once you choose QALY as your effectiveness measure, the payoff editor gives you two fields to fill in for each outcome: the Utility value and the Time (length of life). You type those two numbers, and the software works out the QALY for you with the formula you picked. You never do the math by hand. For example, if a recovery outcome has a utility of 0.8 and lasts 5 years, you just enter 0.8 and 5, and the QALY shows up on its own.

Sometimes you already have a QALY figure worked out. Or you would rather track one number of your own instead of typing Utility and Time apart. For that, the Effectiveness editor has a third option: "A single custom variable".
Pick that option and you can name the variable yourself and set its range with a Minimum and a Maximum value. After that, you type one number for each outcome, and that number is used as your effectiveness value directly. This is handy when your data already comes as finished QALY scores from a published study, so you just enter them as they are.

For example, say you want to type the QALY in yourself, and you want every value to fall between 0 and 1. You would set it up like this: give the variable a name (such as QALY), set the Minimum to 0, and set the Maximum to 1. The range keeps you honest. If you slip and type 1.5, it falls outside the bounds you set, so you catch the mistake early.

After that, your Decision Tree lets you type the QALY straight in as one number for each outcome. There are no Utility and Time fields to fill in. The value you enter is used exactly as you typed it, with no extra calculation behind it.

A worked example
Suppose you are weighing two treatment options. The first gives you 4 years of life at a utility of 0.7. The second gives you 7 years of life at a utility of 0.4.
Which option is better?
The answer is not obvious. The first option means fewer years but better quality. The second means more years but lower quality. QALYs let you compare them on one scale. Here is how to set it up in the software.
Start the Decision Tree software and create two action nodes, one for each treatment option.

When the setup window appears, click the second button, "Cost-Effectiveness Analysis".

Next, select the first radio button, "Maximize QALY", and pick the formula you want to use, as shown here.

Click Proceed, and the software takes you to the decision tree, where you can fill in the Utility value and the Time for each option. For the first option, set Utility = 0.7 and Time = 4 years. For the second option, set Utility = 0.4 and Time = 7 years.
As you type those numbers, the software works out the QALY with the formula you chose and shows it right there. You can see at a glance which option comes out ahead, and you can try other numbers to see how the answer changes.

That is the whole idea. You enter the numbers you have, the software does the QALY math, and you read off which option scores higher. Once your tree is set up, you can change a utility or a time and watch the result update, so it is easy to test a few what-if cases before you decide.