← Latest papers
📈 economics

mnorm: An R Package for Calculation and Differentiation of Conditional Multivariate Normal Densities and Probabilities

The paper introduces the **mnorm** R package, a tool designed to calculate and differentiate conditional multivariate normal densities and probabilities—including support for Gaussian copulas, parallel computing, and fast bivariate/trivariate routines—to facilitate maximum-likelihood estimation in econometric models.

Original authors: Sofiia Dolgikh, Bogdan Potanin

Published 2026-07-20
📖 6 min read🧠 Deep dive

Original authors: Sofiia Dolgikh, Bogdan Potanin

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to predict the weather, but instead of just rain or sun, you are juggling a dozen different variables at once: temperature, humidity, wind speed, barometric pressure, and even the mood of the local squirrels. In the world of statistics, this chaotic juggling act is called a multivariate normal distribution. It's a mathematical way of describing how a bunch of different things move together. Sometimes, they move in sync (like wind and rain), and sometimes they don't.

Now, imagine you peek outside and see that the wind is blowing at 20 miles per hour. Suddenly, your prediction for the squirrel mood changes, and your guess for the humidity shifts too. This is called a conditional probability: figuring out what the rest of the system is doing given that you already know something about one part of it.

Why does anyone care? Because the real world is full of these tangled webs. Economists use them to understand how a change in interest rates might ripple through a stock market, or how a student's test scores in math might predict their scores in history. To make these predictions accurate, scientists need to do something called differentiation. Think of this as finding the "slope" of a hill. If you are trying to find the very best spot to set up a camp (the maximum likelihood), you need to know which way is "up" and how steep the hill is. If you can calculate this slope perfectly, you can zoom straight to the top. If you have to guess, you might wander around in circles for a long time.

This is where a new tool called the mnorm package comes in. It's a piece of software for the R programming language, designed to be the ultimate GPS for these statistical hills.


The mnorm Package: A Speedy Guide for Statistical Mountains

The paper introduces mnorm, a new software package that acts like a high-speed, multi-tool calculator for these complex statistical mountains. Before mnorm, researchers had to use other tools that were either slow, couldn't handle "conditional" situations (where you already know some facts), or couldn't calculate the "slope" (the gradient) needed to find the best answers quickly.

Think of calculating a probability as trying to measure the volume of a weirdly shaped, invisible cloud. If the cloud has 2 or 3 dimensions, it's like measuring a balloon; if it has 10 or 100 dimensions, it's like trying to measure a cloud that exists in a universe with extra dimensions. The mnorm package is special because it doesn't just measure the cloud; it can also tell you exactly how the cloud's shape would change if you tweaked the wind, the temperature, or the starting point.

The Superpower: Analytical Gradients
The biggest trick up mnorm's sleeve is its ability to calculate analytical gradients. In plain English, this means it can figure out the "slope" of the probability curve using exact math formulas, rather than guessing by nudging the numbers slightly and seeing what happens.

The authors ran simulations to test this. They found that using these exact formulas was dramatically faster than the guessing method.

  • For simple density calculations (just measuring the cloud), mnorm was fast.
  • For calculating gradients (finding the slope), the difference was huge. In one test with 5 dimensions, calculating the slope analytically took about 0.09 seconds, while the "guessing" method (numeric differentiation) would have taken at least 0.54 seconds just to do the minimum number of guesses required.
  • In higher dimensions, like 10 dimensions, the analytical method took 3.47 seconds for the slope, while the guessing method would have needed at least 4.51 seconds.

The paper suggests that this speed boost is a game-changer for economists who need to run these calculations millions of times to build models. It's the difference between walking up a mountain and taking a helicopter.

Handling the "Given" Parts
One of the most useful features is how mnorm handles conditional data. Imagine you are trying to predict a student's final grade. If you don't know their midterm score, you have to guess. But if you do know the midterm score (the "given" part), the prediction changes.

mnorm can calculate the probability and the slope given that specific midterm score. The paper shows that calculating these slopes is incredibly fast because the math for the "given" parts is just a simple rearrangement of the math for the other parts. In a test with 5 variables where 2 were "given," the package calculated the slopes almost instantly, whereas the guessing method would have been much slower.

Speeding Up the Small and the Large
The package also shines in two specific areas:

  1. Small clouds (2 and 3 dimensions): For these, mnorm uses a clever math trick called Gauss-Legendre quadrature. The authors compared it to other popular tools and found mnorm was significantly faster. For example, calculating probabilities for a 2-dimensional cloud took mnorm 0.57 seconds for a million calculations, while a competitor took 0.75 seconds. Even more impressive, when they turned on the "multi-core" feature (using 8 computer brains at once), mnorm dropped to 0.16 seconds, while the competitor was still at 1.11 seconds.
  2. Huge clouds (High dimensions): For clouds with 16, 64, or even 512 dimensions, mnorm competes with the best tools available. In tests with 512 dimensions, mnorm calculated the probability in 2.54 seconds, which was comparable to other top-tier tools, proving it doesn't just work for small problems.

Non-Normal Friends
Real life isn't always perfectly normal. Sometimes data is skewed or has weird tails. mnorm can handle this by using something called a Gaussian copula. Think of this as a translator. It takes weird, non-normal data (like the number of times a squirrel visits a feeder) and translates it into the language of the normal distribution so the math can still work. The package can even calculate the slopes for the parameters of these weird distributions, which is a feature few other tools have.

The Bottom Line
The paper doesn't claim to have discovered a new law of the universe. Instead, it offers a practical, highly efficient tool. The authors suggest that by using mnorm, researchers can build better, faster economic models. They proved through simulations that their method is faster than the alternatives and provided the exact mathematical formulas (the "secret sauce") so anyone can verify the work.

In short, mnorm is like giving a statistician a turbo-charged engine for their car. It doesn't change the destination, but it gets them there in record time, with a clear map of the terrain along the way. Whether you are dealing with a simple two-variable problem or a massive 512-dimensional puzzle, this package suggests it's the fastest way to get the answer.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →