Mathematical constraints in ecology and evolution, part 4: dimensional analysis

This is the extremely-belated fourth post in my series on mathematical constraints in ecology and evolution.

By “mathematical constraints” I mean the mathematical rules that all our numerical data and other scientific numbers have to obey. In previous posts, I discussed

In this post, I’ll explain the mathematical constraints on dimensions (units of measurement). Any theoretical model or data analysis that violates these constraints literally makes no sense. But on the plus side, you can take advantage of dimensional constraints to make analysis of your model easier, through the magic of “nondimensionalization”.

Note: this is going to be an informal introduction. It’s intended as an entry point into the relevant literature, not a substitute.

Most scientific numbers have measurement units (dimensions) attached, though the precise choice of units often is up to the investigator. For instance, length can be measured in cm, m, km, etc. Temperature can be measured in degrees K, degrees C, etc.

Dimensions have to obey certain mathematical rules.

  • You can only compare the magnitudes of quantities of the same dimension. That is, the quantities on either side of an =, <, or > sign both have to have the same dimensions. 5 km = 5km, and 5 km > 3 km, but it makes no sense to compare the magnitudes of 5 km and 5 g. When people say that comparing “apples and oranges” doesn’t make sense, this is the dimensional rule they’re talking about. You often see this rule violated in newspaper business section articles that compare amounts of money (with units of dollars or euros or etc.) to flows of money (i.e. rates with units of dollars or euros or etc. per unit time). For instance, it makes no sense to compare Apple’s market capitalization (an amount) to the GDP of Chicago (an annual rate).
  • Only quantities of the same dimensions can be added or subtracted. This is really just a restatement of the previous rule. 5 dollars + 5 dollars is 10 dollars. But 5 dollars + 5 m isn’t 10 of anything. Even 5 m + 5 cm isn’t 10 of anything–you first have to convert those to lengths to the same dimensions to add them.
  • Dimensions multiply and divide like numbers. 5 km divided by 2 h is 2.5 km/h. And 5 km divided by 2 km is 2.5–a dimensionless ratio of two numbers with the same dimensions. (dimensionless ratios are going to be important later–remember them!)
  • Exponents are dimensionless. If you have an area of 5 km², it has dimensions of km². The superscript “2” is part of the dimension, it doesn’t have dimensions of its own.

In ecology and evolution, we often take for granted that our numbers obey dimensional rules. But it’s worth being careful. I know of at least one high profile theoretical paper in evolutionary ecology that (according to a colleague who read the paper more closely than I did) disobeyed dimensional rules. Which if so would make that model meaningless, in the same way as “2 degrees C + 5 days = 7 somethings”.

We can take advantage of dimensional rules to simplify the analysis of our theoretical models using what’s known as nondimensionalization. Nondimensionalization begins with the observation that the choice of measurement units is arbitrary. Choosing different units doesn’t change the properties of the thing you’re measuring (unless it’s fractal, but leave that aside). 1 minute is same amount of time as 60 s, for instance. Which means that you can make some of the parameters in your model vanish via clever choice of measurement units. The trick is to measure the magnitudes of some parameters and variables in your model relative to other parameters and variables.

For instance, consider the logistic equation, dN/dt = rN(1-N/K). Each side has units of abundance/time. Which means that r has units of 1/time, and N and K have units of abundance. The number 1 has no units. We can of course choose whatever units for abundance and time we want, so long as we make the same choice throughout. So let’s measure time in whatever units needed to make r equal to 1. That is, let’s measure time in units of 1/r. For instance, some of the protists I study have r = 0.2/hour under the culture conditions I use. So if I were to measure r per 5 hours, r=1 (5×0.2). And let’s measure abundance in units of K, so that, when N=K, N=1 in the abundance units we’ve chosen. For instance, some of my protists have K of about 100,000 individuals in a 100 ml culture. So if we measure abundance in units of 100,000 individuals, N=1 when the population is at K, 0.5 when it’s at 50,000, etc.

Armed with these new measurement units, we can rewrite the logistic equation into a simpler, dimensionless form: dN’/dt’ = N'(1-N’), where we’ve used primes to remind ourselves that everything in this equation is now measured in new units. Notice that r and K have vanished! Ok, they haven’t literally vanished, they’re still there in a sense–but we don’t need to show them because they both equal 1, and anything multiplied or divided by 1 is equal to itself. And the lovely part is, we haven’t lost any information by doing this. For instance, we can still set the left hand size equal to 0 to solve for the equilibria, which reveals that N’*=0 and N’*=1. That is, the abundances at which population growth rate is 0 are 0, which equals 0 in the original measurement units, and 1, which equals whatever K was in the original measurement units. And the right-hand side is a humped quadratic function with a maximum at 1/2–i.e. population growth rate is maximal when the population size is 1/2 of K, just as in the original dimensional version of the logistic equation (see here for a more formal walkthrough of nondimensionalizing the logistic equation).

