##### IPMs

Several good introductions to IPMs now exist in the ecological literature, and these can be consulted for background information about the technique (Ellner & Rees 2006; Williams & Crone 2006; Rees & Ellner 2009). The basic idea is that IPMs represent populations as a probability density function, *n*(*x*,* t*), that characterizes the probability of individuals at time *t* being of size *x*. The population size distribution at time *t* + 1 is described by the kernel:

- (eqn1)

where *k*(*y,x*,θ) describes all possible transitions between individuals of size *x* at time *t* to size *y* at time *t + 1*, with environmental covariates, θ, and constrained between lower (L) and upper (U) size limits. This kernel is made up of growth-survival and fecundity functions:

- (eqn2)

The function *p*(*y*,* x*, θ) describes size-dependent survival and growth, and f(*y*,* x*, θ) describes size-dependent fecundity. As with matrix models, the growth-survival function allows individuals to grow, stay the same size or regress in size. When plants in the model reach the specified upper (U) or lower (L) size limits, they can become unintentionally ‘evicted’ from the models, artificially reducing population growth rates (Williams, Miller & Ellner 2012). In order to prevent the loss of individuals from the models, we used truncated normal distributions for the growth function (Williams, Miller & Ellner 2012), limiting the maximum size of plants to the maximum observed (39 leaves). Although this is an assumption that puts a size cap on the demographic rates, there is a very large upper tail to the observed size distribution in the field, and very few plants will ever reach this size and are unlikely to differ substantially from 39 leaf plants in their demographic rates.

These functions describing probabilities of survival, growth and fecundity were parameterized using mixed models that included plant size and normalized environmental covariates (soil moisture and light) at the 2 m × 2 m cell level. For each vital rate, two models with different hierarchical structure were fit in order to test for the appropriate scale at which demographic responses to the environment vary. In the first model, intercepts were allowed to vary among populations, but relationships with moisture and light were assumed consistent within the landscape. Thus, the growth of individual plant *i* in cell *c*, population *p* and year *y* was modelled as:

- (eqn3)

where *M*_{c} and *L*_{c} are the soil moisture and light availability, respectively, in the grid cell. The mean growth rate was allowed to vary linearly (δ_{size}) with plant size, *x*_{i}. The parameter α_{p} is a population-level intercept, and the β's are regression coefficients describing the effects of soil moisture, light and their interaction, on growth rates. The second-order abiotic terms (*M*^{2} and *L*^{2}) were included in order to allow for nonlinear relationships with moisture and light (e.g. unimodal or saturating relationships). The inclusion of second-order terms was based on analyses of the species' distribution (Diez & Pulliam 2007; Fig. 3), as well as a common biological assumption that species have optimal environmental conditions, with performance declining as conditions depart from the optimum. Interactions between each environmental variable and plant size were also included to test for size-dependent responses to the environment (Williams & Crone 2006). The population-level intercepts were modelled hierarchically, where the population relationships are drawn from an overall landscape-level coefficient: for example, α_{p} ~ Normal(α_{landscape}, σ^{2}). A random effect for year, RE_{y}, was included to account for annual variation in growth. The errors for the growth model, ϵ_{i}, were modelled as Gaussian.

Survival (0/1) was modelled similarly to growth, but using a generalized linear model with a *Bernoulli* sampling distribution and logit link function in order to estimate the probability of survival as a function of the same set of covariates. Clonality was estimated in a similar manner to survival, with the probability of a clonal recruit emerging in a given year being estimated as a function of ramet size and the abiotic environment. These probabilities of producing clonal offspring were added to the fecundity distribution, thus augmenting the production of new individuals each year. Fecundity from production of seeds was difficult to directly observe, so it was modelled using several pieces of information. The true numbers of seeds and protocorms (pre-seedling symbiotic stage) were unobservable in the field because the seeds are minute, and the protocorms are generally buried within leaf litter. Therefore, fecundity was modelled as the product:

- (eqn4)

The number of capsules per flower was directly observable, whereas the number of seeds per capsule was estimated by capsule dissections, and the number of protocorms per seed was estimated from seed packet introduction experiments (Diez 2007). The probability of flowering was modelled at the individual level, conditional on plant size, light and moisture, using logistic regression as described for survival. The other reproduction parameters were estimated independent of the environment at the grid level.

