Ejemplo n.º 1
0
def test_additive_error_model(testdata):
    model = Model(testdata / 'nonmem' / 'pheno.mod')
    additive_error(model)
    model.update_source()
    assert str(model).split('\n')[11] == 'Y = F + EPS(1)'
    assert str(model).split('\n')[17] == '$SIGMA  11.2225 ; sigma'
    before = str(model)
    additive_error(model)  # One more time and nothing should change
    assert before == str(model)
Ejemplo n.º 2
0
def test_additive_error_without_f(testdata):
    code = """$PROBLEM PHENOBARB SIMPLE MODEL
$DATA pheno.dta IGNORE=@
$INPUT ID TIME AMT WGT APGR DV
$SUBROUTINE ADVAN1 TRANS2
$PK
CL=THETA(1)*EXP(ETA(1))
V=THETA(2)*EXP(ETA(2))
$ERROR
PRED=A(1)/V
CONC=PRED
Y=CONC+CONC*EPS(1)
$THETA (0,0.00469307) ; TVCL
$THETA (0,1.00916) ; TVV
$OMEGA 0.0309626  ; IVCL
$OMEGA 0.031128  ; IVV
$SIGMA 0.013241
$ESTIMATION METHOD=1 INTERACTION
"""
    model = Model(StringIO(code))
    model.source.path = testdata / 'nonmem' / 'pheno.mod'  # To be able to find dataset
    additive_error(model)
    model.update_source()
    correct = """$PROBLEM PHENOBARB SIMPLE MODEL
$DATA pheno.dta IGNORE=@
$INPUT ID TIME AMT WGT APGR DV
$SUBROUTINE ADVAN1 TRANS2
$PK
CL=THETA(1)*EXP(ETA(1))
V=THETA(2)*EXP(ETA(2))
$ERROR
PRED=A(1)/V
CONC=PRED
Y = CONC + EPS(1)
$THETA (0,0.00469307) ; TVCL
$THETA (0,1.00916) ; TVV
$OMEGA 0.0309626  ; IVCL
$OMEGA 0.031128  ; IVV
$SIGMA  11.2225 ; sigma
$ESTIMATION METHOD=1 INTERACTION
"""
    assert str(model) == correct
Ejemplo n.º 3
0
def test_additive_error_model_logdv(testdata):
    model = Model(testdata / 'nonmem' / 'pheno.mod')
    additive_error(model, data_trans="log(Y)")
    model.update_source()
    assert str(model).split('\n')[11] == 'Y = LOG(F) + EPS(1)/F'
    assert str(model).split('\n')[17] == '$SIGMA  11.2225 ; sigma'
Ejemplo n.º 4
0
def test_additive_error_model(testdata):
    model = Model(testdata / 'nonmem' / 'pheno.mod')
    additive_error(model)
    model.update_source()
    assert str(model).split('\n')[11] == 'Y = EPS(1) + F'
    assert str(model).split('\n')[17] == '$SIGMA  11.2225 ; sigma'