You shouldn’t see nondimensionalization as a magic trick. There’s a deep intuition behind it: that the magnitude of any quantity is only meaningful relative to the magnitudes of other quantities measured in the same units. For instance, in the logistic equation, abundance per se is not what matters for population growth rate. What matters is abundance relative to carrying capacity. Further, abundance relative to carrying capacity only determines population growth rate relative to the intrinsic rate of increase r. This is the intuition behind work like Eric Charnov’s on life history invariants. Different species have very different life histories. But if you scale away those differences via nondimensionalization, you might discover that all of that diversity is just variations on the same underlying theme. Just as different logistically-growing species might have very different r and K values–but if you scale away those differences in r and K, you’ll discover that they’re all described by the same nondimensional equation.

Now, there’s arguably not much point to reducing the number of parameters in the logistic equation via nondimensionalization, because the original equation is so simple. But for more complicated models, nondimensionalization and the associated reduction in the number of parameters can make your model much easier to analyze and interpret. For instance, Stephens and Dunbar (1993) use dimensional analysis to derive an analytical solution to the marginal value theorem for a class of cases for which the derivation would’ve been difficult otherwise.

You can even go a step further and use dimensional rules to make non-obvious predictions, without the need for any substantive biological assumptions. For instance, Stephens and Dunbar (1993) derive a hypothesis about the relationship between a foraging animal’s encounter rate with prey, its movement speed, the area it can scan simultaneously, and prey density, just from knowledge of the measurement units of those four variables. The same logic also reveals an error in previous theoretical work on optimal territory defense.*

As with the previous post in this series, dimensional analysis provides a nice example of how mathematical constraints lead to ecological insight. Nature has to obey the rules of math, and so if you know the rules of math you know some of the rules that nature plays by.

*Stephens and Dunbar (1993) is a great primer on dimensional analysis, this post is really just a plug for it. ht to a correspondent for bringing it to my attention.

