Auxiliary function as user interface for cold fitting.
coldIntegrate(li=-4,ls=4, epsabs=.Machine$double.eps^.25, 
epsrel=.Machine$double.eps^.25,limit=100,key=6,lig=-4,lsg=4)lower limit of integration for the log-likelihood.
upper limit of integration for the log-likelihood.
absolute accuracy requested.
relative accuracy requested.
integer from 1 to 6 for choice of local integration rule for number of Gauss-Kronrod quadrature points. A gauss-kronrod pair is used with: 7 - 15 points if key = 1, 10 - 21 points if key = 2, 15 - 31 points if key = 3, 20 - 41 points if key = 4, 25 - 51 points if key = 5 and 30 - 61 points if key = 6.
integer that gives an upperbound on the number of subintervals in the partition of (li,ls), limit.ge.1.
lower limit of integration for the gradient.
upper limit of integration for the gradient.
A list with the arguments as components.
coldIntegrate returns a list of constants that are used to compute integrals based on a Fortran-77 subroutine dqage from a   Fortran-77 subroutine package QUADPACK for the numerical computation of definite one-dimensional integrals.              
 The subroutine dqage is a simple globally adaptive integrator in which it is possible to choose between 6 pairs          
 of Gauss-Kronrod quadrature formulae for the rule evaluation component. The source code dqage was modified and re-named  
 dqager, the change was the introduction of an extra variable that allow, in our Fortran-77 subroutines when              
 have a call to dqager, to control for which parameter the integral is computed.
For given values of li and ls, the above-described
numerical integration is performed over the interval 
(li*\(\sigma\), ls*\(\sigma\)), where \(\sigma=\exp(\omega)/2\)
is  associated to the current parameter value \(\omega\) examined by
the optim function.  In some cases, this integration may
generate an error, and the user must suitably adjust the values of li 
and ls. In case different choices of these quantities all
lead to a successful run, it is recommended to retain the one with
largest value of the log-likelihood. Integration of the gradient is
regulated similarly by lig and lsg.
For datasets where the individual profiles have a high number of 
observed time points (say, more than 30), 
use coldIntegrate function to set the integration limits for the 
likelihood and for the gradient to small values 
than the default ones.
When the fitting procedure is complete but the computation of the information matrix 
produces NaNs, changing in coldIntegrate function the default values for the gradient 
integration limits (lig and lsg) might solve this problem.
# NOT RUN {
#####  data= seizure
Integ <- coldIntegrate(li = -3.5, ls = 3.5, lig = -3.5, lsg = 3.5)
### AR1R without patient 207
# }
# NOT RUN {
seizure207 <- seizure[seizure$id != 207, ]
seiz1R1.207 <- cold(y~ lage + lbase + v4 + trt  + trt:lbase, 
random = ~ 1, data = seizure207, dependence = "AR1R", integrate = Integ)
summary (seiz1R1.207)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab