A Latent Variable Mixed-Effects Location Scale Model with an Application to Daily Diary Data

A mixed-effects location scale model allows researchers to study within- and between-person variation in repeated measures. Key components of the model include separate variance models to study predictors of the within-person variance, as well as predictors of the between-person variance of a random effect, such as a random intercept. In this paper, a latent variable mixed-effects location scale model is developed that combines a longitudinal common factor model and a mixed-effects location scale model to characterize within- and between-person variation in a common factor. The model is illustrated using daily reports of positive affect and daily stressors for a large sample of adult women. Supplementary Information The online version contains supplementary material available at 10.1007/s11336-022-09864-8.

Psychological investigations that rely on repeated-measures study designs typically aim to study within-and between-person variation in a response over repeated occasions. Popular models for these kinds of problems are latent curve and mixed-effects models (Bollen and Curran 2006;Singer and Willett 2003;Skrondal and Rabe-Hesketh 2004). Often these models are applied to describe the typical longitudinal trajectory of a population and individual differences in the features that describe the trajectories (e.g., Ricker et al. 2018). Other investigations additionally include study of the within-person variation of the repeated measures (e.g., Kim and Cicchetti 2009). For time-intensive data collections over relatively short periods of time, the study of within-individual variation may be the primary focus (e.g., Allaire and Marsiske 2005). Many applications of latent curve and mixed-effects models have emphasized inference from the subject-specific model and the random effects that distinguish the individual trajectories, often while assuming that the errors in the occasion-level model have equal variance, not only across measurement occasions but across individuals. Otherwise, a number of options, largely restricted to data that are equally spaced with regard to time, in specifying the residual covariance structure may be considered to better represent variation (and possibly covariation) of scores within individuals, even if only to improve inference about the fixed effects of the model and individual differences in the coefficients of the subjectspecific model. In some types of investigations that rely on repeated measures data, heterogeneity of the occasion-level residual variance may be a particularly interesting feature of the response, potentially offering further insight into individual differences in repeated measures. Depending on a study's goals, examination of both within-and between-person variation in repeated measures data can be important in fully understanding and characterizing psychological variables (Molenaar 1985;Nesselroade 2004).
A mixed-effects location scale model offers a way to explicitly model within-and betweenperson variation in repeated measures data and possesses key features that distinguish it from typical formulations of a latent curve or mixed-effects model. An extension of a standard mixedeffects model, a mixed-effects location scale model includes a model for the variance of a random

Repeated Measures from Daily Diary Studies
Data from daily diary studies often display fluctuations in scores within individuals. An example is a set of daily positive affect scores for 9 individuals shown in Fig. 1 that come from the Midlife in the United States (MIDUS 2): Daily Stress Project (Ryff andAlmeida 2004-2009). The data are part of a larger longitudinal study that began in 1995 (MIDUS 1) and included a nationally representative random-digit-dial sample of noninstitutionalized, English-speaking adults residing in the contiguous USA. Participants of MIDUS 1 were invited to participate in a second longitudinal wave (MIDUS 2) about 10 years later, along with a newly added adult cohort. From MIDUS 2, a subset of participants were selected at random to participate in the Daily Stress Project. Participants were interviewed by telephone to obtain daily self-reports for 8 consecutive days. Multiple scales were administered daily to measure different psychological constructs. Here, responses for 435 women with complete data on 5 survey items designed to reflect daily positive affect are considered. For instance, the first item asked "Did you feel in good spirits?" Items were measured using a 5-point ordinal response scale: 0=none of the time to 4=all of the time. In Fig.  1 are daily scores for 9 women, with scores computed as the daily mean of the 5 scale items. Calculating an average or summed score is a common way to handle responses obtained for a set of items designed to measure a common construct (e.g., Hedeker et al. 2012;Rast et al. 2012). Although a measurement model for these items is provided later in Section 4, it is useful to first consider the usual approach to handling responses to multiple items. As shown in Fig. 1, the solid horizontal line that is common to all panels of the display is the mean score of 2.8 calculated across days and women. The dashed horizontal line unique to each plot is the individual's response averaged across days. From the display, it can be seen that within individuals, scores fluctuate from day to day relative to the individual's mean, and the extent of the daily variation within Daily positive affect scores (y i ) and daily positive affect scores averaged across days (ybar i ) for 9 study participants, plotted with the mean score (2.8) across days and all participants.
person varies between people. The mean responses of individuals differ from the overall mean and from each other. It is also interesting to note that for some individuals, scores reach the maximum possible score of 4 (Case 10186) while also displaying vary little variation across days. Although standard mixed-effects model might be effective in characterizing the differences between individuals with regard to their mean affect levels, the model would not address the between-subject heterogeneity of the intraindividual variation. Indeed, it is the between-subject differences in the within-subject variation that is a notable feature of the affect scores. Thus, a mixed-effects location scale model that permits the within-subject variance to vary by subject would seem to be quite suitable in characterizing the scores. This, in particular, would help to address possible ceiling effects in measurement (Hedeker et al. 2012).
Common to many studies of a psychological variable is an implicit assumption that the variable is composed of trait-and state-level components (Nesselroade 1987). For example, latent state trait theory suggests that a psychological measure is comprised of three independent sources: a latent trait, a latent state residual and measurement error (Steyer et al. 1992). The latent trait component reflects the part of the score that is not specific to the measurement occasion, but rather, is unique to the person. Conversely, the latent state residual component is specific to the measurement occasion and the individual and, as such, is expected to fluctuate about the traitlevel component according to the measurement occasions. Importantly, both the latent trait and state components are assumed to be free of measurement error. To permit study of the two latent components of a psychological variable, a second-order model can be applied to account for measurement error in the observed measures (Steyer et al. 1992). An interesting application of a mixed-effects location scale model is to problems such as the study of daily positive affect (Hedeker et al. 2012;Rast et al. 2012). The model provides a framework for separating the trait and state components of a measured variable (albeit assumed to be measured without error) while allowing the state residual to be truly unique to the individual by inclusion of a random subject effect in a model for the occasion-level residual variance (i.e., state residual variance). However, the standard formulation of the model does not address measurement error. To address the issue of measurement error in applications of latent state trait theory, a common factor model is applied to repeated measures data. The variance of a general common factor is assumed to be due to the latent trait factor and the variance of the occasion-specific factor is assumed to be due to the latent state residual factor. Thus, a potentially useful model is a latent variable mixed-effects location scale model that would permit partitioning of the observed item variance into the distinct components, and additionally, provide a truly person-and occasion-specific measure of the state residual variance.

The Mixed-Effects Location Scale Model
A two-level linear mixed-effects location scale model is described here (for a 3-level model, see Lin et al. 2018; for a generalized linear version of the model, see Hedeker et al. 2016). Let y ti be an observed response at time t = 1, . . . , n i , for individual i, i = 1, . . . , N , where n i denotes that the number of observations can vary by the individual. Missing data are assumed to be missing at random. A linear mixed-effects location scale model for y ti can be given as (cf: Hedeker et al. 2008): where x ti is a p x 1 vector of covariates that vary according to the measurement occasion t and individual i and would usually include a "1" for the intercept of model, and w i is a q x 1 vector of covariates that vary according to the individual i. The coefficient β x is a set of p fixed regression coefficients linking x ti to y ti , and υ i is a set of p * ≤ p random subject effects that correspond to one or more of the fixed effects in β x . The coefficient β w is a set of q fixed regression coefficients linking w i to y ti . The random effect υ i is assumed to be independent and normally distributed across individuals as where the between-subject covariance matrix υ may be a function of between-subject covariates (w i ) and corresponding coefficient vector α, with α = (α 0 , . . . , α q ) denoting the set of coefficients that link the covariates to elements of the matrix υ . The set of coefficients ρ υ = (ρ 1 , . . .) are the correlations between the random effects conditional on w i . For instance, a common application of a mixed-effects location scale model is one in which only the intercept is random (e.g., Hedeker et al. 2008), and so υ = φ 2 υ i with the variance of the random intercept modeled as where α 0 , when exponentiated, is the variance of υ i conditional on w i . The remaining coefficients are the between-subject covariate effects on the between-subject variance. A positive effect of a coefficient indicates that a unit increase in a covariate corresponds to an increase in the variance of the random effect; a negative effect indicates that a unit increase in a covariate corresponds to a decrease in the variance. As will be shown later using an empirical example, allowing a between-subject variance to be a function of covariates makes it possible address between-subject heterogeneity of variance in a random effect. At the occasion level, the residual ε ti in (1) is assumed to be independent and normally distributed as: where the variance σ 2 ε may be a function of x ti (that would usually include a "1" for the intercept) and w i , with corresponding coefficient vector τ = (τ x , τ w ), where τ x = (τ x1 , . . . , τ xp ) and τ w = (τ w1 , . . . , τ wq ) denoting sets of coefficients that link the within-subject and betweensubject covariates, respectively, to the within-subject variance σ 2 ε . In (4), the coefficient a i denotes a between-subject random effect. Specifically, the variance of ε ti is modeled as where τ 0 , when exponentiated, is the residual variance conditional on the covariates and for a subject for whom a i = 0. Similar to the interpretation of the covariate effects in (2) that serve to account for between-subject heterogeneity of variance in a random effect, a positive value for the effect of a covariate in the model for the within-subject variance indicates that a unit increase in a covariate corresponds to an increase in the residual variance, and a negative value indicates that a unit increase in a covariate corresponds to a decrease in the variance. As will be shown later using an empirical example, allowing the within-subject variance to be a function of covariates makes it possible address heterogeneity of the individual and occasion-specific residual variance. The model for the variance of the occasion-specific residual ε ti in (4) includes a i to address heterogeneity of variance due to unobserved effects. That is, the variance of ε ti may differ between individuals, even after conditioning on covariates, and so including the random effect a i allows for heterogeneity that may remain. This may be important, for instance, in problems for which there are between-subject differences in the variability in scores across occasions, such as if a ceiling effect in the measurement of the response is present and this results in reduced variation in scores for individuals whose average scores are at the extremes of the response scale. The random effect is assumed to be independent and normally distributed as At the subject level of the model, the random effect υ i in (1) and the random effect a i in (4) may covary. To allow this, the random effects are stacked, with the set defined here as c i (r x1) = υ i , a i to include all r = p * + 1 random effects. It is assumed that the joint distribution of c i is where the covariance matrix is It follows that the probability distribution of c i is Letting y i = y 1i , . . . , y n i and conditional on c i , the distribution of y i is where and where i (x ti , w i ) is a design matrix containing the within-and between-subject covariates, β = β x , β w is a stacked set of fixed coefficients linking the covariates to y i , and assuming independence of the occasion-specific residuals between occasions and subjects, ε (x ti , w i , τ ,a i ) = I n i σ 2 ti (x ti , w i , τ ,a i ), with I n i being an identity matrix of order n i . Then, the conditional probability density function can be defined as and the marginal distribution of y i is then The parameters of the model are γ = β, α, τ, φ υ , φ υa , φ 2 a . Given a random sample of observations, y 1 , . . . , y N , the marginal log-likelihood of γ is The model for y i is nonlinear in the scale random effect, a i , and consequently, the integral in (14) does not have a closed-form expression. Estimation of the integral generally would rely on an approximation to the integral (Pinheiro and Bates 1995), such as by implementing SAS 1 PROC NLMIXED that permits random effects to be incorporated into the within-subject covariance matrix in (4) (see Hedeker et al. 2012).

