Hi, Suppose I have a multivariate response Y (n x k) obtained at a set of predictors X (n x p). I would like to perform a linear regression taking into consideration the covariance structure of Y within each unit - this would be represented by a specified matrix V (k x k), assumed to be the same across units. How do I use "lm" to do this? One approach that I was thinking of is as follows: Flatten Y to a vector, say, Yvec (n*k x 1). Create Xvec (n*k, p*k) such that it is made up of block matrices Bij (k x k), where Bij is a diagonal matrix with X_ij as the diagonal (i = 1,.n, and j = 1,.,p). Now I can use "lm" in a univariate mode to regress Yvec against Xvec, with covariance matrix Vvec (n*k x n*k). Vvec is a block-diagonal matrix with blocks of V along the diagonal. This seems like a valid approach, but I still don't know how to specify the covariance structure to do weighted least squares. Any help is appreciated. Best, Ravi. ---------------------------------------------------------------------------- ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: rvaradhan@jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html ---------------------------------------------------------------------------- -------- [[alternative HTML version deleted]]
You can use gee ( http://finzi.psych.upenn.edu/R/library/geepack/html/00Index.html) or maybe the function gls in nlme. Ritwik. On 10/27/06, Ravi Varadhan <rvaradhan@jhmi.edu> wrote:> > Hi, > > > > Suppose I have a multivariate response Y (n x k) obtained at a set of > predictors X (n x p). I would like to perform a linear regression taking > into consideration the covariance structure of Y within each unit - this > would be represented by a specified matrix V (k x k), assumed to be the > same > across units. How do I use "lm" to do this? > > > > One approach that I was thinking of is as follows: > > > > Flatten Y to a vector, say, Yvec (n*k x 1). Create Xvec (n*k, p*k) such > that it is made up of block matrices Bij (k x k), where Bij is a diagonal > matrix with X_ij as the diagonal (i = 1,.n, and j = 1,.,p). Now I can use > "lm" in a univariate mode to regress Yvec against Xvec, with covariance > matrix Vvec (n*k x n*k). Vvec is a block-diagonal matrix with blocks of V > along the diagonal. This seems like a valid approach, but I still don't > know how to specify the covariance structure to do weighted least squares. > > > > Any help is appreciated. > > > > Best, > > Ravi. > > > > > ---------------------------------------------------------------------------- > ------- > > Ravi Varadhan, Ph.D. > > Assistant Professor, The Center on Aging and Health > > Division of Geriatric Medicine and Gerontology > > Johns Hopkins University > > Ph: (410) 502-2619 > > Fax: (410) 614-9625 > > Email: rvaradhan@jhmi.edu > > Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html > > > > > ---------------------------------------------------------------------------- > -------- > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Ritwik Sinha Graduate Student Epidemiology and Biostatistics Case Western Reserve University ritwik.sinha@gmail.com | +12163682366 | http://darwin.cwru.edu/~rsinha [[alternative HTML version deleted]]
Hello Ravi, have you considered the SUR method proposed by Zellner? An implementation of it is provided in CRAN-package 'systemfit' (see ?systemfit for more information). Best, Bernhard> >Suppose I have a multivariate response Y (n x k) obtained at a set of >predictors X (n x p). I would like to perform a linear >regression taking >into consideration the covariance structure of Y within each >unit - this >would be represented by a specified matrix V (k x k), assumed >to be the same >across units. How do I use "lm" to do this? > > > >One approach that I was thinking of is as follows: > > > >Flatten Y to a vector, say, Yvec (n*k x 1). Create Xvec (n*k, >p*k) such >that it is made up of block matrices Bij (k x k), where Bij is >a diagonal >matrix with X_ij as the diagonal (i = 1,.n, and j = 1,.,p). >Now I can use >"lm" in a univariate mode to regress Yvec against Xvec, with covariance >matrix Vvec (n*k x n*k). Vvec is a block-diagonal matrix with >blocks of V >along the diagonal. This seems like a valid approach, but I >still don't >know how to specify the covariance structure to do weighted >least squares. > > > >Any help is appreciated. > > > >Best, > >Ravi. > > > >--------------------------------------------------------------- >------------- >------- > >Ravi Varadhan, Ph.D. > >Assistant Professor, The Center on Aging and Health > >Division of Geriatric Medicine and Gerontology > >Johns Hopkins University > >Ph: (410) 502-2619 > >Fax: (410) 614-9625 > >Email: rvaradhan at jhmi.edu > >Webpage: >http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html > > > >--------------------------------------------------------------- >------------- >-------- > > > > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code. >***************************************************************** Confidentiality Note: The information contained in this mess...{{dropped}}
Apparently Analagous Threads
- easy way to do a 2-D fit to an array of data?
- Lattice 3d coordinate transformation
- how to do interpolation
- -lgsl -lgslcblas fatal error no such file or directory
- R CMD -lgsl -lgslcblas *.c returns a fatal error: gsl/gsl_rng.h no such file or directory exists