prediction: Prediction after a gnlmm fit

Description Usage Arguments Value Examples

View source: R/gnlmm.R

Description

Generate predictions after a generalized non-linear mixed effect model fit

Usage

1
prediction(fit, pred, data = NULL, mc.cores = 1)

Arguments

fit

a gnlmm fit object

pred

prediction function

data

new data

mc.cores

number of cores (for Linux only)

Value

observed and predicted

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Not run: 

ode <- "
d/dt(depot) =-KA*depot;
d/dt(centr) = KA*depot - KE*centr;
"
sys1 = RxODE(ode)

pars <- function()
{
	CL = exp(THETA[1] + ETA[1])#; if (CL>100) CL=100
	KA = exp(THETA[2] + ETA[2])#; if (KA>20) KA=20
	KE = exp(THETA[3])
	V  = CL/KE
	sig2 = exp(THETA[4])
}
llik <- function() {
	pred = centr/V
	dnorm(DV, pred, sd=sqrt(sig2), log=TRUE)
}
inits = list(THTA=c(-3.22, 0.47, -2.45, 0))
inits$OMGA=list(ETA[1]~.027, ETA[2]~.37)
theo <- read.table("theo_md.txt", head=TRUE)

fit = gnlmm(llik, theo, inits, pars, sys1,
	control=list(trace=TRUE, nAQD=5))

pred = function() {
	pred = centr/V
}

s = prediction(fit, pred)
plot(s$p, s$dv); abline(0,1,col="red")


## End(Not run)

nlmixr documentation built on Sept. 23, 2018, 5:04 p.m.