*Hello,*

I never worked with R before my supervisor asks me to run a semiMarkov
analysis a month ago. After a long struggle, to date, the code works, but I
still get some warnings. However, because of my lack of knowledge in R I am
not possible to figure out the problems or say anything about the influence
of these warnings on my outcome. Hopefully, someone would help me with
these ( I think basic) questions.


What is the case? I want to do a semiMarkov analysis with 3 states (state
n, state s and state e). Wherefore I want to run the analysis to see
whether there is a difference in Hazard Ratio between transitions nàe and sàe.
Therefore, I’ve got data of nearly 60 persons. In excel, every worksheet
reflects a person.  To answer my research question I tried to run the
script for one person.

Unfortunately, I get the following error:

> # read data and convert to correct format (and print tail).

> data <- readdata( input <- 'E1_tijd_stress.csv' )

Error in `$<-.data.frame`(`*tmp*`, "state", value = "s") :

  replacement has 1 row, data has 0

Called from: `$<-`(`*tmp*`, "state", value = "s")



Furthermore, I used a macro in excel to merge these worksheets into one
worksheet ( all persons in one file) . However, after running the script I
saw the following warnings:

> # semi-Markov model without covariates.

> fit.semi.markov <- semiMarkov( data = data, states = states.semi.markov, 
> mtrans = mtrans.semi.markov )



Iter: 1 fn: 11224.5658  Pars:  1000.00000 412.24725 261.14293
66.30789   1.67507   5.59420   0.55746   1.37715   0.59734   0.48604
0.73281   0.74205

Iter: 2 fn: 11224.5658  Pars:  1000.00000 412.24425 261.14508
66.30635   1.67506   5.59420   0.55746   1.37716   0.59734   0.48604
0.73281   0.74206

solnp--> Completed in 2 iterations

Warning messages:

1: In .safefunx(tmpv, .solnp_fun, .env, ...) :

solnp-->warning: Inf detected in function call...check your function


These repeated for 7 times. Or the following warning:

> fit.semi.markov <- semiMarkov( data = data, states = states.semi.markov, 
> mtrans = mtrans.semi.markov )

Iter: 1 fn: 444562.8860         Pars:  1.00000 1.00000 1.00000 1.00000
1.00000 1.00000 1.00000 1.00000 1.00000 0.47882 0.72691 0.74627

solnp--> Completed in 1 iterations

Error in svd(X) : infinite or missing values in 'x'

In addition: There were 29 warnings (use warnings() to see them)

29: In .safefunx(tmpv, .solnp_fun, .env, ...) :

solnp-->warning: NaN detected in function call...check your function


Furthermore, I want to control the analysis for some covariates.

> # semi-Markov model with covariates

> fit2 <- semiMarkov( data = data,cov= as.data.frame(data$stress.score), states 
> = states, mtrans = mtrans )

Error in mtrans[as.numeric(substring(trans.hh[i], first = 1, last = 1)),  :

  subscript out of bounds


Is someone able to tell me what these warnings exactly mean? Or someone I
can contact to discuss about this? I understand inf and NaN for example but
I am not able to figure out what to change in my data format of script (
the problem is, some of my data run without problems, some does not).
Hopefully I give enough information, otherwise let me know.

Thank you!

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to