Example: Manifest Measures of Daily Mean Positive Affect
The daily mean positive affect scores described earlier for the 435 women are analyzed using a mixed-effects location scale model (Hedeker et al. 2012;Rast et al. 2012). Within individuals, daily measures of positive affect may not be expected to change systematically with the passage of days, but rather, vary across days. Additionally, scores averaged across days within individuals would be expected to naturally vary between individuals. Accordingly, the manifest measures of mean positive affect are assumed to follow a random intercept model: where, for participant i, y ti is the observed mean positive affect score on day t, β 0i = β 0 +υ i is the expected response across days, and ε ti is the discrepancy between the observed and fitted responses on day t. The random intercept β 0i represents the trait component that varies by individual, and the residual ε ti represents the state component that varies by both individual and occasion. The random intercept is assumed to be normally distributed: This expression of the variance of the random intercept becomes useful later when covariates are added to the model to address between-subject heterogeneity in the random intercept variance. The residual is assumed to be normally distributed: and a i is a random subject effect that is assumed to be normally distributed: a i ∼ N 0, φ 2 a . At the subject level, the random intercept and the random effect of the within-subject variance may covary: cov (υ i , a i ) = φ υa . The model has five parameters: γ = β 0 , α 0 , τ 0 , φ 2 υ , φ υa . To assess the need to include the random effect in the model for σ 2 ε , estimates were obtained for a reduced form of the model, henceforth called Model A 1 , that assumed homogeneity of the residual variance, and so φ 2 υ = 0 (1st set of estimates in Table 1 corresponding to Model A 1 ). Thus, Model A 1 is a random intercept model with a fixed intercept β 0 and includes parameter α 0 of the variance model for the random intercept (φ 2 υ = exp {α 0 }), and parameter τ 0 of the variance model for the residual (σ 2 ε = exp {τ 0 }). Model A 1 and the mixed-effects location scale model, henceforth called Model A 2 , were fit using SAS PROC NLMIXED version 9.4 using nonadaptive Gaussian quadrature with 7 quadrature points. Increasing the number of quadrature points beyond 7 or using a Laplacian approximation (Vonesh 1996) did not result in a converged solution for Model A 2 . Maximum likelihood (ML) estimates of Model A 2 are given in Table 1 (second set of estimates). Starting values for the estimation of these models involved fitting a fixed-effects model first, followed by adding a random intercept (for Model A 1 ), then a random effect in the within-subject variance model and the covariance between it and the random intercept (for Model A 2 ). ML estimation carried out using SAS PROC NLMIXED with a Laplacian approximation). Model A 2 that assumed φ 2 υ > 0 yields an improvement in model fit in terms of the AIC, from 6, 087 (Model A 1 ) down to 5, 547 (Model A 2 ) suggesting between-subject heterogeneity of the within-person variance. A likelihood ratio test (LRT) of the goodness-of-fit between the two models using 2 df is χ 2 2 = 6, 081 − 5, 537 = 544, p < .001, supporting the need to include the random effect in the occasion-level residual variance model. From Model A 2 , the estimated common variance of the residual is exp(−1.84) = 0.16, and the estimated standard deviation of the random effect in the model for σ 2 ε is 1.16. These results suggest between-subject differences in the extent to which daily positive affect scores vary from day to day. The estimated correlation between the random intercept and the random subject effect for the within-subject variance is r = −.36, suggesting a tendency for those with a relatively low day-to-day variation in positive affect scores to also have a relatively high positive affect score averaged across days. Thus, either those with relatively high levels of positive affect across days are also relatively stable in their affect, or the result is an indication of a ceiling effect in the measurement. Finally, from the second of the two models, the estimated mean positive affect score across days and participants isβ 0 = 3.00 (se = 0.006), indicating a rather high average across days and participants.

