Hello:  I am new to R Help so hopefully I will have included enough
information to allow for valuable feedback on an error message I am
receiving.  I am trying to a fit a mixed effects cox model to binary elk
telemetry data to look at movement decisions relative to other
possibilities (specifically selection or avoidance of risk <- kauf_avg ) in
a matched-case-control framework.

> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C

[5] LC_TIME=English_United States.1252

attached base packages:
[1] splines   stats     graphics  grDevices utils     datasets  methods
base

other attached packages:
[1] coxme_2.2-3      nlme_3.1-104     bdsmatrix_1.3-1  survival_2.36-14
AICcmodavg_1.28  lme4_0.999999-0
[7] Matrix_1.0-6     lattice_0.20-6   plotrix_3.4-5

loaded via a namespace (and not attached):
[1] grid_2.15.1   stats4_2.15.1 tools_2.15.1



I have included a snapshot of the dataset below.  The columns represents
Animal ID (ID), Record # (Record), Location groupings (Strata), Use versus
possible location (Used = 1), Variable of interest (kauf_avg), categorical
data (Dummy_Age; Dummy_Time), and required time variable (faketime).

FID_ ID  Record    Strata Used      kauf_avg    Dummy_Age    Dummy_Time
faketime
1       55      2           1    1            0.710135         3
       2                     1
2       55      2           1    0            0.555335         3
       2                     2
3       55      2           1    0            0.710135         3
       2                     2
4       55      2           1    0            2.100059         3
       2                     2
5       55      3            2    1           0.569817         3
       3                     1
6       55      3            2    0           0.558852         3
       3                     2
7       55      3            2    0           1.331789         3
       3                     2
8       55      3            2    0           2.306629         3
       3                     2
9       55      4            3    1           0.569817         3
      1                     1
10     55      4            3    0           0.616777         3
      1                     2
11     55      4            3    0           0.737392         3
      1                     2
12     55      4            3    0           1.637539         3
     1                     2
13     55      5            4    1           0.548600         3
     2                     1
14     55      5            4    0           0.222890         3
      2                     2
15     55      5            4    0           0.598823         3
     2                     2

> str(data)
'data.frame': 57195 obs. of  9 variables:
 $ FID_      : int  1 2 3 4 5 6 7 8 9 10 ...
 $ ID        : int  55 55 55 55 55 55 55 55 55 55 ...
 $ Record    : int  2 2 2 2 3 3 3 3 4 4 ...
 $ Strata    : int  1 1 1 1 2 2 2 2 3 3 ...
 $ Used      : int  1 0 0 0 1 0 0 0 1 0 ...
 $ kauf_avg  : num  0.71 0.555 0.71 2.1 0.57 ...
 $ Dummy_Age : Factor w/ 4 levels "1","2","3","4": 3 3 3 3 3 3 3 3 3 3 ...
 $ Dummy_Time: Factor w/ 3 levels "1","2","3": 2 2 2 2 3 3 3 3 1 1 ...
 $ faketime  : num  1 2 2 2 1 2 2 2 1 2 ...

The faketime column is built using the following code:

faketime <- rep(1, times = nrow(mccallrisk))
faketime[mccallrisk$Used == 0] <- 2 #2 for control, 1 for case
data <- cbind(mccallrisk, faketime)
rm(faketime)

When I run the analysis code for a univariate model I have no issues:

mcc.risk<-coxme(Surv(faketime,Used)~ kauf_avg +
(1|ID)+strata(Strata),data=data)
mcc.risk

Cox mixed-effects model fit by maximum likelihood
  Data: data
  events, n = 14344, 57195
  Iterations= 1 5
                    NULL           Integrated    Fitted
Log-likelihood -19781.73   -19739.71     -19739.71

                  Chisq df p   AIC   BIC
Integrated loglik 84.05  2 0 80.05 64.91
 Penalized loglik 84.05  1 0 82.05 74.48

Model:  Surv(faketime, Used) ~ kauf_avg + (1 | ID) + strata(Strata)
Fixed coefficients
              coef                   exp(coef)    se(coef)            z
 p
kauf_avg   0.0490237        1.050245     0.005330567    9.2    0

Random effects
 Group Variable  Std Dev Variance
 ID    Intercept 2e-02   4e-04

However, when I include a second variable the following error message
follows.

> mcc.risk_time<-coxme(Surv(faketime,Used)~ kauf_avg + Dummy_Time +
(1|ID)+strata(Strata),data=data)

Error in logfun(as.numeric(testvals[i, ]), varlist, vparm, kfun, ntheta,  :
  NA/NaN/Inf in foreign function call (arg 2)

I have removed all NA values from kauf_avg and neither Time or Age have NA
values.

The only information I can seem to find relevant to this error message is
the following (I have contacted this person and am waiting to hear back but
I thought I might post on here to see if anyone else had additional
thoughts/comments):

Feb 14, 2013; 7:49amRe: NA/NaN/Inf in foreign function call (arg 6) error
from coxph function

The NaN/Inf message is almost certainly from a singular fit.  I would be
interested in a copy of the data set to test it: data sets that cause this are
rare, and help me to tune the convergence/signularity criteria in the
program.   Note: it is much easier to use coxph(survobj ~ therapy +
ReceptorA + ReceptorB, data=sample.data) than to put "sample.data$" in
front of every variable name; and easier  to read as well.

Terry Therneau (author of coxph function)

Thank you,

-- 
Michel Kohl
<><><><><><><><><><>
Ph.D. Student
Department of Wildland Resources
Utah State University

	[[alternative HTML version deleted]]

