tcplObj: Concentration Response Objective Function

View source: R/tcplObj.R

tcplObjR Documentation

Concentration Response Objective Function

Description

Log-likelihood to be maximized during CR fitting.

Usage

tcplObj(p, conc, resp, fname, errfun = "dt4", err = NULL)

Arguments

p

Vector of parameters, must be in order: a, tp, b, ga, p, la, q, er. Does not require names.

conc

Vector of concentrations in log10 units for loghill/loggnls, in regular units otherwise.

resp

Vector of corresponding responses.

fname

Name of model function.

errfun

Which error distribution to assume for each point. "dt4" is the original 4 degrees of freedom t-distribution. "dnorm" is the normal distribution.

err

An optional estimation of error for the given fit.

Details

This function is a generalized version of the log-likelihood estimation functions used in the ToxCast Pipeline (TCPL). Hill model uses fname "loghill" and gnls uses fname "loggnls". Other model functions have the same fname as their model name; i.e. exp2 uses "exp2", etc. errfun = "dnorm" may be better suited to gsva pathway scores than "dt4". Setting err could be used to fix error based on the null data noise distribution instead of fitting the error when maximizing log-likelihood.

Value

Log-likelihood.

Examples

conc = c(.03,.1 , .3 , 1  , 3 , 10 , 30  , 100)
resp = c( 0 , 0 , .1 ,.2 , .5 , 1  , 1.5 , 2  )
p = c(tp = 2, ga = 3, p = 4, er = .5)
tcplObj(p,conc,resp,"exp5")

lconc = log10(conc)
tcplObj(p,lconc,resp,"loghill")

tcplfit2 documentation built on Oct. 11, 2023, 1:07 a.m.