[R-sig-ME] random effect latent variable model,

Ren-Huai Huang huangrenhuai at gmail.com
Wed Jan 4 05:57:26 CET 2017


Happy new year,

My question is how to replicate the following sas code in R, Julia or
other open source languages? Thanks in advance!

proc nlmixed data=input tech=dbldog qpoints=30 noad;
        ...
    model   id ~ general(loglik);
    random  latent_var ~ normal(0, 1) subject= id;
       ...
run;

Regards,

Renhuai


On Fri, Dec 30, 2016 at 4:24 PM, Ren-Huai Huang <huangrenhuai at gmail.com>
wrote:

> Re: Random Effect Latent Variable Model
>
>
>
> Dear mixed model members,
>
>
> I am trying to do a weighted latent variable modeling with random effects
> in R, which is similar to sas nlmixed general log likelihood over a random
> effect (sas code attached here
> <https://huangrh.github.io/relvm/vignettes/sascode.html>). The purpose is
> to calculate a latent variable from 7 observed variables x1, x2, … , x7
> with weightings w1, w2, … , w7 to the corresponding likelihood of the
> variables (the dataset is attached here
> <https://github.com/huangrh/relvm/blob/master/inst/extdata/dat244.csv>).
>
>
> Both equations of the weighted log likelihood and the random effect log
> likelihood are linked here
> <https://huangrh.github.io/relvm/vignettes/formula.html> (equations 2 and
> 3). I was wondering if the subjective function should be the joint
> probability of both equations 2 and 3, as shown in equation 4. How to join
> the equation 2 with the random effect?
>
>
> I tried to optimize the function (link to the R code, lines 36-37
> <https://github.com/huangrh/relvm/blob/master/R/nll.R>) using optim in R (link
> to vignette
> <https://huangrh.github.io/relvm/vignettes/Random_Effect_Latent_Variable_Model.html>).
> But the result is very different from the sas nlmixed mentioned above
> <https://huangrh.github.io/relvm/vignettes/sascode.html>.
>
>
> Any suggestions are very welcome to help me to do this right in R. Thank
> you very much in advance.
>
>
>
> Sincerely,
>
> Ren-Huai Huang
>

	[[alternative HTML version deleted]]



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