[R] PROC MIXED RANDOM equivalence in R nlme
Dennis F. Kahlbaum
kbomb at umich.edu
Fri Aug 11 16:30:22 CEST 2017
Hi Thierry:
Thank you for your response.
I have been trying to resolve this issue for some time, without success.
That's why I've posted the problem hoping that someone with both SAS and
R experience would be able to help.
As background, this SAS code has been used on many different data sets
in the past. Each data set always consisted of the measured emissions
over a given driving cycle (e.g. grams/mile of THC for the FTP cycle)
versus the fuel properties of: RVP, temperature for 50% evaporation,
temperature for 90% evaporation, aromatics, olefins, sulfur, oxygenate,
and benzene. Each case also has an entry for the vehicle being tested
and the name of the study. Since the input data set can vary, so can the
number of observations and the level counts for the two categorical
variables.
I hope this helps clarify things.
--Dennis
On 8/11/17 8:25 AM, Thierry Onkelinx wrote:
> Dear Dennis,
>
> Your question assumes that people know both SAS PROC MIXED and R nlme.
> Only a limited number of people do. Add the mathematical formulation
> of the model. That will increase the number of people that can help
> you. Adding the number of levels in each categorical variable and the
> number of observation per group is useful too.
>
> Best regards,
>
> ir. Thierry Onkelinx
> Instituut voor natuur- en bosonderzoek / Research Institute for Nature
> and Forest
> team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
> Kliniekstraat 25
> 1070 Anderlecht
> Belgium
>
> To call in the statistician after the experiment is done may be no
> more than asking him to perform a post-mortem examination: he may be
> able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher
> The plural of anecdote is not data. ~ Roger Brinner
> The combination of some data and an aching desire for an answer does
> not ensure that a reasonable answer can be extracted from a given body
> of data. ~ John Tukey
>
> 2017-08-10 15:34 GMT+02:00 Dennis F. Kahlbaum <kbomb at umich.edu
> <mailto:kbomb at umich.edu>>:
>
> 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!
>
> ______________________________________________
> R-help at r-project.org <mailto:R-help at r-project.org> mailing list --
> To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> <https://stat.ethz.ch/mailman/listinfo/r-help>
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> <http://www.R-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list