The second model structure fits to each vital rate allowed the slopes of these regressions to vary among populations instead of assuming the same relationship for all populations. The same models as above were fit to the data, but the regression coefficients, β, were allowed to vary among populations and be linked via an overall landscape-level coefficient. For example, β_{1,p} ~ Normal(β_{1,land}, σ^{2}) described the population-specific responses to soil moisture, and other coefficients β_{2,p}, β_{3,p}, β_{4,p}, β_{5,p} were modelled similarly. The σ^{2} parameters describe the variance among populations in the species' responses to each environmental variable, and β_{1,land} is a parameter estimated from the data that describes the expected relationship with soil moisture for an average population in the landscape. These models also had intercepts, α_{p}, that varied among populations and were modelled hierarchically from an overall landscape-level intercept.

The differences between these two model structures are important to understand in terms of their corresponding ecological hypotheses. The first model with variable intercept α_{p} and constant β across populations assumes that the species' underlying relationship to the abiotic environment is the same in the different populations within this landscape. However, the variable intercepts shift the resulting relationships up or down in magnitude due to other, unidentified differences among the populations. The second model, which includes intercepts α_{p} and slopes β_{p} that both vary among populations, hypothesizes that the underlying relationships with the abiotic environment are different across populations. That is, a plant's growth rate, for example, may respond strongly to increasing soil moisture in one population but only weakly in another. These differences may arise either through differences in abiotic and biotic context or through local adaptation. Both would give rise to apparent differences in the species' niche relationships across populations. These two model structures are displayed visually in the appendix (Fig. S1.5 in Supporting Information).

All models were fit using Markov chain Monte Carlo (MCMC) algorithms in OpenBUGS (Lunn *et al*. 2009), as called from R (R Development Core Team 2008) using package R2OpenBUGS (Sturtz, Ligges & Gelman 2005). All parameters were given non-informative priors. Regression coefficients and overall intercepts were given Normal priors with mean 0 and variance 1000, and variance parameters were given Uniform priors between 0 and 100 on their standard deviations. Three independent chains were run for 10 000 iterations after discarding a 2000 iteration burn-in period, and convergence was assessed visually and using the Gelman–Rubin convergence statistic. Parameters were considered statistically significant if their 95% confidence interval was not overlapping zero. After convergence, the 10 000 iterations were thinned to 1000 MCMC estimates of each vital rate (growth, fecundity, survivorship, clonality) in order to parameterize an integral projection model (IPM) and calculate finite population growth rates (λ) using R code modified from Ellner & Rees (2006). We conducted model selection to explore subsets of the full model that include as covariates light, moisture and the interaction between light and moisture.

Density dependence was explored by plotting individual vital rates as a function of the number of plants within 2 m × 2 m cells. We found no evidence for the effects of density on vital rates except for clonality, which was higher at low density (Fig. S1.3). Therefore, the mixed models for clonality included a density covariate, and subsequent predictions as a function of abiotic covariates were made conditional on zero density. This approach assumes that responses to the abiotic environment at low density are the most appropriate characterization of the abiotic niche of a species.

The coefficients describing responses to the abiotic environment (β's in above equations) were used to predict population growth rates across gradients of moisture and light. This approach is similar to that used in Dahlgren and Ehrlén (2009), who explored how λ varied with soil potassium and seed predation. Here, instead of bootstrapping to obtain uncertainty of these predictions, we used MCMC parameter estimates from the mixed models to propagate all uncertainty in parameters to uncertainty of predicted growth rates. The resulting posterior probability estimates of λ were used to calculate the probability of positive population growth rates, *Pr*(λ > 1), conditional on the abiotic variables, by calculating the proportion of the MCMC iterations that yielded a λ > 1. Although a variety of other demographic measures can be calculated from IPMs, we focus on λ here because it is the most relevant for assessing the relative strength of sources and sinks.

The predicted population growth for each cell, calculated based on its measured abiotic variables, was then compared to observed presence/absence and abundance of *G. pubescens* in that cell. Generalized linear models, with Bernoulli error distribution and logit link function, were used to test the relationship between presence/absence and *Pr*(λ > 1). Generalized linear models with Poisson error distribution and log-link function were used to test the relationship between abundance in a cell and its predicted *Pr*(λ > 1). We used an exponential regression for the relationship between abundance and the *Pr*(λ > 1) at the population scale. With only six populations, there is limited ability to discern the shapes of nonlinear functions, but it is plausible that abundance may increase rapidly as habitat suitability increases. These models were fit in a Bayesian framework, and parameters significance was based on the posterior distributions of the regression coefficients.