#------------# # INPUT FILE #------------# # 1. INTRODUCTION: # The function "continuous_time" provides continuous time parameter estimates for panel data. It allows # (a) the estimation of nonoscillating and oscillating processes (with and without dampening), # (b) the estimation of uni- and multivariate processes (with and without coupling), # (c) individually varying time intervals (different across individuals and/or across time) # A description of the approach (including all equations implemented in the "continuous_time" function) is provided in Voelkle & Oud (2012) # 2. PREPARATION: # The program consists of two files, the present input file and the CT_SEM.R file. Both files must be located in the same folder. All specifications are # made in the present file. The CT_SEM.R file must not be opened or changed. In order to run the syntax it is necessary: # (a) to have R installed (http://www.r-project.org/) # (b) to have OpenMx installed (type "source('http://openmx.psyc.virginia.edu/getOpenMx.R'" into the R Editor) # (c) to set the path of the working directory to the folder where the input file, CT_SEM.R, and the data are saved (all in one folder) # 3. DATA: # The data should be saved in an ASCII .dat format and should be prepared so that # (a) all indicators (of possibly different factors) at one time point are in a consecutive order, # followed by all indicators of the second time point and so on: (e.g., x1t1, x2t1, ..., x1t2, x2t2, ..., x1T, ..., xqT) # (b) The last T-1 variables contain the length of the time interval for each person and time interval # 4. MODEL SPECIFICATION: # The model is specified by providing starting values for all parameters to be estimated. All parameters that are specified with starting values other # than 0 or 1 are being freely estimated. Only values of exactly 1 or 0 are treated as fixed. As a consequence it is not possible to specify a # starting value of 1 or 0 (but 1.001 or 0.001 is possible). All matrices below must be specified. If some are not relevant (e.g. if there are no latent # factors but just manifest variables) simply set them to zero (i.e., LAMBDA to one and THETA to zero) # 5. EXAMPLES # In line with Voelkle & Oud (2012) we provide two input files and example datasets. One example is a bivariate coupled model # without oscillation and individually varying time intervals. The other is an example of a univariate damped linear oscillator with individually varying # time intervals. [depending on the number of different time intervals, oversamples, and computing power, the computation may take up to 20min] #setwd("/ophth/Continuous_Time_Lagged_Modeling/Web") # set working directory #setwd("U:\\supplemental_material") # set working directory # name of input file [rows = subjects; columns = variables in the order described above] #input_file <- "/ophth/Continuous_Time_Lagged_Modeling/Web/1_data_nonoscillating_xy.dat" input_file <- "BMSP_2043_sm_data1.dat" n.manifest <- 2 # number of indicators for all factors n.latent <- 2 # number of latent variables Tpoints <- 11 # number of time points PHI1 <- matrix(c(1.01, 0.10, # var/cov matrix of latent variables at first time point 0.10, 1.01 ),nrow=n.latent, ncol=n.latent, byrow=TRUE) latentM1 <- matrix(c(1.55, 1.01 # means of latent variables at first time point ),nrow=n.latent, ncol=1, byrow=TRUE) manifestM <- matrix(c(0,0 # intercepts of manifest variables [usually fixed to zero] ),nrow=n.manifest, ncol=1, byrow=TRUE) LAMBDA <- matrix(c(1,0, # factor loading matrix 0,1 ),nrow=n.manifest, ncol=n.latent,byrow=TRUE) THETA <- matrix(c(0,0, 0,0 # var/cov matrix of measurement error ),nrow=n.manifest, ncol=n.manifest) DRIFT <- matrix(c(-0.66, 0.25, # drift matrix 0.50, -0.33 ),n.latent,n.latent, byrow=TRUE) CINT <- matrix(c(0.15, 0.25 # continuous time intercepts ),ncol=n.latent, nrow=1, byrow=TRUE) G<- matrix(c(1.1, 0.1,0,1.1),n.latent, n.latent) # G matrix [lower left triangle must be zero] D<- 30 # number of oversamples [for lower values computation # time decreases but parameter estimates become less precise] #do not change# source("BMSP_2043_sm_input3.R") #continuous_time(input_file, Tpoints, n.latent, DRIFT, CINT, G, D, n.manifest, LAMBDA, PHI1, THETA, latentM1, manifestM) continuous_time(input_file, Tpoints, n.latent, DRIFT, CINT, G, D, n.manifest, LAMBDA, PHI1, THETA, latentM1, manifestM)