[R-sig-ME] FW: Estimating an "unbalanced" SUR with gls

Lehner, Stephan stephan.lehner at wu.ac.at
Wed Mar 28 17:09:18 CEST 2018


Dear Sir or Madam!

I was asked to forward my message to this mailing list (see below). For replication purposes I can share the dataset, if needed.

All the best,
Stephan Lehner

From: Douglas Bates <bates at stat.wisc.edu>
Sent: Dienstag, 27. März 2018 17:36
To: Lehner, Stephan <stephan.lehner at wu.ac.at>
Cc: Peer, Stefanie <stefanie.peer at wu.ac.at>
Subject: Re: Estimating an "unbalanced" SUR with gls

It is best to send questions like this to the R-SIG-Mixed-Models at R-project.org<mailto:R-SIG-Mixed-Models at R-project.org> mailing list. See https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models for details.

On Tue, Mar 27, 2018 at 6:44 AM Lehner, Stephan <stephan.lehner at wu.ac.at<mailto:stephan.lehner at wu.ac.at>> wrote:
Dear Prof. Bates,

I am writing you concerning some issues, I have with the correlation option in gls. For a meta-analysis about parking prices, I am trying to estimate an “unbalanced” SUR model using the gls function in R.  I estimated the SUR-model with Stata using the following approach: http://ageconsearch.umn.edu/bitstream/116272/2/sjart_st0079.pdf.

I tried the same with R using the following code lines. The data is the same. This means that the data is already “prepaired” i. e.  (just the fifth step “Fitting the SUR model” is different) .
---
id … the time covariate
id2 … the group covariate
---
Code in R:
cs1CompSymm <- corSymm(form = ~ id | id2)
cs1CompSymm <- Initialize(cs1CompSymm, data = MySUR)
gls_meta.fit.mC1 <- gls(elasticity ~ 0 + consO + consD + consQ + … , data = MySUR, method="REML", correlation=cs1CompSymm)
---
Code in Stata:
tsset  id2 id
xtgee  elasticity conso consd consq …, family(gaussian) link(identity) corr(unstructured) noconstant
xtcorr

Problem 1:
The estimated correlation matrix within-id2 in R is completely different to the correlation matrix in Stata. Hence, I am asking myself if the two methods are comparable or if I am missing something.

Stata:
Estimated within-id2 correlation matrix R:

         c1       c2       c3
r1   1.0000
r2   0.4941   1.0000
r3  -0.0289  -0.1557   1.0000

R:
Correlation Structure: General
Formula: ~id | id2
 Parameter estimate(s):
Correlation:
                1              2
2             0.647
3             0.655     0.066

Problem 2:
The results in R change, whether I am using id2 (an integer variable) or id22 (a String variable). Id22 is the integer variable plus a prefix “ID:”.
cs1CompSymm <- corSymm(form = ~ id | id2)
cs1CompSymm <- corSymm(form = ~ id | id22)

My data is highly unbalanced (just 8 out of 199 observations have a complete group). If is of any help, I am happy to share my dataset with you. I can also send you more information If needed.

Sincerely,

Stephan Lehner, MSc
Research Assistant | PhD candidate
Department for Multi-Level Governance and Development
Vienna University of Economics and Business
Welthandelsplatz 1, D4, Room 2.216
1020 Vienna

+43-1-313 36-5938<tel:+43%201%20313365938>
www.wu.ac.at/mlgd/staff/lehner-stephan-msc/<http://www.wu.ac.at/mlgd/staff/lehner-stephan-msc/>


	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list