[R] PROC MIXED RANDOM equivalence in R nlme

Dennis F. Kahlbaum kbomb at umich.edu
Thu Aug 10 15:34:48 CEST 2017


I am trying to reproduce some old SAS PROC MIXED code using R and nlme. 
The data consists of emission readings from vehicles and fuel 
properties. All variables are real numbers except "study" and "vehicle", 
which are character. Unfortunately, since the data are confidential, I'm 
unable to provide an example.

The original SAS v6.12 code is provided below:

------------------------------------------------------------------
/* READ DATA */
DATA emiss;
    INFILE 'data.tab' LRECL=8000 FIRSTOBS=2 DLM='09'X MISSOVER DSD;
    INPUT study $ vehicle $ thc rv t5 t9 ar ol ox su bz;

/* CREATE NEW VARIABLES */
ln_thc = log (thc);
new    = study||vehicle;

/* PERFORM ANALYSIS */
PROC MIXED DATA=emiss MAXITER=1000 CONVH=1E-8 METHOD=REML NOCLPRINT 
NOITPRINT;
CLASS new;

MODEL ln_thc = rv t5 t9 ar ol ox su bz
                 /S DDFM=RES;

RANDOM         int rv t5 t9 ar ol ox su bz
                /SUB=new;
RUN;
------------------------------------------------------------------

The R code I've devised for the PROC MIXED statement is shown below:

------------------------------------------------------------------
FitTHC <- LME(ln_thc ~ rv + t5 + t9 + ar + ol + ox + su + bz,
           DATA = emiss,
           RANDOM = ??????? )
------------------------------------------------------------------

As indicated, the problem I'm having is in constructing the equivalent 
code for the RANDOM and any remaining settings. I've tried

RANDOM = ~1 + rv + t5 + t9 + ar + ol + ox + su + bz | new)

but R hangs and never produces a result. Therefore, what is the 
equivalent code for the SAS RANDOM?

Thanks!



More information about the R-help mailing list