# NOT RUN {
#Example 1:
#When start date and end date are not specified, the entire dataset is used and the package
#performs TTC calculations. Equally when snapshots and interval are not specified the defaults
#are 1.
snapshots <- 0
interval <- 0
startDate <- 0
endDate <- 0
Example1<-TransitionProb(dataTM,startDate,endDate,'cohort', snapshots, interval)
#Example 2:
#using the duration method the time window of interest are specified 2-year period from the
#beginning of 2000 to the beginning of 2002 snapshots and interval are not specified.
snapshots <- 0
interval <- 0
startDate <- "2000-01-01"
endDate <- "2002-01-01"
Example2<-TransitionProb(dataTM,startDate, endDate,'duration', snapshots, interval)
#Example 3:
#using the cohort method the time window of interest are specified 5-year period from the
#beginning of 2000 to the beginning of 2005 snapshots and interval are not specified.
snapshots <- 0
interval <- 0
startDate <- "2000-01-01"
endDate <- "2005-01-01"
Example3<-TransitionProb(dataTM,startDate, endDate,'cohort', snapshots, interval)
#Example 4:
#assume that the time window of interest is the 5-year period from the beginning of 2000 to
#the beginning of 2005. We want to estimate 1-year transition probabilities using quarterly
#snapshots using cohort method.
snapshots <- 4 #This uses quarterly transition matrices
interval <- 1 #This gives a 1 year transition matrix
startDate <- "2000-01-01"
endDate <- "2005-01-01"
Example4<-TransitionProb(dataTM,startDate, endDate,'cohort', snapshots, interval)
#Example 5:
#assume that the time window of interest is the 5-year period from the beginning of 2000 to
#the beginning of 2005. We want to estimate a 2-year transition probabilities using quarterly
#snapshots using cohort method.
snapshots <- 4 #This uses quarterly transition matrices
interval <- 2 #This gives a 2 years transition matrix
startDate <- "2000-01-01"
endDate <- "2005-01-01"
Example5<-TransitionProb(dataTM,startDate, endDate,'cohort', snapshots, interval)
#Example 6:
#assume that the time window of interest is the 2-year period from the beginning of 2000 to
#the beginning of 2005. We want to estimate 1-year transition probabilities using quarterly
#snapshots using duration method.
snapshots <- 4 #This uses quarterly transition matrices
interval <- 1 #This gives a 1 year transition matrix
startDate <- "2000-01-01"
endDate <- "2002-01-01"
Example6<-TransitionProb(dataTM,startDate, endDate,'duration', snapshots, interval)
#Example 7:
#assume that the time window of interest is the 5-year period from the beginning of 2000 to
#the beginning of 2005. We want to estimate 1-year transition probabilities using monthly
#snapshots using cohort method.
snapshots <- 12 #This uses monthly transition matrices
interval <- 1 #This gives a 1 year transition matrix
startDate <- "2000-01-01"
endDate <- "2005-01-01"
Example7<-TransitionProb(dataTM,startDate, endDate,'cohort', snapshots, interval)
#Example 8:
#assume that the time window of interest is the 5-year period from the beginning of 2000 to
#the beginning of 2005. We want to estimate 1-year transition probabilities using annual
#snapshots using cohort method.
snapshots <- 1 #This uses annual transition matrices
interval <- 1 #This gives a 1 year transition matrix
startDate <- "2000-01-01"
endDate <- "2005-01-01"
Example8<-TransitionProb(dataTM,startDate, endDate,'cohort', snapshots, interval)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab