Announcement

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

  • "factor variables not allowed" error after running qic

    Hi everyone,

    After running
    Code:
    xtset SurveyID_code
    qic CTDI  PracticeScannerID_code PatientWeight Age_year b1.Sex ///
                 i.Contrast kVp ScanLength b2.State b4.PracticeTypeID ////
             , corr(exchangable)
    I've got "factor variables not allowed" error.

    Could you please help me with this?

    Cheers,



  • #2
    -qic- is a user-written command from Stata Journal, not part of official Stata. Using -findit qic- the references are all fairly old, long pre-dating Stata's implementation of factor-variable notation; there do not appear to be any recent updates to it.

    So you will, I'm afraid, have to create your own indicator variables, or use the old -xi- prefix. It also means, unfortunately, that you will not be able to use -margins- afterwards.

    Alternatively, if you know how, you might try to either hack the -qic- code to modify it so it supports factor variables, or write an altogether new command that does what -qic- does but uses modern Stata constructs.

    Sorry I can't give you happier news.

    Comment


    • #3
      I don't want to swear to this because I've spent all of 5 minutes on it, but this may be an easy fix. I changed the syntax line to

      syntax varlist(ts fv) [if] [in] [iw fw pw] ///

      and it seemed to work.

      What I suggest doing is copying the program, calling it qic2, change the program name within the program (to quic2) and change the syntax line as I have shown. Then run some commands with and without using factor variable notation and confirm things are the same. You may have to add fv to other parts of the syntax too, eg. where it says varname.
      -------------------------------------------
      Richard Williams, Notre Dame Dept of Sociology
      Stata Version: 16.0MP (2 processor)

      EMAIL: rwilliam@ND.Edu
      WWW: https://www3.nd.edu/~rwilliam

      Comment


      • #4
        Originally posted by Clyde Schechter View Post
        -qic- is a user-written command from Stata Journal, not part of official Stata. Using -findit qic- the references are all fairly old, long pre-dating Stata's implementation of factor-variable notation; there do not appear to be any recent updates to it.

        So you will, I'm afraid, have to create your own indicator variables, or use the old -xi- prefix. It also means, unfortunately, that you will not be able to use -margins- afterwards.

        Alternatively, if you know how, you might try to either hack the -qic- code to modify it so it supports factor variables, or write an altogether new command that does what -qic- does but uses modern Stata constructs.

        Sorry I can't give you happier news.
        Thanks Clude_ I used -xi- and changed bi to i as well. It works now. At this stage I need to compare QICs for exchangeable and unstructured correlations to choose one of them (smaller means better fit).

        Comment


        • #5
          Originally posted by Richard Williams View Post
          I don't want to swear to this because I've spent all of 5 minutes on it, but this may be an easy fix. I changed the syntax line to

          syntax varlist(ts fv) [if] [in] [iw fw pw] ///

          and it seemed to work.

          What I suggest doing is copying the program, calling it qic2, change the program name within the program (to quic2) and change the syntax line as I have shown. Then run some commands with and without using factor variable notation and confirm things are the same. You may have to add fv to other parts of the syntax too, eg. where it says varname.
          Thanks Richard- unfortunately I'm not good at stata programming. I keep this answer as a precious one and talk you to my supervisor.

          Comment

          Working...
          X