[R] Bivariate normal regression in R

Viechtbauer Wolfgang (STAT) wolfgang.viechtbauer at maastrichtuniversity.nl
Thu Aug 25 21:36:23 CEST 2011


Another way would be to consider this as a path model and use the sem or lavaan package to fit this model. Here is an example:

x  <- rnorm(1000)
e1 <- rnorm(1000)
e2 <- e1 + rnorm(1000)
e1 <- e1 + rnorm(1000)
y1 <- 2 + 1*x + e1
y2 <- 4 + 2*x + e2

dat <- data.frame(x, y1, y2)

model <- 'y1 ~ x
          y2 ~ x'

fit <- sem(model, data=dat)
summary(fit)

However, note that you could just as well run two separate regressions:

summary(lm(y1 ~ x))
summary(lm(y2 ~ x))

The results are virtually identical. 

Best,

Wolfgang

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of Dimitris Rizopoulos
> Sent: Thursday, August 25, 2011 20:28
> To: DHIMAN BHADRA
> Cc: r-help at r-project.org
> Subject: Re: [R] Bivariate normal regression in R
> 
> One possibility is function gls() from package nlme.
> 
> Best,
> Dimitris
> 
> 
> On 8/25/2011 8:22 PM, DHIMAN BHADRA wrote:
> > Hello everyone,
> >
> > I need to fit a bivariate normal regression model to a dataset where the
> > same covariate (say, X) influences two separate but correlated responses
> > (say, Y1 and Y2). So, the bivariate
> > model would look like :
> >
> > Y1 = a1 + b1*X + e1
> > Y2 = a2 + b2*X + e2
> >
> > where e1 and e2 are error terms which can be correlated. Is there any
> > package in R which can help me fit this model ? Any help will be
> > appreciated.
> >
> > Best regards,
> > Dhiman Bhadra
> >
> > Worcester Polytechnic Institute,
> > 100 Institute Road, Worcester, Ma : 01609.
> >
> > 	[[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org 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.
> >
> 
> --
> Dimitris Rizopoulos
> Assistant Professor
> Department of Biostatistics
> Erasmus University Medical Center
> 
> Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
> Tel: +31/(0)10/7043478
> Fax: +31/(0)10/7043014
> Web: http://www.erasmusmc.nl/biostatistiek/
> 
> ______________________________________________
> R-help at r-project.org 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.



More information about the R-help mailing list