## Introduction

Resource selection by animals is an important determinant of fitness and is a focus of many ecological studies (Franklin *et al*. 2000). A common approach for examining species occurrence and habitat selection in the ecological literature is resource selection functions (RSF; Manly *et al*. 2002). RSF models are attractive to ecologists because they provide quantitative, spatially explicit, predictive models for animal occurrence (e.g. Mladenoff *et al*. 1995; Johnson, Seip & Boyce 2004). RSF models are commonly developed by comparing habitat characteristics at sites that were used by animals to those that were potentially available (RSF; Manly *et al*. 2002). Model coefficients are estimated using logistic regression, which assumes independence among observations (Hosmer & Lemeshow 2000). While independence is feasible in some RSF designs, recent reviews emphasize that most studies fail to satisfy this assumption (Morrison 2001). Autocorrelation among observations produces incorrect variance estimates (Otis & White 1999) and an increased Type I error rate (Leban *et al*. 2001). To avoid pseudoreplication (Hurlbert 1984), researchers often rarify data to achieve independence (Swihart & Slade 1985), resulting in an unfortunate loss of information (McNay & Bunnell 1994).

There have been two general solutions for non-independence among observations in resource selection studies. The first is compositional analysis (Aebischer, Robertson & Kenward 1993), in which individual animals are identified as the unit of replication. Unfortunately, compositional analysis is limited by increased Type I error rates from rare habitats (Bingham & Brennan 2004). In addition, it cannot accommodate continuous covariates or interaction terms when comparing among individuals, nor Poisson, binomial or other dependent variable structures. A second solution is the Huber–White sandwich variance estimator, which can be used to calculate robust standard errors without affecting coefficient estimates (White 1982; Newey & West 1987; Pendergast *et al*. 1996). However, because unbalanced numbers of locations among individuals are common in telemetry studies, coefficients will be biased toward the most sampled individuals (Follmann & Lambert 1989). Therefore, in the presence of an unbalanced design, variance inflators provide only a partial solution to non-independence.

Mysterud & Ims (1998) discuss an additional difficulty in studies of resource selection that has yet to be addressed comprehensively. They demonstrated how use of a resource might differ contingent upon the availability of that resource, which they define as a functional response in resource selection. If animals require a particular amount of a given resource, they may show strong selection for it when scarce but avoid it when it is abundant. Although Mysterud & Ims (1998) criticized the assumption that selection is independent of availability, a flexible treatment of functional responses has not been attempted.

The dual problems of non-independence and functional responses in resource selection can be addressed through the application of random effects to RSF models. Random effects are applied widely in cohort, survival and other hierarchical designs where individuals or groups are sampled repeatedly (e.g. Natarajan & McCulloch 1999; Burnham & White 2002; Krawchuk & Taylor 2003). Random effects can accommodate non-independence within groups, such as samples within individuals or individuals within populations (Breslow & Clayton 1993). Although Aebischer *et al*. (1993) first suggested using random effects in resource selection studies, few have incorporated random effects into resource selection or species distribution models in general (see reviews in Rushton, Ormerod, & Kerby 2004; Guisan & Thuiller 2005). Recent developments of generalized linear mixed models extend random-effect designs to binomial responses (Breslow & Clayton 1993; Skrondal & Rabe-Hesketh 2004) and, thus, to modelling resource selection.

In this paper, we first provide a brief overview of random-effects models and introduce their application to resource-selection modelling. We then illustrate the application of random-effects models to a case study of grizzly bear (*Ursus arctos* L.) resource selection in the Canadian Rocky Mountain Foothills (Nielsen *et al*. 2002). We consider grizzly bear resource selection for simple categorical and continuous covariates, and compare fixed-effects (without random effects) RSF models to those with random effects for the intercept, categorical and continuous variables. To aid in our interpretation of random effects in this empirical example, we simulated data for three common scenarios where random effects are included in RSF models: (1) balanced vs. unbalanced samples; (2) differences in selection among individuals for a continuous or categorical covariate where availability is constant; and (3) availability varying among individuals and selection is either constant or follows a functional response. We conclude with a discussion of how the inclusion of random effects can control for common limitations in resource selection studies and yield more robust ecological insights.

### a brief overview of random effects

Following from their first exposition in anova-type models (e.g. Bennington & Thayne 1994), a variable is considered random when the investigator has not controlled explicitly for levels of the variable in the experimental design, but has chosen a random sample of levels from the population (Neter *et al*. 1996). An example would be individual red deer (*Cervus elaphus* L.) within a population where levels of individual variation (e.g. age) were not fixed but assumed to be representative of the population. By including a random effect for individuals, individual variability is identified explicitly and the scope of inference can be extended to the entire population (Neter *et al*. 1996).

In addition to providing valid population-level inferences, random effects are often invoked to control for correlations among samples. For example, a particular response variable (e.g. telemetry locations) may be correlated within particular strata; for example, within a group (individual deer) or hierarchical association (deer within herds). This unobserved heterogeneity within levels could produce pseudoreplicated samples (Hurlbert 1984) that lack independence, even after controlling for the fixed effects of covariates (Skrondal & Rabe-Hesketh 2004). Parameter estimates from such fixed-effects models will often be biased (Skrondal & Rabe-Hesketh 2004). An added benefit of random-effect models is to allow group-level specific estimates for a response, known as the conditional estimate. In comparison, the overall model estimate is known as the marginal, or population-level estimator for a particular response variable (Breslow & Clayton 1993; Begg & Parides 2003; Skrondal & Rabe-Hesketh 2004).

In addition to accounting for within-strata variation, random effects can be used to control for unbalanced designs in the number of observations among individuals or groups (Bennington & Thayne 1994). Without a random intercept for individuals with unbalanced data, sample size differences may influence model coefficients. By accounting for these relationships among samples, including correlation or sampling design-related issues, random effects provide more robust ecological inferences (Pendergast *et al*. 1996).

Random effects can be added to fixed-effects regression models, including RSF models, in two ways. Random intercepts allow the intercept or magnitude of the response to vary among groups (Fig. 1a), whereas the inclusion of random coefficients allows the effect of covariates to vary among groups (Fig. 1b) (Begg & Parides 2003; Skrondal & Rabe-Hesketh 2004). In RSF models, random intercepts influence overall prevalence which, as we illustrate below, often arises because of unbalanced samples (Fig. 1a). Random coefficients can be included when there is variation in individual animal, group, etc. responses to a particular covariate (Fig. 1b). Random-effects models can easily accommodate two or more levels, e.g. samples from individual deer within herds within populations, or wolves (*Canis lupus* L.) within packs. When a model contains both random- and fixed-effects, it is termed a mixed-effect model. Functional responses in selection might be accommodated through the combination of a random intercept and random coefficient (Fig. 1c).

Assumptions of random-effects models include (1) correlations within groups are constant over time unless modelled explicitly; (2) the random effects are normally distributed with a zero mean and unknown variance components; and (3) the variance–covariance structure is specified correctly (Breslow & Clayton 1993; Skrondal & Rabe-Hesketh 2004). The most common structure is compound symmetric, which considers covariance among all responses of an individual to be constant (Skrondal & Rabe-Hesketh 2004). For time-series data, an autoregressive structure could be useful (Pinheiro & Bates 2000). More complex structures could include average, lagged, factor, unrestricted and hybrid correlation structures that are beyond our purview (see Pinheiro & Bates 2000 for more detailed information).