Announcement

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

  • XTCSD command gives error 133 "unknown function *sqrt()"

    Hi everyone,
    I am currently working with a dataset with panel data (t=12, N=290) and would like to test for cross-sectional independence. I installed xtcsd on my STATA MP 14.2 but when I run the command I get following results:

    . xtcsd, frees
    "There are not enough common observations to perform Frees or Friedman tests" (Ok, I assume this is due to strongly unbalanced panel, should be ok to apply a pesaran test, right?)

    . xtcsd, pesaran
    "unknown function *sqrt()"
    r(133);

    I read about other people receiving this error message, but I have also read statalisters (e.g. http://www.statalist.org/forums/foru...-user-of-stata) admittedly running the command and receiving output without error message.

    Does anyone know of any remedy regarding this problem?

    Best regards,
    Hanna

  • #2
    As there is a function sqrt() the problem will be something related. It's my guess that one or more of the arguments fed to an expression that includes a sqrt() call is undefined, and Stata is puzzled.

    You haven't given us a reproducible example but you're already flagging a dataset that might be problematic. If you


    Code:
    set trace on 
    set traced 1
    and run your code again and show us the few lines of output before it stops, then we will see precisely what the program is choking on.

    Comment


    • #3
      The problem disappeared now that I ran it again. I must have misspecified something the first time. Thanks anyway!

      Comment


      • #4
        what are their codes, please?

        1) Pesaran, Ullah and Yamagata (2008) Cross Section Dependence Test

        2) Pesaran (2007) Panel Unit Root Test.


        Comment


        • #5
          https://www.statalist.org/forums/for...nce-fe-re-pols #13 answers the first question in #4 and gives generic advice on how (not) to post.

          Comment


          • #6
            Originally posted by Nick Cox View Post
            As there is a function sqrt() the problem will be something related. It's my guess that one or more of the arguments fed to an expression that includes a sqrt() call is undefined, and Stata is puzzled.

            You haven't given us a reproducible example but you're already flagging a dataset that might be problematic. If you


            Code:
            set trace on
            set traced 1
            and run your code again and show us the few lines of output before it stops, then we will see precisely what the program is choking on.
            Hi,

            I have the same problem with the command xtcd as below.

            . xtcd wPJUN
            unknown function *sqrt()
            r(133);

            As you told I code set trace on and set traced 1 and then run the code again. The few lines of output before it stops are as below;

            mat `vmM'[`m',1] = `vm'
            mat `absvmM'[`m',1]= `absvm'
            local nobs = `C'`name'[1,1]
            local avg_obs = `nobs'/(`ng'*(`ng'-1))
            local corr_coeff = `ng'*(`ng'-1)
            mat `avg_obsM'[`m',1] = `avg_obs'
            mat `numb_coeffM'[`m',1] = `corr_coeff'
            mat `n_obsM'[`m',1]= `nobs'
            }
            restore

            Comment


            • #7
              xtcd is from SSC, as you are asked to explain. What you show us has no obvious relation to the problem as the square root function isn't shown.

              I think what's happening is that your data don't yield a particular correlation and that's not being trapped by the code.

              I'd suggest contacting the author directly (Google for his current address). He's likely to want to see your dataset.

              Comment


              • #8
                What do you get when you use xtcd2 or xtcdf instead?

                Comment


                • #9
                  Hi,

                  Results of the commands xtcd2 and xtcdf are as follows;

                  xtcdf wPJUN

                  xtcd test on variables wPJUN
                  Panelvar: ID
                  Timevar: YEAR
                  ------------------------------------------------------------------------------+
                  Variable | CD-test p-value average joint T | mean ρ mean abs(ρ) |
                  ----------------+--------------------------------------+----------------------|
                  wPJUN + 177.001 0.000 8.18 + 0.13 0.34 | 38144 combinations of panel units ignored (insufficient joint
                  > observations).
                  ------------------------------------------------------------------------------+
                  Notes: Under the null hypothesis of cross-section independence, CD ~ N(0,1)
                  P-values close to zero indicate data are correlated across panel groups.


                  xtcd2 wPJUN
                  Pesaran (2015) test for weak cross sectional dependence
                  Error: no sample set

                  Comment


                  • #10
                    Hi again,

                    I am a little bit confused with the terms unbalanced panel data and the gaps in the sample. Could you please tell me what is the difference?

                    I know that in an unbalanced panel dataset, some ID's do not data for all time periods. For example, my dataset contains some firms with 5 year data and some with 15 year data. But there is no missing data for a specific year in my dataset.

                    Because I have a an unbalanced panel dataset I choose the tests suitable for unbalanced panel datasets. However, I get an error message as "sample may not contain gaps" when I run some commands as pescadf, xtcips etc. What does this error message mean? And if this is something that I cannot fix, which commands I should use for second generation unit root test for an unbalanced panel dataset with some gaps?

                    Comment


                    • #11
                      Sinem: New topic means new thread. Your general question is utterly unrelated to previous posts in this thread. Please start a new thread.

                      Comment


                      • #12
                        Originally posted by Sinem Ates View Post
                        Hi,

                        Results of the commands xtcd2 and xtcdf are as follows;

                        xtcdf wPJUN

                        xtcd test on variables wPJUN
                        Panelvar: ID
                        Timevar: YEAR
                        ------------------------------------------------------------------------------+
                        Variable | CD-test p-value average joint T | mean ρ mean abs(ρ) |
                        ----------------+--------------------------------------+----------------------|
                        wPJUN + 177.001 0.000 8.18 + 0.13 0.34 | 38144 combinations of panel units ignored (insufficient joint
                        > observations).
                        ------------------------------------------------------------------------------+
                        Notes: Under the null hypothesis of cross-section independence, CD ~ N(0,1)
                        P-values close to zero indicate data are correlated across panel groups.


                        xtcd2 wPJUN
                        Pesaran (2015) test for weak cross sectional dependence
                        Error: no sample set
                        I think you need to add the option ", noest" to xtcd2 for it to work.

                        Comment


                        • #13

                          . xtcd2 wPJUN, noest
                          Pesaran (2015) test for weak cross sectional dependence
                          Unbalanced panel detected, test adjusted.
                          H0: errors are weakly cross sectional dependent.
                          CD = 189.173
                          p-value = 0.000

                          Yes, now the command xtcd2 works. So, xtcdf and xtcd2 show cross sectional dependence, am I right? Do you have any idea why I get the error message "unknown function *sqrt()" when I run the xtcd command instead of xtcd2 or xtcdf? I get the same error when I run the xtcsd, pesaran following fixed effect model.

                          Comment


                          • #14
                            If you look at the output from the xtcdf command, you see that 38144 combinations of panel units were ignored because there were insufficient joint observations. This might have broken the xtcd and xtcsd commands. Note that in my experience, the xtcd2 command produces incorrect CD-statistics in unbalanced panels, whereas xtcdf stays correct (they should produce the same output).

                            Comment


                            • #15
                              Hi, I am trying to test cross-sectional dependence test by Pesaran (2004) and used this state command XTCD . I got the following two errors

                              1- Error: The panel is highly unbalanced.
                              Not enough common observations across panel to perform Pesaran's test.
                              insufficient observations

                              2- unknown function *sqrt()..

                              Does anyone know to solve these problems?

                              Thanks

                              Comment

                              Working...
                              X