Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Growth model (traj) and varlist not allowed

    Hi everyone,

    I am trying to use the traj plugin to conduct a latent growth curve model over the course of adolescent depression treatment. I am new to STATA (as a context).

    The syntax for the procedure is: traj [if], var(varlist) indep(varlist) model(modeltype) order(numlist)

    I have tried to run the basic analyses as follows: traj, var(adsdeprn0-adsdeprn12) indep(adst0-adst12) model(cnorm) order (2 2 2) min (0) max (67)

    No matter how I manipulate the command, I get the error message: "varlist not allowed." I cannot figure out what I am doing wrong given that the syntax for the command specifically says to include varlists.

    Any suggestions appreciated! I can provide additional info if helpful.

  • #2
    I've never heard of traj. Is this where you got it from?

    http://www.andrew.cmu.edu/user/bjones/index.htm

    You should indicate the sources for user-written commands. Especially in a case like this, where the command doesn't show up with findit.
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://academicweb.nd.edu/~rwilliam/

    Comment


    • #3
      Assuming I've got the right source -- can you get the examples in the help file to run? This works fine for me (well, it runs anyway)

      Code:
      use http://www.andrew.cmu.edu/user/bjones/traj/data/montreal_sim.dta, clear
      traj, model(cnorm) var(qcp*op) indep(age*) order(1 3 2) min(0) max(10)
      trajplot, xtitle("Age") ytitle("Opposition")
      Copy your exact syntax and output from Stata. So many times, people have problems like this, and it turns out they were missing a comma or misspelled an option.
      Last edited by Richard Williams; 31 Jul 2014, 16:31.
      -------------------------------------------
      Richard Williams, Notre Dame Dept of Sociology
      StataNow Version: 19.5 MP (2 processor)

      EMAIL: [email protected]
      WWW: https://academicweb.nd.edu/~rwilliam/

      Comment


      • #4
        Hi, I can confirm there is nothing wrong in your Stata code. I ran the same code in one of my panel datasets and the codes worked fine. I would suggest to run the model only on outcome variables, i.e. leaving out the independent variables and if the model runs properly, you may have to check that you have all independent variables in the data sets that are being used in the codes. i.e. adst*. Look out for spelling.
        Roman

        Comment


        • #5
          The code as shown above may be fine, but it is still a good idea to cut and paste from the actual Stata run. I've seen many times where what people said they typed and what they actually did type were not one and the same.
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          StataNow Version: 19.5 MP (2 processor)

          EMAIL: [email protected]
          WWW: https://academicweb.nd.edu/~rwilliam/

          Comment


          • #6
            Thanks all. Very helpful! I was able to figure it out given your suggestions.

            Comment


            • #7
              Great. So what was the solution, in case anybody else ever has the same problem?
              -------------------------------------------
              Richard Williams, Notre Dame Dept of Sociology
              StataNow Version: 19.5 MP (2 processor)

              EMAIL: [email protected]
              WWW: https://academicweb.nd.edu/~rwilliam/

              Comment


              • #8
                i can not locate the traj command . How do i install the package ?

                Comment


                • #9
                  please help me run tram command . How do i install the package ?

                  Comment


                  • #10
                    net install traj, replace
                    file http://fmwww.bc.edu/RePEc/bocode/s/traj.pkg not found
                    could not load traj.pkg from http://fmwww.bc.edu/RePEc/bocode/s/

                    I get this error message when i try to install traj package

                    Comment


                    • #11
                      https://www.andrew.cmu.edu/user/bjones/index.htm tells you how.

                      You appear to be trying to download it from the s subdirectory of SSC; it certainly isn't there.

                      Comment


                      • #12
                        Here is my command that don't work var(ir1-ir18)

                        traj , model(cnorm) var( ir1-ir18) indep(years1-years18) order( 3 3 3) min(0) max(500)

                        Error: number of variables 256 in var1 and 18 in indep1 must match.
                        r(198);

                        however the following command works,

                        traj , model(cnorm) var(ir*) indep(years*) order(3 3 3) min(0) max(500)

                        ==== traj stata plugin ==== Jones BL Nagin DS, build: Apr 14 2017

                        700 observations read.
                        269 had no trajectory data.
                        431 observations used in trajectory model.


                        Maximum Likelihood Estimates
                        Model: Censored Normal (CNORM)

                        Standard T for H0:
                        Group Parameter Estimate Error Parameter=0 Prob > |T|

                        1 Intercept 0.98903 0.65565 1.508 0.1317
                        Linear 0.24512 0.13814 1.774 0.0762
                        Quadratic -0.00873 0.00887 -0.985 0.3249

                        Could someone help me and tell me more about the * and how to place the data.

                        Thank you,

                        Jenny

                        Comment


                        • #13
                          This appears to be just about varlists. ir* is all variables whose names begin with ir. ir1-ir18 is all the variables between ir1 and ir18 in your data. That could be many, many variables depending on how far ir1 to ir18 occur in sequence with nothing else in between.

                          Here is the same difference on a minor scale.

                          Code:
                          . sysuse auto
                          (1978 Automobile Data)
                          
                          . ds  tr-tu
                          trunk   weight  length  turn
                          
                          . ds  t*
                          trunk  turn

                          Comment


                          • #14
                            Hi Nick,
                            Thank you, I appreciate your help.

                            1- In your opinion, why when I put * it work and I get an output while not for others.

                            traj , model( cnorm ) var( v1hG*) indep(years*) order( 3 3 3) min(0) max(500)
                            Error: number of variables 17 in var1 and 18 in indep1 must match.

                            2- Also, when I write the variables with the numbers (see below) it just doesn't output at all.

                            traj, model( cnorm ) var( bmi1-bmi18) indep(age1-age18) order( 1 1 1) min(0) max(500)
                            Error: number of variables 256 in var1 and 258 in indep1 must match.



                            Comment


                            • #15
                              I thought I had already explained that, but you should test for yourself with

                              Code:
                              ds bmi1-bmi18 
                              di `: word count `r(varlist)''
                              ds age1-age18
                              di `: word count `r(varlist)''
                              and look for a mismatch.

                              Comment

                              Working...
                              X