Displaying 3 results from an estimated 3 matches for "transmat".
Did you mean:
transat
2008 Apr 22
2
nth step transition matrices
Hello,
I have a question in regards to markov chains and transition
probabilities.
I am trying to figure out a way to calculate the "kth-step transition
matrix" of a given matrix.
Say for example I have a single step 2x2 matrix:
1 2
P= 1 .95 .05
2 .01. 99
If I were to convert this matrix to a 2-step transition probability
matrix I would get:
2012 Apr 26
0
Problem with constrOptim when hitting boundary
...ele
probX<-function(p){
dbinom(x=x,size=m,prob=p)
}
wtMat<-sapply(possAlleles,probX) #nMuts x nAlleles
if(is.null(dim(wtMat))){
if(length(x)==1) wtMat<-matrix(wtMat,nrow=1)
else stop("Programming error -- single row wtMat")
}
###Need to convert so in terms of pi[-0]
transMat<-rbind(rep(-1,K),diag(K))
Aid<-A%*%transMat
numGr<-wtMat %*% Aid #N x K matrix
init<-rep(1/(K+1),length=K) #equal distribution; could perhaps choose better init value
getProbFromTheta<-function(theta){
return(c(1-sum(theta),theta))
}
neglik<-function(theta){
probDist<...
2011 Sep 17
0
Warning in 'probtrans'-function ('mstate'-package)
...does this "inconsistency"(?) arise and are there any criterias to
decide whether the model's validity is seriously affected of it?
Best,
Johannes
### EXAMPLE:
#
library(mstate)
# set up transistion matrix for illness-death model with competing risks
(2 death causes)
tmat <- transMat(x=list(
c(2),
c(3,4),
c(),
c()), names=
c(NA, "ill", "cause1", "cause2"))
# create example data with 't' (time), 's' (status) & 'v'
(variables/predictors) in 'wide format'..
set.seed(123)
S1 <- data.frame(
t1 = rnorm(100, 10, 1...