I am going to use a structural weight like varIndent(from = ~1 |Sex)
and a custom made vector of weights called w in lme
function in R. So I am wondering if anybody knows how to combine the weights in the function. This is an example (just made for this question)
n=25
data=data.frame(
y = rnorm(n),
Sex = as.factor(sample(c('Male','Female','Female'),size = n,replace = TRUE)),
Age = as.factor(sample(c('1-1-2013','10-3-2013','1-5-2013'),size = n,replace = TRUE)),
Area= as.factor(sample(c('a','b','a'),size = n,replace = TRUE))
)
w = runif(n)
MY_WEIGHT_VECTOR = w/sum(w)
l = lme(
fixed = y ~ Sex + Age,
data = data,
random = ~ 1 | Area,
weights = varIdent(form = ~1 | Sex)+???MY_WEIGHT_VECTOR
)