Announcement

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

  • option mineigen() not allowed

    Hello Stata community, very new user trying to follow a youtube video to run a pca

    I'm able to run a pca and get the screeplot with the following code:
    pca sharksinterested ent_chaos ent_community ent_conscientiousness ent_empathy ent_entrepreneurship ent_failure ent_innovation ent_integrity ent_isolation ent_judgment ent_opportunity ent_optimism ent_order ent_pessimism ent_progress ent_retreat ent_risk ent_sensemaking ent_success ent_transformation ent_uncertainty ent_warmth ent_zeal

    screeplot, yline(1)
    My next step is keeping the Comp with eigen values above 1, a total of 9. I've tried both
    pca $xlist, mineigen(1)
    &
    pca $xlist, components(9)
    Both times I get option mineigen() not allowed or option components() not allowed

    Thanks for the help

  • #2
    Did you define your global macro xlist?


    I wouldn't use a global macro for this by the way.

    Comment


    • #3
      What version of Stata are you using? I guess the video assumes access to a recent version of Stata.
      Last edited by Nick Cox; 13 Apr 2022, 07:39.

      Comment


      • #4
        Jared Greathouse I was not aware I was using a macro

        Nick Cox I'm using Stata 17 BE.

        Comment


        • #5
          The dollar sign means a global macro

          Code:
          gl mymacro aterm
          
          di "$mymacro"
          So, if you didn't define the macro as I did on line 1 above, it is likely the case the PCA throws an error.

          Comment


          • #6
            Jared Greathouse is right. If you didn't define the global macro xlist anywhere then Stata sees

            Code:
            pca, mineigen(1)
            Now pca without a variable list is legal -- it would just replay the last set of results if visible -- except that the options you specified aren't allowed in that case.

            mineigen(1) for example is only allowed with a variable list.

            So you need to define that global or just supply pca with your variable list.



            Comment


            • #7
              Thank you for your help. By learning about macros I also noticed some errors in my data set. It's all working great.

              This is a great community

              Comment


              • #8
                Pleased you're pleased. People can make very different inferences from very small samples. See for example

                https://www.econjobrumors.com/topic/...have-ever-seen

                Comment

                Working...
                X