markovdata              package:depmix              R Documentation

_S_p_e_c_i_f_y_i_n_g _M_a_r_k_o_v _d_a_t_a _o_b_j_e_c_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     Markovdata creates an object of class 'md', to be used  by
     'fitdmm'.

_U_s_a_g_e:

             markovdata(dat,itemtypes,nitems=length(itemtypes),
                                     ntimes=length(as.matrix(dat))/nitems,
                                     inames=NULL,dname=NULL,xm=-9999)
             
             ## S3 method for class 'md':
             summary(object, ...)
             ## S3 method for class 'md':
             plot(x, nitems = 1:(min(5, dim(x)[2])), 
                             nind = 1:(min(5,length(attributes(x)$ntimes))),...)
             ## S3 method for class 'md':
             print(x, ...) 
             
             dname(object)
             ntimes(object)
             itemtypes(object)
             
             ncov(object)
             inames(object)
             nitems(object)
             ind(object)
             

_A_r_g_u_m_e_n_t_s:

     dat: An R object to be coerced to markovdata, a data frame or
          matrix.

itemtypes: A vector providing the types of measurement with possible
          values 'continuous', 'categorical', and 'covariate'. This is
          mainly only used to rearrange the data when there are
          covariates in such a way that the covariate is in the last
          column. Only one covariate is supported in estimation of
          models.

  ntimes: The number of repeated measurements, ie the length of the
          time series (this may be a vector containing the lengths of
          independent realiazations). It defaults the number of rows of
          the data frame or data matrix.

  inames: The names of items. These default to the column names of 
          matrices or dataframes.

   dname: The name of the dataset, used in summary, print and plot
          functions.

      xm: 'xm' is the missing data code.  It can be any value but zero.
          Missing data are recoded into 'NA'.

object,x: An object of class 'md'.

     ...: Further arguments passed on to plot and summary.

nitems,nind: In the plot function, these arguments control which data 
          are to be plotted, ie nitems indicates a range of items, and
          nind a range of realizations, respectively.

_D_e_t_a_i_l_s:

     The function 'markovdata' coerces a given data frame or matrix to
     be an object of class 'md' such that it can be used in 'fithmm'.
     The 'md' object has its own summary, print and plot methods.

     The functions dname, itemtypes, and ntimes retrieve the respective
     attributes with these names; similarly 'ncov, nitems, inames', and
     'ind' retrieve the number of covariates, the number of items (the
     number of columns of the data), the column names and the number of
     'ind'ependent realizations respectively.

_V_a_l_u_e:

     An 'md'-object is a matrix of dimensions sum(ntimes) by nitems,
     containing the measured variables and covariates rearranged such
     that the covariate appears in the last column. The column names
     are 'inames' and the matrix has three further attributes: 

itemtypes: See above.

   dname: The name of the data set.

  ntimes: See above. This will be a vector computed as 
          ntimes=rep(ntimes,nreal).

_A_u_t_h_o_r(_s):

     Ingmar Visser

_S_e_e _A_l_s_o:

     'dmm', 'depmix'

_E_x_a_m_p_l_e_s:

     x=rnorm(100,10,2)
     y=ifelse(runif(100)<0.5,0,1)
     z=matrix(c(x,y),100,2)
     md=markovdata(z,itemtypes=c("cont","cat"))
     summary(md)
     md[1:10,]

     data(speed)
     summary(speed)
     plot(speed,nind=2)

     # split the data into three data sets 
     # (to perform multi group analysis) 
     r1=markovdata(dat=speed[1:168,],item=itemtypes(speed))
     r2=markovdata(dat=speed[169:302,],item=itemtypes(speed))
     r3=markovdata(dat=speed[303:439,],item=itemtypes(speed))
     summary(r2)