Daily Stressors
Extensive research has demonstrated a clear relationship between negative affect and daily stress, but positive reactivity to daily stress is not as well understood. Several studies report mixed findings in terms of the direction of the relationship, suggesting that the Table 1. ML Estimates of a mixed-effects location scale model of manifest measures of daily mean positive affect (n = 435).
Notes: a ML estimation carried out using SAS PROC NLMIXED with a Laplacian approximation to the integral. b ML estimation carried out using SAS PROC NLMIXED with nonadaptive Gaussian quadrature with 7 quadrature points relationship is complex and highly individualistic (Schilling and Diehl 2014). Here, the mixedeffects location scale model is extended to include the number of daily stressors reported for each interview day, denoted by daily stressors ti . Scores were based on a sum of responses to 7 questions scored as 1=yes and 0=no; the first in the set of questions, for instance, was "Did you have an argument or disagreement with anyone since (this time/we spoke) yesterday?" The possible minimum and maximum scores were 0 and 7, respectively. Given repeated measures of the number of stressors, both the within-and between-subject effects of daily stressors on daily mean positive affect scores were studied. To do this, the variable was centered about the individual's mean number of stressors across days: DS * ti = daily stressors ti − DS .i ), where DS * ti denotes an individual's daily stress count centered about their mean count across days, with the latter denoted by DS .i . Daily stressor counts for the sample ranged from 0 to 5; individual-level mean counts ranged from 0 to 2.38, with an overall mean of 0.53 and standard deviation of 0.42. The person-mean centered and mean values of the daily stressor measures were included in the model to predict the observed daily mean positive affect score: To evaluate the effect of daily stressors on the variation of positive affect scores within and across days, after adjusting for the within-and between-person effects of daily stressors, both measures of daily stressors were included in the model of the occasion-level residual variance: Thus, this model was used to evaluate whether higher daily counts of stressors or an overall high level of stressors across days was related to the daily variation in mean positive affect scores across days. The variance of the random intercept was also evaluated for between-subject heterogeneity by including the mean daily stressor count in the model of the random intercept variance: Starting values for the effects of covariates were set to 0, and the remaining parameters were set equal to the values obtained from fitting the unconditional model described in the previous section. The model was fit using SAS PROC NLMIXED version 9.4 using nonadaptive Gaussian quadrature with 7 quadrature points. Estimates of the conditional model, referred to as Model A 3 , are in the last column of Table 1. The mean positive affect score for those with no daily stressors is estimated to be 3.05 (se = .012), a value that is slightly greater than that obtained under Model A 2 . The estimates further suggest an overall negative within-person effect (β 1 = −0.075, se = 0.012), as well as a negative between-person effect (β 2 = −0.36, se = 0.030), of the number of daily stressors on daily mean positive affect, with the magnitude of the between-person effect being nearly five times the size of the within-person effect (H 0 : The within-person effect indicates that, on average, a higher number of daily stressors correspond to a relatively low daily mean positive affect score, and the between-person effect indicates that a higher mean number of daily stressors corresponds to a relatively low daily mean positive affect score. Conditional on these effects, greater daily variation in affect scores corresponds to a higher number of daily stressors (τ 1 = 0.30, se = 0.049), as well as a higher mean number of daily stressors (τ 2 = 0.78, se = 0.15), with the latter of the two effects being the largest (H 0 : τ 1 = τ 2 , χ 2 (1df) = 7.5, p = .006). Additionally, the variance of the random intercept is positively related to the mean number of daily stressors (α 1 = 0.36, se = 0.070), such that the between-subject variation in mean positive affect scores increases with an increase in the mean number of daily stressors. That is, individuals increasingly differ from each other with an increase in the mean number of daily stressors. Overall, it seems that between-subject differences, relative to withinsubject variation, in the number of stressors relates most strongly to the different aspects of daily positive affect.

The Latent Variable Mixed-Effects Location Scale Model
The mixed-effects location scale model is a two-level model for observations nested within individuals (Hedeker et al. 2008). The responses are assumed to be free of measurement error. To address measurement error, a second-order model is developed here. In a second-order version of the model, the repeated measure is a latent variable. That is, at each occasion, a set of manifest variables is assumed to reflect a latent variable that varies by time and person. The subjectspecific model is then applied to the repeated measures of the latent variable. Let y ti be a set of m ti indicators of the latent variable η ti observed at occasion t for individual i. Across T i occasions, let y i = y 1i , . . . , y T i and M i denote the number of observations in y i across indicators and occasions. It is not necessary that each measurement occasion have the same set of indicator variables to represent the latent variable, as long as all share a common indicator that anchors the latent variable over time (Bollen and Curran 2006), and data across occasions need not be complete. Missing data are assumed to be missing at random. A longitudinal measurement model for y i is where τ i is an M i x 1 intercept vector, i (λ) is an M i x Q matrix of factor loadings, η i is a Q x 1 latent variable vector observed according to T i , and δ i is an M i x 1 unique item factor vector. The subscript i used for both τ i and i indicates that both may vary by i with regard to their dimensions but not otherwise, whereas both the values and dimensions of η i and δ i may vary by i. The latent variable η ti is assumed to follow a mixed-effects location scale model: where x ti is a p x 1 vector of within-person covariates that would usually include a "1" for the intercept of the model, and w i is a q x 1 vector of between-subject covariates. The coefficient β x contains p fixed coefficients linking x ti to η ti ; υ i is a set of p * ≤ p random subject effects that correspond to one or more of the fixed effects in β x . The coefficient β w contains q fixed coefficients linking w i to η ti . The random effect υ i is assumed to be independent and normally distributed across individuals as where υ is a function of w i , α = α 0 , . . . , α q , and ρ υ = (ρ 1 , . . .). The residual ε i , specific to the individual with elements specific to the occasions, is assumed to be normally distributed: where ε is a function of x ti , w i , τ , and a i , with τ = (τ x , τ w ) similar to (4) in which the coefficients are the effects of within-and between-subject covariates, respectively. Assuming the residuals are independent between occasions, then ε = σ 2 ε I n i , where σ 2 ti is a function of x ti and w i with random effect a i , and where a i is assumed to be normally distributed: a i ∼ N 0, φ 2 a . Thus, the model for the observed response y i is where i (x ti , w i ) is a design matrix containing the within-and between-subject covariates, and β i = (β x + υ i ) , β w is a stacked set of coefficients linking the within-and between-subject covariates, respectively, to y i . The residual δ i is assumed to be normally distributed: where i is a diagonal covariance matrix of the unique item factors. Similar to the model for manifest variables, the random effect vector υ i of (18) and the random effect a i in (19) may covary. To allow this, υ i and a i are stacked in a vector defined by c i (r x1) = υ i , a i that includes all r = p * + 1 random effects. The joint distribution of c i is assumed to be where the mean vector and covariance matrix are and respectively. Corresponding to this, the probability distribution of c i is Conditional on the random effects in c i , the distribution of y i is where and The conditional probability density function is defined as The marginal distribution of y i is then The parameters of the model are γ = β, α, ρ υ , τ, φ υ , φ υa , φ 2 a , ψ . Given a sample of observations, y 1 , . . . , y N , the marginal log-likelihood of γ is Due to the random effect a i , the model for y i is nonlinear in one of the random effects, and consequently, the integral in (30) does not have a closed-form expression. Steps taken to estimate the integral are described in the next section.

Simplifying the Likelihood Function
The latent variable mixed-effects location scale model is more complicated than the version of the model for manifest variables. This is due to the measurement model needed for the set of response variables at multiple occasions, in addition to the random effects (one of which enters the model in a nonlinear manner) that are used in the model for the repeated measures of the latent variable. Interestingly, it is possible to simplify the calculation of the i th individual's contribution to the likelihood function by analytically eliminating the random effect υ i from the marginal distribution in (30). This can also be done for the marginal distribution in (14) based on the model for manifest variables (see Appendix A). Based on the fact that, conditional on a i , the model is linear in υ i , only the conditional distribution given a i is needed (cf: du Toit and Cudeck 2009). Because the random effects contained in c i are jointly normally distributed, the conditional distribution of υ i given a i is also normal, with mean vector and covariance matrix (Morrison 1990, 3rd ed., p. 92) and respectively. It follows that the distribution of y i conditional on a i is normal: and Assuming independence between the residuals relating to the latent variable between occasions, The probability density function of y i given a i is The marginal distribution of y i given a i is then thus requiring a one-dimensional integral. The log-likelihood function is then where γ = β, α, ρ υ , τ, φ υ , φ υa , φ 2 a , ψ . Again, as the model for y i is nonlinear in a i , the integral in (40) does not have a closed-form expression, and so estimation relies on an approximation. In the empirical example presented in the next section, Gauss-Hermite quadrature is used to evaluate the integral. A computer program, such as one written with SAS IML, may be used to carry out estimation.

Example: Daily Latent Positive Affect
One shortcoming of the previous analysis of the daily mean positive affect scores was the fact that the measurement error of the manifest variables was not addressed. Here, a latent variable mixedeffects location scale model is applied to the item-level response data. Measurement invariance is generally required for a meaningful interpretation of a latent variable that is studied over repeated occasions because it is necessary that an instrument perform in the same manner regardless of the measurement occasion (Chan, 1998;Meredith 1993;Millsap 2011). Assuming a single dimension for the set of item responses, measurement invariance across the 8 days was evaluated. First, equality of factor loadings was tested, followed by similar tests about the item intercepts and then the uniqueness. Relative to a model without restrictions placed on the factor loadings, item intercepts or uniquenesses (Deviance = 31,009, BIC = 32,759), LRTs suggested equal factor loadings by item across days (χ 2 (28d f ) = 35.4, p = .16; Deviance = 31,045, BIC = 32,625), equal item intercepts by item across days (with the exception of item 4 on day 8) (χ 2 (27d f ) = 36.8, p = .10, Deviance = 31,046, BIC = 32,632), and both equal factor loadings and item intercepts by item across days (with the exception of allowing for unique intercepts for item 10 on days 1 and 8 and item 11 day 8) (χ 2 (53d f ) = 62.47, p = .18, Deviance = 31,072, BIC = 32,500). Although the BIC was lowest for a model that additionally constrained the uniquenesses to be equal by item and across days (Deviance = 31,226, BIC = 32,441), a LRT did not support this (χ 2 (35d f ) = 154.03, p < .001). The analysis proceeded assuming equal uniquenesses, along with equal factor loadings and item intercepts, by item across days, with the results evaluated for the tenability of this assumption.
A latent variable model based on the daily responses to the 5-item set assumed that the intercept of the first item equation was equal to 0 and that the factor loading was equal to 1: Elements of the unique factor score vector δ i = (δ 11i , . . . , δ 58i ) were assumed to be independently and normally distributed across individuals as δ i ∼ N (0, ), with scores assumed to be independent between days with constant variance across days. Let τ = (0, τ 2 , τ 3 , τ 4 , τ 5 ) , λ = (1, λ 2 , λ 3 , λ 4 , λ 5 ), and ψ = (ψ 1 , ψ 2 , ψ 3 , ψ 4 , ψ 5 ), where ψ is the vector of the unique factor score variances relating to the five scale items. To then fit a latent variable mixed-effects location scale model, the latent measure of positive affect was assumed to follow a mixed-effects location scale model. Similar to the daily scores based on averages of the item responses, the latent measure of daily positive affect was expected to fluctuate across days at the individual level and so was assumed to follow a random intercept model: where, for participant i, β 0i is the latent measure of positive affect on day t, and ε ti is the discrepancy between the latent score and the fitted value on day t. The random intercept is assumed to be normally distributed: where β 0 is the expected latent response across days, and φ 2 υ = exp {α 0 } . At the occasion level, the residual is assumed to be normally distributed: where σ 2 ε = exp {τ 0 + a i } ,and a i is a random subject effect that is assumed to be normally distributed: At the subject level, the random intercept and the random effect of the within-subject residual variance may covary: φ υa = cov (υ i , a i ). The model, henceforth referred to as Model B 2 , has five parameters of central interest, along with the parameters relating to the measurement model of y: γ = τ, λ, ψ, β 0 , α 0 , τ 0 , φ 2 a , φ υa . Code developed for use with SAS IML for estimation of the model is provided in Appendix B.
ML estimates of Model B 2 are given in Table 2. The values presented in the table are based on an analysis carried out using a trust-region optimization method (Moré and Sorensen 1983) available through SAS IML and used to optimize the likelihood function. The solution was evaluated using quadrature points that ranged from 5 to 30 with increments of 5 points, resulting in no appreciable differences in the parameter estimates or standard errors when using the different number of quadrature points. The estimates provided in Table 2 are based 10 quadrature points. To obtain starting values for estimation, results from the factor analysis model supplied values for the measurement model. A fixed-effects model was then fit, followed by adding a random intercept, then a random effect in the within-subject residual variance model with its covariance with the random intercept. To assess whether there was appreciable heterogeneity of variance in the occasion-level residuals, estimates were obtained for a model (Model B 1 ) that assumed φ 2 a = 0 and compared to those under the model that assumed φ 2 a > 0 (Model B 2 ). The model assuming φ 2 a > 0 results in an improvement in model fit in terms of the AIC, from 33,710 down to 33,070, suggesting heterogeneity of the within-person residual variance. A LRT of the goodness-of-fit between the two models using 2 df is χ 2 2 = 33, 678 − 33, 034 = 644, p < .001, supporting the need for the random effect in the residual variance model. As noted earlier, the assumption that the uniquenesses for each item were equal across the days of measurement was not tenable according to a LRT. Thus, Model B 2 was fit relaxing the assumption that the uniquenesses were equal, with this model henceforth called Model B 3 . Estimates from this model are given in Table  2 (with additional estimates provided in Appendix C). A LRT comparing Model B 2 and Model B 3 supports the need to allow for the unique values. From the estimates based on Model B 3 , the estimated correlation between the random intercept and the random subject effect for the withinsubject residual variance is r = −.43, an increase from r = −.36 in the model that relied on mean scores, but again suggesting a tendency for those with a relatively low daily variation to also have a relatively high mean positive affect score across days. Similar to the analysis that relied on the means of the item response variables, the negative correlation suggests a tendency for those who have a relatively high mean level of positive affect across days to also have a relatively low degree of day-to-day variability. Thus, individuals who had higher estimated averages in affect across days also showed greater stability in their affect across days. Again, two possible conclusions from this are that those with greater overall positive affect are more stable in their daily 1562 PSYCHOMETRIKA Notes: ML estimation was carried out using Gauss-Hermite quadrature with 10 quadrature points to evaluate the integral. a ML estimates are given in Appendix C positive affect or there is a ceiling effect of measurement. Available in supplementary materials are empirical Bayes estimates of the location and scale values based on Model B 3 , along with estimated conditional residuals between the observed item scores and the fitted values based on the ML estimates from fitting Model B 3 .
In the previous analysis that relied on sample mean scores, it was not possible to estimate the state residual variance of positive affect scores without the measurement error naturally inherent in manifest scores. In the latent variable model that accounts for measurement error, the estimated state residual variance, assuming homogeneity of the within-person residual variance of daily latent scores, is exp {−1.93} = 0.15, and the estimated trait variance is exp {−2.41} = 0.090, with the state variance almost double the size of the trait variance. With a relatively high residual state variance, variation in positive affect seems to be due more to daily variability rather than betweenperson differences. Relaxing the assumption of homogeneity of the within-person residual variance, however, gives a different description of the data. First, given the improvement in model fit, it does not seem reasonable to conclude that the residual state variance is common across individuals, but rather, that it varies according to person. The estimated residual state variance for the typical individual is exp τ 0 + .5φ 2 a (Hedeker et al. 2008) = exp −2.56 + .5 (1.32) 2 = 0.18 and the estimated trait variance is exp {−1.21} = 0.30, with the trait variance now being greater than the magnitude of the residual state variance, thus suggesting that, for the typical individual, variation in positive affect scores is more highly attributable to between-person differences than within.
As discussed earlier, applications of a mixed-effects location scale model generally do not account for measurement error in response data. If scores include measurement error, the residuals reflect a combination of within-subject variation both about the fitted model and that due to measurement error. To evaluate the impact of partitioning the variance of the manifest scores as can be done using a latent variable model, a version of Model B 3 was fit in which a single variance was used to represent these combined sources. The factor loadings, item intercepts, factor mean, standard deviation of a i and correlation between a i and υ i were set equal to the estimates resulting from fitting Models B 3 , resulting in an estimated combined common variance of exp {−0.77} = 0.46. From Model B 3 that partitions the variance due to measurement error and variation due to the fitted model, the common variance at the occasion level is estimated as exp {−2.56} = 0.08, a substantial decrease from that in which the two sources of variation are combined.

Daily Stressors
To study the within-and between-subject effects of daily stressors on latent positive affect, the person-mean centered and mean number of daily stressors were included in the latent variable location scale model, similar to what had been done when evaluating positive affect using the manifest scores directly: Additionally, the two measures of daily stressors were included in the model of the occasion-level residual variance relating to the latent affect measures: and the individual mean number of stressors was included in the variance model of the random intercept: φ 2 υ = exp {α 0 + α 1 DS .i } . Starting values for the effects of covariates were set to 0. Estimates of this model are in the last column of Table 2. For those with no reported daily stressors, the point estimate of the overall positive affect score across days and individuals isβ 0 = 3.20 (se = 0.13), a value that is higher than the point estimate of 3.05 obtained from the model that relied on the mean of the manifest variables. For daily positive affect, the estimates suggest an overall negative withinperson (β 1 = −0.10, se = 0.011), as well as between-person (β 2 = −0.38, se = 0.060), effect of the number of daily stressors on daily mean positive affect. Thus, on average, the withinperson effect indicates that a higher number of daily stressors tends to correspond to a lower daily positive affect level, and the between-person effect indicates that a higher mean number of daily stressors across days tends to correspond to a lower daily mean positive affect, with the latter being greater than the former (H 0 : β 1 = β 2 , χ 2 (1df) = 22, p < .001). In the previous analysis based on sample mean scores to represent positive affect, the relative magnitudes of these two effects were somewhat different relative to the estimates from the latent variable model, but inference from both models in terms of the direction of the effects is the same with the between-subject differences in the number of daily stressors having the greater impact on positive affect. Conditional on these effects, greater daily variation in affect scores corresponds to a high number of daily stressors (τ 1 = 0.30, se = 0.071), as well as a higher number of mean daily stressors (τ 2 = 0.89, se = 0.17),, with the latter being greater than the former (H 0 : τ 1 = τ 2 , χ 2 (1df) = 9.7, p = .002). These estimates are comparable to those obtained under the model that relied on manifest scores. Also under the latent variable model, the variance of the random intercept does not have a clear relationship with the mean number of daily stressors (α 1 = −0.20, se = 0.17), unlike the result under the standard model where it seemed that individuals differed to a greater extent from each other as their mean number of daily stressors increased. From this, one might conclude that there is no appreciable association between the between-subject variation in positive affect levels and the mean number of stressors under the latent variable model but that the association is instead strong and positive when studied under the standard version of the model. Finally, a comparison of the estimated standard errors of the two models overall indicates that the precision of the estimates is generally better under the model that used the sample means scores.
As the latent variable model is preferred for the sake of accounting for measurement error in the manifest measures, it is possible that the precision of the estimates is negatively biased in the standard version of the model when scores do contain measurement error and are best reflected by those values obtain under the latent variable model.

Discussion
A mixed-effects location scale model extends the more common applications of latent curve and mixed-effects models to uniquely address heterogeneity of variance both in the random effects at the second level and the within-subject residuals. Some advancements of this framework have included extensions to bivariate versions of the model to study multiple longitudinal variables, including dyad data involving distinguishable individuals (Pugach et al. 2014), a 3-level model (Lin et al. 2018), and joint models to handle combinations of response distributions (Lu 2017). Most applications have relied on ML estimation, but Bayesian estimation of these models is an alternative (Lin et al.). One benefit of fitting a mixed-effects model that includes a model for the variance of a random effect is that the variance can be a function of between-subject covariates. Recalling the example presented in this paper, the variance of the random intercept reflected the magnitude of individual differences in the expected value of positive affect across multiple days. Using a mixed-effects location scale model that was applied to sample mean scores, the variance of the random intercept was studied as a function of the mean number of daily stressors reported by study participants. Based on the model, the between-subject variability in mean positive affect levels increased with an increase in the daily mean number of stressors. Although not considered here, it would also be possible to allow the variance of a random subject effect to also vary according to occasion-specific covariates. Similarly, the assumption of homogeneity of the residual variances may be relaxed by allowing both within-and between-subject covariates to account for variation in the occasion-specific residual variance. Additionally, a random effect may be included in the model to allow for heterogeneity of the occasion-level residuals, even after adjusting for the effects of covariates. 1 Access to SAS software is available for free to academics (https://www.sas.com/en_us/software/on-demand-for-academics.html).
Applications of a mixed-effects location scale model often involve psychological response data, although the standard application of the model assumes that the response variable is measured without error. This paper aimed to extend the mixed-effects location scale model by specifying a measurement model for repeated measures of a set of indicator variables assumed to reflect an underlying construct. Thus, this approach permits evaluation of the assumption of measurement invariance, and if needed, adjustments to the latent variable mixed-effects location scale model may be made if needed. In the empirical example provided, for instance, the assumption of equality of the item uniquenesses across days was not defensible, and so the model took this into account. Thus, the model developed in this paper included important aspects of a mixed-effects location scale model while addressing measurement error that is inherent to many psychological variables. Thus, a clear benefit to using the latent variable version of the model is that the occasion-level residuals relate to the latent variable, and as such, reflect true within-subject variation.
From the empirical examples provided in this paper, there were appreciable differences between the results from the standard application of the model and those from the latent variable version of the model, with the greatest impact falling on the estimated covariance structure of the model. That is, the differences in the estimates based on the fixed-effects part of the model were only slightly different between models. With regard to the covariance structure, the differences were far more appreciable in terms of the magnitude of covariate effects, and this lead to differences about whether within-subject versus between-subject effects were most important. To better understand important differences between the two versions of the model requires a data simulation study. This would also allow for an examination of other factors, such as the number of repeated measures and the number of study participants needed, for reliable estimation of these models and to understand the biases that may come from either version of the model. Finally, although the empirical examples relied on cases that were complete with respect to the variables chosen for analysis, the model developed in this paper does not require complete data. Missing data are common in longitudinal investigations, and understanding the impact of missing data on the estimation of mixed-effects location scale models is worthy of further study.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
Publisher's Note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Appendix A Under a mixed-effects location scale model, the marginal distribution of the repeated measures can be expressed as a conditional distribution of the response given the nonlinear random effect a i in (3) (cf: du Toit and Cudeck 2009), and thus, the conditional distribution requires an integral equation of only one dimension. First, because the random effects (υ i , a i ) are jointly normally distributed, the conditional distribution of υ i given a i is also normal: with mean vector and covariance matrix (Morrison 1990, 3rd ed., p. 92) μ υ.a = β + φ υa φ 2 a a i , and υ.a = υ (w i , α, ρ υ ) − υa (φ 2 a ) −1 υa , 1566 PSYCHOMETRIKA respectively. It follows that the distribution of y i given a i is normal: with μ y.a = i (x ti , w i ) μ υ.a and y.a = i (x ti , w i ) υ.a (x ti , w i ) + a ε .
Assuming independence of the residuals between occasions, the within-subject variance is modeled by a ε = I exp {θ 0 + τ x x ti + τ w w i + a i } .
Conditional on a i , the model in (1) with a random effect included in the within-subject variance model in (3) is linear in ν i . Consequently, it is possible to analytically eliminate ν i from the marginal distribution in (4), and as a result, the calculation is simplified. The conditional distribution of y i given a i is where μ i = (x ti , w i ) β and i = (x ti , w i ) υ (w i , α, ρ υ ) (x ti , w i ) + ε (x ti , w i , τ ) .
The corresponding probability density function is The marginal distribution of y i is then Thus, the marginal distribution of y i that is an r dimensional integral has been reduced to a single dimensional integral. Given a sample of observations, y 1 , . . . , y N , the log-likelihood of γ is then ln g (y i ) .