From: Paul Hutson <*paul.hutson*>

Date: Wed, 28 Feb 2018 19:01:14 +0000

Thanks for the thought exercise, gentlemen.

Paul Hutson, PharmD, BCOP

Professor

UWisc School of Pharmacy

T: 608.263.2496

F: 608.265.5421

From: owner-nmusers omaxnm.com [mailto:owner-nmusers

Sent: Wednesday, February 28, 2018 12:44 PM

To: Leonid Gibiansky <lgibiansky

Cc: nmusers

Subject: Re: [NMusers] NONMEM vs. R for linear mixed-effects

Leonid

With your assistance, I realized the difference between the NONMEM and R approaches — the R approach allows only between-period differences in intercept (not slope) whereas the NONMEM approach that I implemented allowed for between-period differences in both. I removed the ETA for slope from the NONMEM code — the NONMEM results matches R exactly.

Conceptually, a common slope makes sense for this particular analysis.

Problem solved — thanks for your thoughts.

Dennis

Dennis Fisher MD

P < (The "P Less Than" Company)

Phone / Fax: 1-866-PLessThan (1-866-753-7784)

www.PLessThan.com<http://www.plessthan.com/>

On Feb 28, 2018, at 9:59 AM, Leonid Gibiansky <lgibiansky

see "Random slopes" here:

https://web.stanford.edu/class/psych252/section/Mixed_models_tutorial.html

lmer(pitch ~condition+gender+(1 + condition | subject))

On 2/28/2018 12:27 PM, Dennis Fisher wrote:

Leonid

I omitted one critical piece of information:

$INPUT PERIOD=ID

I think that your approach implies an order to the data from different periods — whereas making PERIOD=ID allows NONMEM to see each treatment as a separate subject (i.e., the random effect)

Dennis

Dennis Fisher MD

P < (The "P Less Than" Company)

Phone / Fax: 1-866-PLessThan (1-866-753-7784)

www.PLessThan.com<http://www.PLessThan.com> <http://www.plessthan.com/>

On Feb 28, 2018, at 9:23 AM, Leonid Gibiansky <lgibiansky

Just checking: you have treatment effect in R but no effect in Nonmem, am I correct? (I have not used R nlme for a long time, may be I am interpreting it incorrectly)

Should you code nonmem as

$PRED

INTERCEPT= THETA(1) + THETA(3)*PERIOD + ETA(1)

SLOPE= THETA(2) + THETA(4)*PERIOD + ETA(2)

Y= INTERCEPT + SLOPE * TIME + EPS(1)

Leonid

On 2/28/2018 11:16 AM, Dennis Fisher wrote:

Colleagues

I am implementing a linear mixed-effects model in R.

Out of curiosity (and to confirm that I was doing the right thing), I wrote the code initially in NONMEM, then tried to replicate the results in R.

The dataset is four (identical) treatments for one subject and the data are reasonably linear.

For most subjects, the results from the NONMEM analysis are nearly identical to those from R.

But, for one subject, the SLOPE/INTERCEPT are sufficiently different to concern me that I am implementing one of these (or possibly both) incorrectly.

The critical code is:

*NONMEM:*

$PREDINTERCEPT= THETA(1) + ETA(1)

SLOPE= THETA(2) + ETA(2)

Y= INTERCEPT + SLOPE * TIME + EPS(1)

*R: LMER package:*

lmer(DV ~ TIME + (1|PERIOD), data=DATA, REML=FALSE)

where:

DV is the dependent variable

PERIOD distinguishes the treatments (and is a factor)

*R: NLME package:*

lme(DV ~ TIME, random = ~ 1|PERIOD, data=DATA, method="ML")

The two R packages yield identical results.

Graphics from NONMEM and R differ slightly but there is no obvious preference between these approaches.

Any thoughts as to a possible explanation?

Dennis

Dennis Fisher MD

P < (The "P Less Than" Company)

Phone / Fax: 1-866-PLessThan (1-866-753-7784)

www.PLessThan.com<http://www.PLessThan.com> <http://www.plessthan.com/><http://www.plessthan.com/>

Received on Wed Feb 28 2018 - 14:01:14 EST

Date: Wed, 28 Feb 2018 19:01:14 +0000

Thanks for the thought exercise, gentlemen.

Paul Hutson, PharmD, BCOP

Professor

UWisc School of Pharmacy

T: 608.263.2496

F: 608.265.5421

From: owner-nmusers omaxnm.com [mailto:owner-nmusers

Sent: Wednesday, February 28, 2018 12:44 PM

To: Leonid Gibiansky <lgibiansky

Cc: nmusers

Subject: Re: [NMusers] NONMEM vs. R for linear mixed-effects

Leonid

With your assistance, I realized the difference between the NONMEM and R approaches — the R approach allows only between-period differences in intercept (not slope) whereas the NONMEM approach that I implemented allowed for between-period differences in both. I removed the ETA for slope from the NONMEM code — the NONMEM results matches R exactly.

Conceptually, a common slope makes sense for this particular analysis.

Problem solved — thanks for your thoughts.

Dennis

Dennis Fisher MD

P < (The "P Less Than" Company)

Phone / Fax: 1-866-PLessThan (1-866-753-7784)

www.PLessThan.com<http://www.plessthan.com/>

On Feb 28, 2018, at 9:59 AM, Leonid Gibiansky <lgibiansky

see "Random slopes" here:

https://web.stanford.edu/class/psych252/section/Mixed_models_tutorial.html

lmer(pitch ~condition+gender+(1 + condition | subject))

On 2/28/2018 12:27 PM, Dennis Fisher wrote:

Leonid

I omitted one critical piece of information:

$INPUT PERIOD=ID

I think that your approach implies an order to the data from different periods — whereas making PERIOD=ID allows NONMEM to see each treatment as a separate subject (i.e., the random effect)

Dennis

Dennis Fisher MD

P < (The "P Less Than" Company)

Phone / Fax: 1-866-PLessThan (1-866-753-7784)

www.PLessThan.com<http://www.PLessThan.com> <http://www.plessthan.com/>

On Feb 28, 2018, at 9:23 AM, Leonid Gibiansky <lgibiansky

Just checking: you have treatment effect in R but no effect in Nonmem, am I correct? (I have not used R nlme for a long time, may be I am interpreting it incorrectly)

Should you code nonmem as

$PRED

INTERCEPT= THETA(1) + THETA(3)*PERIOD + ETA(1)

SLOPE= THETA(2) + THETA(4)*PERIOD + ETA(2)

Y= INTERCEPT + SLOPE * TIME + EPS(1)

Leonid

On 2/28/2018 11:16 AM, Dennis Fisher wrote:

Colleagues

I am implementing a linear mixed-effects model in R.

Out of curiosity (and to confirm that I was doing the right thing), I wrote the code initially in NONMEM, then tried to replicate the results in R.

The dataset is four (identical) treatments for one subject and the data are reasonably linear.

For most subjects, the results from the NONMEM analysis are nearly identical to those from R.

But, for one subject, the SLOPE/INTERCEPT are sufficiently different to concern me that I am implementing one of these (or possibly both) incorrectly.

The critical code is:

*NONMEM:*

$PREDINTERCEPT= THETA(1) + ETA(1)

SLOPE= THETA(2) + ETA(2)

Y= INTERCEPT + SLOPE * TIME + EPS(1)

*R: LMER package:*

lmer(DV ~ TIME + (1|PERIOD), data=DATA, REML=FALSE)

where:

DV is the dependent variable

PERIOD distinguishes the treatments (and is a factor)

*R: NLME package:*

lme(DV ~ TIME, random = ~ 1|PERIOD, data=DATA, method="ML")

The two R packages yield identical results.

Graphics from NONMEM and R differ slightly but there is no obvious preference between these approaches.

Any thoughts as to a possible explanation?

Dennis

Dennis Fisher MD

P < (The "P Less Than" Company)

Phone / Fax: 1-866-PLessThan (1-866-753-7784)

www.PLessThan.com<http://www.PLessThan.com> <http://www.plessthan.com/><http://www.plessthan.com/>

Received on Wed Feb 28 2018 - 14:01:14 EST