Partial Moments
Calculate the Lower (or Upper) Partial Moment: how often and how far the returns of an investment portfolio or asset fall below (or rise above) a minimum acceptable return.
A partial moment measures only one side of the return distribution: the lower partial moment averages the shortfalls below a minimum acceptable return (MAR) raised to a power, the order, and the upper partial moment does the same for the returns above it. The order sets what is measured: order 0 is how often the returns fall below the MAR (the downside frequency), order 1 how far they fall below it on average (the downside potential, the expected shortfall below the target), order 2 the downside variance behind the Sortino Ratio and higher orders the weight of the extreme losses. Investors who care about losses rather than about deviations in either direction use them in place of the variance, and the ratio of an upper to a lower partial moment is the Omega Ratio (order 1) and the Upside Potential Ratio’s building block.
The formula is as follows:
\[\text{Lower Partial Moment} = \frac{\sum \max(\text{MAR} - \text{Return}_{t},\; 0)^{\text{order}}}{n}\] \[\text{Upper Partial Moment} = \frac{\sum \max(\text{Return}_{t} - \text{MAR},\; 0)^{\text{order}}}{n}\]Where n is the number of all returns, so the returns on the other side of the MAR count as zero rather than being left out. Of order 0 the moment counts the returns strictly below (or above) the MAR, as a share of all returns. Raised to the power 1 / order (its root), order 2 becomes the Downside Deviation (the lower side) or the Upside Deviation (the upper side). With the mean of each sample as the MAR it gives the semi-moments around the mean (order 2: the semi-variance with n in the denominator).
Also known as: LPM, UPM, downside potential, downside frequency, upside frequency, upside potential, shortfall probability, semi-moment.
Example · JPM, GS, MS · 2021 to 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_partial_moment:
from financetoolkit import Toolkit
toolkit = Toolkit(
["JPM", "GS", "MS"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.risk.get_partial_moment(period="yearly", within_period=True)
Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:
How far, on average, did the daily returns of JPMorgan Chase, Goldman Sachs, Morgan Stanley and the S&P 500 fall below zero in each year from 2021 to 2025, measured by the first lower partial moment?
Which returns:
| Item | JPM | GS | MS | Benchmark |
|---|---|---|---|---|
| 2021 | 0.0048 | 0.0055 | 0.0057 | 0.0026 |
| 2022 | 0.0074 | 0.0072 | 0.0081 | 0.0063 |
| 2023 | 0.0041 | 0.0053 | 0.0056 | 0.0028 |
| 2024 | 0.0041 | 0.0046 | 0.0048 | 0.0025 |
| 2025 | 0.0048 | 0.0059 | 0.0057 | 0.0034 |
5 rows
Parameters
get_partial_moment accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The data frequency for returns. Options are: “daily”, “weekly”, “monthly”, “quarterly”, “yearly”. Defaults to “daily”. | "weekly" |
order | float | The order of the moment, 0 or higher: 0 for the frequency, 1 for the potential, 2 for the variance and higher orders for the extremes. Defaults to 1. | 2 |
minimum_acceptable_return | float | str | The minimum acceptable return (MAR) per observation of the chosen period (e.g. per day), or “mean” for the mean of each sample. Defaults to 0.0. | 0.001 |
side | str | The side of the MAR. Options are: “lower” (the returns below the MAR), “upper” (the returns above it). Defaults to “lower”. | "lower" |
root | bool | Whether to raise the moment to the power 1 / order, which needs an order above 0. Defaults to False. | False |
within_period | bool | Whether to calculate the Partial Moment within the specified period or for the entire period. Thus whether to look at the Partial Moment within a specific year (if period = ‘yearly’) or look at the entirety of all years. Defaults to False. Note that this requires intraday data when period = ‘daily’, since a single day only nests observations when intraday data was fetched. | True |
rolling | int | The rolling window size to use for the calculation. If set, the Partial Moment is calculated over a rolling window of this many periods across the full return history instead of per period. At least 2. Defaults to None. | 4 |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise). | 2 |
growth | bool | Whether to calculate the growth of the Partial Moment values over time. Defaults to False. | True |
lag | int | list[int] | The lag to use for the growth calculation. Defaults to 1. | 4 |
standardize | bool | Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. | True |
show_columns | str | list[str] | None | The columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column. | None, which keeps every column |
References
- Paper Bawa, V.S. (1975). “Optimal Rules for Ordering Uncertain Prospects.” Journal of Financial Economics, 2(1), 95-121.
- Paper Fishburn, P.C. (1977). “Mean-Risk Analysis with Risk Associated with Below-Target Returns.” The American Economic Review, 67(2), 116-126.
- Paper Bacon, C.R. (2008). “Practical Portfolio Performance Measurement and Attribution.” John Wiley & Sons, chapter 4 (Downside Potential, Downside and Upside Frequency, Upside Potential).
- Library Referenced against Riskfolio-Lib’s LPM
- Library Referenced against Riskfolio-Lib’s SemiKurtosis
- Library Referenced against skfolio’s first_lower_partial_moment
- Library Referenced against skfolio’s fourth_lower_partial_moment
- Library Shares similar logic as PerformanceAnalytics (R)’s DownsideFrequency
- Library Shares similar logic as PerformanceAnalytics (R)’s UpsideFrequency
- Library Shares similar logic as PerformanceAnalytics (R)’s UpsideRisk
- Library Shares similar logic as PerformanceAnalytics (R)’s DownsidePotential
- Library Shares similar logic as PerformanceAnalytics (R)’s lpm