Sunday, 15 January 2012

r - Weighting the inverse of the variance in linear mixed model -



r - Weighting the inverse of the variance in linear mixed model -

i have linear mixed model run 50 different times in loop.

each time model run, want response variable b weighted inversely variance. if variance of b small, want weighting bigger , vice versa. simplified version of model:

model <- lme(b ~ type, random = ~1|replicate,weights = ~ i(1/b))

here's r info files:

b: https://www.dropbox.com/s/ziipdtsih5f0252/b.rdata?dl=0

type: https://www.dropbox.com/s/90682ewib1lw06e/type.rdata?dl=0

replicate: https://www.dropbox.com/s/kvrtao5i2g4v3ik/replicate.rdata?dl=0

i'm trying using weights alternative in lme. right have as:

weights = ~ i(1/b).

but don't think correct....maybe weights = ~ i(1/var(b)) ??

i want adjust b consists of 2 types of info specified in factor variable (of 2 levels) type.

i want inversely weight variance of each of these 2 levels separately. how this?

i'm not sure makes sense talk weighting response variable in manner. descriptions have found in r-sig-mixed-models mailing list refer using inverse weighting derived predictor variables, either fixed effects or random effects. weighting used in minimizing deviations of approximation of model fits response. there function returns fixed effects variance (a sub-class of varfunc family of functions) , has help page (linked weights section of ?gls page):

?varfixed ?varfunc

it requires formula object argument. original guess was:

model <- lme(b ~ type, random = ~1|replicate, weights = varfixed( ~type) )

which proved incorrect. how seeing if works:

model <- lme(b ~ type, random = ~1|replicate, weights = varfixed( ~1| type) )

(my continuing guess weighting default situation , specifying these particular weights may not needed. inverse nature of weighting implied , not need explicitly stated "1/type". in case of mixed models "correct" construction depends on design , prior science , none of has been presented, syntactic comment , not endorsement of model. did not download files. seems rather odd have 3 separate files , no code linking them dataframe. 1 want have single info object within column names used in formulas of regression function. (i suspect default behavior of function , untested prediction that getting no alter omitting 'weights' parameter.)

r

No comments:

Post a Comment