Eva Germovsek
2016-Jul-15 18:21 UTC
[R] Including correlation between weights in multivariate regression
Dear Rusers, We want to fit a multivariable normal distribution to multiple observation variables, where these are observed with uncertainty represented by a covariance matrix which is different for each individual. An example dataset (simplified) might look like this: set.seed(101010) nobs=20 test.data <- data.frame(ID=1:nobs, y1=rnorm(n=nobs, mean=0, sd=0.15), y2=rnorm(n=nobs, mean=0.15, sd=0.20), var11=abs(rnorm(n=nobs, mean=0.1, sd=0.0011)), cov12=rnorm(n=nobs, mean=0.001, sd=0.0001), var22=abs(rnorm(n=nobs, mean=0.1, sd=0.0012))) Where varX are the uncertainties of the observations (in variance units), and cov is covariance between the variance for the first and the second column (i.e. dependent variable). One can do something like this, using lm, if we include only a single weight: lm(cbind(y1, y2) ~ 1, data = test.data, weights = 1/test.data$var11) But we would like to include different weights for each of the dependent variables, and also correlation between the weights. Additionally, we may have up to ~30 observation variables (y1 through y30). Does anyone have any experience with this, or know a package that can do that? Many thanks. Best wishes, Eva Eva Germovsek, PhD Pharmacometrics Research Group Department of Pharmaceutical Biosciences Uppsala University P.O. Box 591 751 24 Uppsala Sweden [[alternative HTML version deleted]]