[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From   "arosella" <>
Subject   st: GLLAMM
Date   Tue, 16 Feb 2010 17:30:11 +0100

 Dear Stata Listers,
I'm trying to fit a GLLAMM to data from a case control study. I'd want to estimate the direct effect of some fixed-covariates (her only gender) as well as random effects of a latent variable (Protective diet) comprised of four observed variables (vitamins intake). Moreover  I'd want to estimate the indirect effect of the covariates via latent variable and an other random effect (non latent variable) on the thr outcome (see STATA code below). I get no error message from stata (that is I suppose that the syntax is right) but there are problems with the convergence (adaptative quadrature): some times stata says me that cannot calculate the LL and some times it take a lot of time until LL become flat. The problem may be of biological origin (no variability) but I don't believe that. Rarely a GLLAMM converges although I'm sure the code i right. Someone has encountered a similar problem fitting GLLAMM?
Thank you in advance.
 //======== beginning of sample code =========
// Data management
rename salud y
// Let the indicators of the performance be perf1 - perf3
gen lvita=  log(vita+0.001)
gen lvitb6= log(vitb6+0.001)
gen lvitc=  log(vitc+0.001)
gen lvite=  log(vite+0.001)
gen resp1 = y
gen resp2 = lvita
gen resp3 = lvitc
gen resp4 = lvitb6
gen resp5=  lvite

// reshape to gllamm
gen i = _n
reshape long resp, i(i) j(j 1-5)
tab j, gen( v )
gen var=1
replace var=2 if j>1
ren v1 caco
ren v2 vit1a
ren v3 vit2b6
ren v4 vit3c
ren v5 vit4e
gen int0=sexo*caco
gen int1=sexo*vit1a
gen int2=sexo*vit2b6
gen int3=sexo*vit3c
gen int4=sexo*vit4e
// measurement equations
eq id1: caco vit1a vit2b6 vit3c vit4e
eq id2: gras

// exogenous variables affecting the latent variables: x1 - x8
*eq r1 : sexo edadcat
// Model
gllamm resp caco vit1a vit2b6 vit3c vit4e int* gras, ///
          nocons i(ident) eq(id1 id2) family(bin gauss) link(logit ident) ///
          nrf(2) lv(var) fv(var) nip(20) trace adapt
======== end of sample code =========

Alberto R. Osella
Laboratorio di Epidemiologia e Biostatistica
IRCCS Saverio de Bellis
Via Turi, 27
70013 Castellana Grotte (BA)
tel: +39 0804994655
fax: +39 0804994650

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index