[R-sig-ME] nlme: The meaning of residual variance when using a variance structure

Phillip Alday ph||||p@@|d@y @end|ng |rom mp|@n|
Fri Nov 6 19:37:24 CET 2020



On 6/11/20 6:31 pm, Simon Harmel wrote:
> Thanks. You mentioned "varFixed() sets the variance as being the mean",
> mean of what? 
> 

It's proportional to x, as it says the documentation I linked to.

Recall that for linear regression, we're solving for the conditional
mean. For example, we can write a simple model in terms of the
distribution of the error

y_i = beta_0 + beta_1 * x_i + error_i

error_i ~ N(0, sigma)

or we can write in terms of the conditional distribution of the observed
values (note that the linear predictor mu gives the mean of the observed
values conditional on the predictors)

mu_i = beta_0  beta_0 + beta_1 * x_i

y_i ~ N(mu_i, sigma)

(see e.g.
http://sumsar.net/blog/2013/10/how-do-you-write-your-model-definitions/)

For those other variance structures: consult the documentation. What do
you think they mean? If you have questions about what particular
statements in the documentation mean, you can ask those, but I'm
hesitant to go look up the documentation for you.

Phillip

> On the other hand, you mentioned "sigma(model)^2 [residual variance] is
> the constant of proportionality for going from a particular observation
> to the (residual) variance at that observation". 
> 
> How does your definition for  "sigma(model)^2"  change for the following
> variance structures?
> 
> (1) varPower(form= ~x)   ;   (2) varExp(form= ~x) 
>  ;   (3) varConstPower(form= ~x) 
> 
> Thank you very much,
> Simon
> 
> 
> 
> On Fri, Nov 6, 2020 at 6:24 AM Phillip Alday <phillip.alday using mpi.nl
> <mailto:phillip.alday using mpi.nl>> wrote:
> 
>     Looking at varFix alone, it looks like the variance is proportional to
>     the mean.
> 
>     Looking at the documentation for varFixed (e.g.
>     https://www.rdocumentation.org/packages/nlme/versions/3.1-150/topics/varFixed),
>     varFixed sets the variance as being the mean. Looking at the
>     documentation for lme
>     (https://www.rdocumentation.org/packages/nlme/versions/3.1-150/topics/lme),
>     the weights describe the "within-group heteroskedacity structure", which
>     here basically means the observation-level variation after the grouping
>     has been taken into account.
> 
>     So then sigma(model)^2 is the constant of proportionality for going from
>     a particular observation to the (residual) variance at that observation.
>     Note that only 'part' of an observation is relevant in this example: x
>     matters but not month.
> 
>     Also, I'm guessing that you got this example from somewhere (because it
>     uses things beyond your own understanding), so it would be usual
>     practice to give credit to the individual(s) who came up with it.
> 
>     Phillip
> 
>     On 6/11/20 3:44 am, Simon Harmel wrote:
>     > Hello All,
>     >
>     > My understanding is that a varFixed() variance structure in lme()
>     call,
>     > models the residual variance proportional to a numeric variance
>     covariate
>     > (e.g., `x`) such that there would be a linear relation between the
>     two.
>     >
>     > But what is the exact meaning of sigma(fitted_model)^2 alone in a
>     fitted
>     > model that has used  varFixed(~x)  in it?
>     >
>     > Below is a fully reproducible example.
>     >
>     > library(nlme)
>     >
>     > dat <- read.csv('
>     > https://raw.githubusercontent.com/rnorouzian/e/master/var.csv')
>     > dat$month <- factor(dat$month)
>     >
>     > m2 <- lme(y ~ x * month, random = ~1|id, weights = varFixed(~x),
>     data = dat)
>     >
>     > varFix <- function(x) sigma(m2)^2*x  ## What is the meaning of 
>     "sigma(m2)^2"
>     > here?
>     >
>     > with(dat, curve(varFix(x), min(x), max(x), lwd = 2))
>     >
>     >       [[alternative HTML version deleted]]
>     >
>     > _______________________________________________
>     > R-sig-mixed-models using r-project.org
>     <mailto:R-sig-mixed-models using r-project.org> mailing list
>     > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>     >
>



More information about the R-sig-mixed-models mailing list