29 thoughts on “Mathematical constraints in ecology and evolution, part 4: dimensional analysis

  1. Thanks for this post, Jeremy. I think dimensional analysis should be one of the most basic concepts taught in science. It’s a core skill not only for theoreticians (and I say this as a theoretician who is terrible at nondimensionalization!) but for statistical analysis and for developing deeper institutions about the world. It was the first thing I taught when TAing theoretical ecology to 4th year biology students. But I also got to teach it when TAing an intro-level math course, designed as a substitute for calculus for environmental students, which focused on dimensional analysis and back-of-the-envelope calculations. It was amazing to see how making people to really think through units and relative magnitudes when doing calculations really helped them get a better concept of scientific measurement.

    I’d also note that dimensional analysis is a vital skill in ecological statistics as well. Every time we’re centering or scaling to deal with collinearity or to make variables more interpretable, we’re dealing with dimensions. And as Peter Turchin mentioned in “Complex Population Dynamics”, nondimensionalization is often the first step to fitting a model to time series data, as it reduces the number of parameters to fit, and removes parameters from the model that are impossible to simultaneously estimate.

    • “But I also got to teach it when TAing an intro-level math course, designed as a substitute for calculus for environmental students, which focused on dimensional analysis and back-of-the-envelope calculations.”

      That’s awesome! There’s a weird little book called Street Fighting Mathematics by MIT engineering professor Sanjoy Mahajan that focuses on using back-of-the-envelope tricks to do some powerful mathematics. (The first chapter uses dimensional analysis to solve a Gaussian integral.) It’s one of those books I keep telling myself to look at more thoroughly, but never get the time to…

      • A post I keep meaning to write is something like “how come you never see ecologists doing the sorts of back of the envelope calculations and nondimensionalizations that comprise Street Fighting Mathematics and many of xkcd’s “What If” explainers? But in light of Eric’s comment, perhaps that hypothetical post has a bad premise and ecologists *do* do lots of back of the envelope calculations and dimensional analyses! Or at least, ecologists *could* do lots of them.

        Eric, care to tell us more about what you taught in that calculus for envi scientists course?

      • Ya, that course was fantastic. It was taught by Christopher Barrington-Leigh at McGill, and I think it’s a great template for teaching math in a way that intuitively convinces people of why it matters. I think the cardinal sin of a lot of math courses are that they start with formal proofs and setting up rigorous ideas without spending any time developing people’s intuitive notions of these concepts. And I remember hearing about Street-Fighting Mathematics in the past, but I never got around to reading it. It’s on my to-read list now!

        Jeremy: I don’t think most ecologists do that much deliberate dimensional analysis, although I think it likely factors heavily into how people decide on what scales to set up field studies or experiments. I have noticed more thinking like this as I’ve moved into fisheries, and I think that’s because there’s been a closer connection between fisheries field work, theory, and stats. I definitely think ecology in general would be substantially improved by more explicit exercises like those in XKCD. I think a good qualifying exam questions is to ask what the units are for any coefficients in a proposal 🙂

      • There’s another great book along the lines of Street Fighting Mathematics called Consider a Spherical Cow by John Harte.

    • Eric; dimensionless numbers in fisheries, particularly related to growth and mortality, were the stimulus for the ‘Life history invariants’ work. I was taught them as a grad student , and wondered what they meant for decades. They are now widely used in management models, and provide guidance in situations where things like mortality are otherwise unknown.

  2. Hi Jeremy;
    your post is a great informal introduction to the power[ yea, I call it magic] of dimensional analysis, including the Wikipedia article,…. and the stephens/dunbar paper deserves to be widely read by ecologists.
    Since we all find familiar examples easier to learn from, consider Ro, the ‘net reproductive rate’ from population dynamics and demography. It is perhaps the most widely used dimensionless number in our trade. As an inequality [ Ro>1] it tells us if a species is growing in pop size, or if an invader is spreading into a pop or community. If Ro= 1 the pop is not growing in size; several facts follow immediately [ female just replaces her self], and so forth. For non-growing pops Ro for a rare (geno) type tells us if the rare type is being selected for. Ro can thus be used as a stability criteria to find the ESS ‘Kind’ .It can be written in an a rather general form Ro= SbE, for any age structured life history [ S= survival to maturity, b= average yearly birth rate, E= average length of the adult life span], and this multiplicative form has several useful symmetry properties. And evolutionary life history theory based on metabolic production constraints blended with maximizing Ro as fitness [ aka, non-growing pops] has some unusual and desirable properties [ and yes Ro can = 1 at the same time it is at an optimum]. One implication is here, a plug for a life history paper of mine:
    When I teach life history theory, I first ask my class to just list what they think are the main life history variables / parameters: they all have units of time , mass [ or mass/time]; then we are off and running since several things are implied by just this, particularly if we realize that Ro, fitness, is dimensionless.
    cheers, ric

  3. of course the most common dimensionless number of all is Pi, a ratio of 2 lengths that define the quality of being a circle, independent of the actual size of the circle; OR IS IT about the circle(? )since Pi appears everywhere in mathematics: see

  4. Given citations of Dave Stephens, Borer and Seabloom, the (Allison) Shaw and Stanton paper, Mike Travisano’s papers (including one with Ruth Shaw), and (of course) Tilman, I think University of Minnesota EEB must be one of the most cited departments on Dynamic Ecology!

  5. Candidly, I am only remotely familiar with the techniques you use relative to your research on protists. Nondimensionalization is something I have used frequently in my work in chemistry, and I think it is fairly common in that field. For lab experiments I have found it especially useful.

    I was curious though if nondimensionalization- when involving field data might run a risk- depending on what variables were effected. Specifically, I am curious if the procedure would yield the variance one would expect if all data points were randomly selected independent of one another. If that were true, then the variance we would observe following nondimensionalization would be less than the true variance occurring in nature. Thoughts?

    • “I was curious though if nondimensionalization- when involving field data might run a risk- depending on what variables were effected. Specifically, I am curious if the procedure would yield the variance one would expect if all data points were randomly selected independent of one another. If that were true, then the variance we would observe following nondimensionalization would be less than the true variance occurring in nature. Thoughts?”

      Afraid I don’t follow. Can you elaborate with an example of what you have in mind?

      • I was curious what would happen if, for instance, one were to remove spatial dimensions from field data. While that procedure would render the data dimensionless, it would also erase the inherent variability that exists in the environment (especially with regard to autocorrelation).

        Even though we often “randomize” our sampling regimes in nature, we never acquire a data set where all data points are independent of one another- so they are not truly random. Alternatively, I can design lab experiments wherein data points are independent of one another. So when we make field data dimensionless, I wondered if we might also artificially deflate the variance by essentially introducing a randomness that does not occur in nature.

      • Afraid I still don’t follow, Elliot. The location at which an observation was collected has nothing to do with the dimensions of the observation. So this post has nothing to do with spatial autocorrelation or ways to remove it from one’s data (e.g., by randomly shuffling the spatial locations at which observations were collected).

        I think Brian’s old post on autocorrelation may be of interest to you:

      • ah- thanks Jeremy- you answered my question. it wasn’t clear to me in the original post if what you described would preclude location. thanks!

    • Well, “dimensional analysis” includes “scaling measured quantities so as to convert them into dimensionless numbers”. There are many examples of that outside the context of analyzing mathematical models. Relative fitnesses for instance are dimensionless ratios: you take absolute fitnesses (which have dimensions), and divide them all by mean or maximum absolute fitness. Correlations are dimensionless ratios of covariances to variances. Etc.

      Thanks for the link, that’s a good example.

      • Thank you for the examples, Jeremy. I was thinking about the allometric relationships such as density mass allometry and wondering why the dimensions do not agree on both sides of the scaling relationship. But now I realize that is something different.

      • With allometric relationships (and power laws in general), their actually should be scaling factors that act to get the dimensions right; it’s just that people don’t typically write them down explicitly. So, if we were scaling between, say, body size (units in grams) and metabolism (units in calories per day), we generally write an allometric relationship as:
        M = a*w^b,
        where metabolism and w is weight, and the units of a and b generally aren’t specified.

        but it should be written as:
        M = a*(w/w’)^b

        where w’ is a scaling factor equal to 1 gram. Then a should have units of calories per day to make the units work out.

      • Hi Eric; In my experience people are pretty careful[ see calder’s 1984 book] to make sure the ‘units’, the dimensions, match up in writing physiological or life history allometries.
        In the typical LH allometry, say Z= instantaneous mortality rate [units are 1/time], power b a dimensionless #, W = mass……………..
        Z=AW{b power}: the units to do this are carried by ‘A’, and its numeric value changes as we alter the units; mass… grams vs kilograms, , time…years vs days.
        So A has units W{-b power}/time.
        I think your math suggestion is correct, but awkward : best to just get the units of ‘A’ correct in the first place.

      • @Eric:
        What Ric said. Your way of assigning consistent dimensions to the parameters in a power law seems technically correct but unnecessarily over-elaborate to me. Why not just say that the parameter “a” has the dimensions needed to make the left-hand side and right-hand side have the same dimensions?

      • I can see both sides of this. In physics we are careful to track the exponents of units. m^2 vs m vs m^3 is the difference between area, length and volume.

        if the exponent b were integer (e.g. 1 or 2) we would be equally careful in tracking units from the things being raised to a power (e.g. mass) and incorporating them into the premultiplier. EG if (not true but if)
        E=aM^2 and E is in units of energy/time then a would have units of energy/time/g^2 and it would all work. It does appear to usually work in physics.

        But because b usually fractional, it gets messy. I agree Eric’s approach is awkward but accurate. But I also cannot agree that just treating M^b (with b=0.75) in dimensional analysis that M^b has the same units as M and it is fine to just roll the unit of M into the pre-multiplier (a). (a being in units of energy/time/g in the above example – it technicallly should be energy/time/g^0.75)

        While allometry has to be counted as one of the more successful areas of ecology, it has always bugged me that it violates one of the most basic principals of mathematical modelling.

        There aren’t a lot of fractional exponents in physics. Not sure what they do when they run into one.

      • I agree with everyone that the scaling factor is a bit tedious (I leave it implicit too!). I don’t, however, generally agree with the approach of absorbing the unit into the A-term… for one thing, it means the dimension of your units is changing as you estimate it, which seems… strange.

        Also, scaling it like I showed here makes more sense when you’re estimating slopes in a log-log regression, since you have to take the logs of both sides, and a log-transform should only be applied to dimensionless numbers; Something having units of (for instance) log(mass) doesn’t make any sense. For instance, what would the units be for log(mass 1) – log(mass 2)? Following how dimensions normally work, it would have units of log(mass), but following the rules of logarithms, it would also have units of log(mass/mass), which is unitless.

      • Thank you all for your comments on assigning dimensions to parameters in power laws. I’m learning a lot and being forced to think harder. Like Brian, I can now see pluses and minuses to both approaches.

Leave a Comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s