fitModel                package:ccems                R Documentation

_F_i_t _M_o_d_e_l

_D_e_s_c_r_i_p_t_i_o_n:

     This function fits a model/hypothesis created by 'mkModel'.  It is
     typically passed to 'lapply' or 'clusterApplyLB' to  fit a list of
     model objects, typically within 'ems'.

_U_s_a_g_e:

      fitModel(model) 

_A_r_g_u_m_e_n_t_s:

   model: The output list of 'mkModel'. 

_D_e_t_a_i_l_s:

     The main output of this function is the 'report' component of its
     value (see below) which is also echoed to the screen during 
     computations.

_V_a_l_u_e:

     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 complexes and
          free reactants.  For each row of the data dataframe there is
          a row in this matrix. Its contents are the TCC solver's
          expected free reactant 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/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.

_N_o_t_e:

     This work was supported by the National Cancer Institute
     (K25CA104791).

_A_u_t_h_o_r(_s):

     Tom Radivoyevitch (txr24@case.edu)

_R_e_f_e_r_e_n_c_e_s:

     Radivoyevitch, T. (2008) Equilibrium model selection: dTTP induced
     R1  dimerization. _BMC Systems Biology_ *2*, 15.

_S_e_e _A_l_s_o:

     'mkModel','ems','ccems'

_E_x_a_m_p_l_e_s:

     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))
            )
     # the next line fits the list of two models above in series on a single processor 
     fmodels <- lapply(models,fitModel) 
     ## End(Not run)
     # Note that fitModel always delivers a summary of the fit to the screen as a byproduct. 
     # The output of the call is assigned to avoid scrolling up through the returned large 
     # fitted list of models in order to find this summary. 

