Skip to content

Stumped Re: warning #1

Description

@dberry77

Dear Dr. Driver.
Thanks for both your didactic work on CTSEM, as well as this package. I've tried getting the following model to fit ~1000 different ways and, for the life of me I can't figure out why its throwing this error. Was hoping that it was something obvious that I'm missing... any thoughts would be really appreciated.

If I'm using a wide file (created via your long-to-wide function), I have 60 columns (that look just like the example in Driver et al. (2017) JSS). It reflects 2 time-varying manifest variables (t = 20), and then the 20 time-interval variables (time is balanced across individuals). There are NAs, but I’ve tried it w/out. Doesn’t fix anything.

The code is as follows:

the model##

number of latents

F <- 2

number of manifests

I <- F

drift matrix

A <- matrix( c("a_C","a_C}M","a_M}C","a_M"), nrow=F, ncol=F )

diffusion covariance matrix

Q <- matrix( c("var_C","cov_C_M",0,"var_M"), nrow=F, ncol=F )

continuous-time intercepts

b <- matrix( c("b_C","b_M"), nrow=F, ncol=1 )

#Random Person means
Sigmab.lr <- matrix( c("varblr_C","covblr_C_M",0,"varblr_M"), nrow=F, ncol=F )

set all intercepts of manifest variables to 0

manifestmeans <- matrix( 0, nrow=I, ncol=1 )

set measurement error covariance matrix to 0

manifestvar <- matrix( 0, nrow=I, ncol=I )

loading matrix: each item loads on one latent variable

Lambda <- diag( I )

set up model

m <- ctModel( n.latent = F,
latentNames = c("C_Pos","M_Pos"), # set names of latent variables
n.manifest = I,
manifestNames = c("cpos_wpz","mpos_wpz"), # names of manifest variables
# as in data set
DRIFT = A,
DIFFUSION = Q,
CINT = b,
TRAITVAR = Sigmab.lr,
LAMBDA = Lambda,
MANIFESTMEANS = manifestmeans,
MANIFESTVAR = manifestvar,
Tpoints = 20, # number of measurement occasions as in data set
type = "omx" ) # for frequentist estimation

Fit the model

set.seed( 1234 )
r <- ctFit( dat = wideexample2,
ctmodelobj = m,
dataform = "wide",
stationary = "all" ) # stationary assumption

smr <- summary( r )
print( smr$ctparameters )

The error is:
“Error in ctFit(dat = wide_pos, ctmodelobj = m, dataform = "wide", stationary = "all") :
Number of columns in data (60) do not match model (59)”

I’ve had the same issue if I opt for a long datafile.
“Error in ctFit(dat = play_cpmp, ctmodelobj = m, dataform = "long", stationary = "all") :
Tpoints in ctmodelobj = 20, not equal to 1, the maximum number of rows of any subject in dat.

I'm sure I'm just doing something dumb... but I'm at a bit of a loss.

Thanks again for any thoughts.
Best regards,
-dan berry

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions