| fitModel {ccems} | R Documentation |
This function fits a model/hypothesis created by mkModel.
It is typically passed to lapply, clusterApplyLB or mpi.applyLB to
fit a list of such model objects (a model space) and this is typically done within ems.
fitModel(model)
model |
The output list of mkModel. |
The main output of this function is the report component of its value (see below) which is also echoed to the screen during
computations.
The input argument model extended to include the following fields:
echk |
A matrix that checks the TCC solver and model$fback. Matrix column names that end in Q should match their sans-Q counterparts. |
eSS |
The expected steady state concentrations of species (complexes and free reactants). For each row of the data dataframe there is a row in this
matrix. Its contents are the TCC solver solution (free reactant expected concentrations) and the result of applying
model$fback to them to create expected complex concentrations. |
res |
The residuals of the fit. |
nData |
The number of data points (i.e. rows) in the data dataframe model$d. |
SSE |
The initial and final sum of squared errors (i.e. residual sum of squares). |
AIC |
The initial and final Akaike Information Criterion values, corrected for small samples. Since nonlinear least squares is used
AIC = N*log(SSE/N)+2*P + 2*P*(P+1)/(N-P-1) + N*log(2*pi) + N where N = nData and P is the
number of estimated parameters (including the variance). |
nOptParams |
The number of optimized parameters, i.e. the length of the parameter vector sent to optim. |
hess |
This is TRUE if the determinant of the Hessian of the log-likelihood evaluated at the optimum is greater than zero,
i.e. if the hessian can be inverted to create a parameter estimate covariance matrix. |
CI |
Confidence intervals. Unlike those in model$report these are numeric rather than strings and these are
not expressed as concentrations raised to integer powers (in cases of complete dissociation constants). |
cpu |
The amount of computing time (in minutes) taken to fit the model. |
report |
An extension of model$params to include parameter point estimates and confidence intervals (see CI above). The final
column holds numerics and the pointEstimate column holds strings of the same numbers expressed as powers in cases
of complete dissociation constants. |
This work was supported by the National Cancer Institute (K25CA104791).
Tom Radivoyevitch (txr24@case.edu)
Radivoyevitch, T. (2008) Equilibrium model selection: dTTP induced R1 dimerization. BMC Systems Biology 2, 15.
library(ccems)
topology <- list(
heads=c("R1t0","R2t0"),
sites=list(
s=list( # s-site thread #
m=c("R1t1"), # monomer 1
d=c("R2t1","R2t2") # dimer 2
)
)
)
g <- mkg(topology,TCC=TRUE)
data(RNR)
d1 <- subset(RNR,(year==2001)&(fg==1)&(G==0)&(t>0),select=c(R,t,m,year))
d2 <- subset(RNR,year==2006,select=c(R,t,m,year))
dRt <- rbind(d1,d2)
names(dRt)[1:2] <- paste(strsplit(g$id,split="")[[1]],"T",sep="") # e.g. to form "RT"
rownames(dRt) <- 1:dim(dRt)[1] # lose big number row names of parent dataframe
## Not run:
models <- list(
mkModel(g,"IIJJ",dRt,Kjparams=c(R2t0=Inf, R1t1=Inf,R2t1=1, R2t2=1)),
mkModel(g,"IIIJ",dRt,Kjparams=c(R2t0=Inf, R1t1=Inf,R2t1=Inf, R2t2=1))
)
fmodels <- lapply(models,fitModel) # a list of two models are fitted in series here on a single processor
## End(Not run)
# Note that fitModel always delivers a summary of the fit to the screen as a byproduct. If no assignment is made, the returned large
# fitted list of models makes this summary time consuming to find (i.e. too much scrolling up).