NONMEM Users Network Archive

Hosted by Cognigen

Re: [NMusers] W for time varying covariates

From: Jakob Ribbing <>
Date: Thu, 5 Oct 2017 16:40:13 +0200

Dear Bernard,

The user guide for scm seems to indicate that for the functionality of =
time-varying covariates, you need to estimate the standard deviation of =
the residual error as THETAS(s) (with SIGMAS(s) fixed to 1):
(see option “time_varying")

One more thing, before you switch to estimating the magnitude of the =
residual error as a fixed effect: notice that W should represent the =
standard deviation of the residual error (IRES in my example code =
below), and SIGMA(1,1) would generally represent the variance.
Below, I provide the code that I would use for the additive error with =
SIGMA estimated.
(the code with SIGMA fixed is provided in the scm user guide, under =

Best wishes


For other users, it should be noted that for covariates that are mostly =
varying between individuals, and just slightly over time (e.g. WT in =
adults), the option -time_varying in scm will have little or no impact.
But in this case, if another covariates is mostly varying over time, one =
may as well include WT among the ones listed as time varying (assuming =
WT was measured multiple times).

Example code for estimating additive error model with sigma estimated.

IPRED = [Model specific equation, or F]


Y = IPRED + EPS(1)

Jakob Ribbing, Ph.D.

Senior Consultant, Pharmetheus AB

Cell/Mobile: +46 (0)70 514 33 77

Phone, Office: +46 (0)18 513 328

Uppsala Science Park, Dag Hammarskjölds väg 52B

SE-752 37 Uppsala, Sweden

This communication is confidential and is only intended for the use of =
the individual or entity to which it is directed. It may contain =
information that is privileged and exempt from disclosure under =
applicable law. If you are not the intended recipient please notify us =
immediately. Please do not copy it or disclose its contents to any other =

On 05 Oct 2017, at 15:38, Bernard Ngara <> wrote:

> Dear users
> I was trying to fit a covariate model using SCM approach in PsN with =
the code:
> model = run1.mod
> logfile=run1.log
> search_direction = both
> p_forward=0.05
> p_backward=0.01
> continuous_covariates=CD4,HWT,BWT,HT,BMI,AGE,TOAR,VAS
> categorical_covariates=LNGTH,SEX,REGIMEN,CARE,EDU,WHO,BMI4AGE
> time_varying =CD4,HWT,BMI,AGE,TOAR,VAS
> [test_relations]
> [valid_states]
> continuous = 1,2
> categorical = 1,2
> The run fails and gives the following error message:
> Starting scm forward search
> Could not find assignment to W in $PRED needed for time_varying at =
C:/Portable_PKPD/Perl/bin/..\site\lib\PsN_4_7_0/tool/ line 5764.
> However I do have the W in the model file as:
> IF(DVID.EQ.1) W=SIGMA(2,2) ;
> IF(DVID.EQ.2) W=SIGMA(4,4)
> The baseline model runs well with stability and reasonable estimates =
of parameters but I am facing a challange on implementing the SCM.
> Kind regards
> --
> Bernard Ngara
> Biostatistician
> Harare
> Zimbabwe
> +263 776 971 400

Received on Thu Oct 05 2017 - 10:40:13 EDT

The NONMEM Users Network is maintained by ICON plc. Requests to subscribe to the network should be sent to: Once subscribed, you may contribute to the discussion by emailing: