Announcement

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

  • #16
    Nicholas Winter

    Yes, it's less portable. First of all, Python is not part of the Stata distribution (while Java is, and by the way it's currently a JRE from an OpenJDK 11 distribution, the current long term version, which is very good news). Stata relies on the installed Python, which leads to many questions:

    * Is it even installed?
    * Is it a Python2 or a Python3?
    * Is it a Python 32 bits or a Python 64 bits? (I didn't check if 64-bit Stata requires 64-bit Python, it may)
    * Which packages are installed, and which versions?
    * Are extra binaries also required? (it happens with some packages)

    However, IMHO:

    It's not unreasonable to consider that people can install Python freely (less true in corporate/administration/university environments, but it should be doable), and can install necessary packages and keep them up to date.(*)
    It's not unreasonable to consider only Python 3 as it has been here for more than a decade and all maintained data science/machine learning packages are available at least in Python 3.

    There will possibly be some extra work to make Ado/Python packages run, but nothing insurmountable. For Stata it's usually as simple as ssc install, for Python it's usually just pip install.

    (*) There are portable versions of Python, this can solve many issues. For instance IntelPython (based on Anaconda) which is free and comes with numpy/scipy linked with MKL.
    Last edited by Jean-Claude Arbaut; 27 Jun 2019, 08:53.

    Comment


    • #17
      Jean-Claude Arbaut
      As a quick FYI, the JSON thing was already partly available via jsonio.

      Comment


      • #18
        Bill Gould (StataCorp)
        I'm definitely appreciative of the current updates for sure. However, there is one thing that I wish would have been included in the current release (and am a bit surprised to find out that it is a problem): factor variable support for all native Stata commands. I was just trying to test some simulation code out involving ivregress and found that that command doesn't support factor variable notation.

        That aside, I am also pretty stoked about the Python integration, being able to add constraints to IRT models, multigroup IRT, and multiple data sets in memory simultaneously. I had started trying to work on a solution to the multiple data sets in memory simultaneously thing via Mata, but now I can put that to rest since you and the rest of StataCorp already solved it.

        Comment


        • #19
          Can anybody tell about backward compatibility of Stata !6 (dta 119 for Stata 15) i.e. is there any change in data file format? can it be opened in Stata 15 as well without saving as old?

          Thanks & regards,
          Rasool Bux

          Comment


          • #20
            Stata 16, Stata 15, and Stata 14 share the same format
            https://www.stata.com/support/faqs/d...-version/#save

            Comment


            • #21
              I'm getting an error with implementing the python example in my Stata 16/SE version

              I run the below code from a do-file
              Code:
              use http://www.stata-press.com/data/r16/iris, clear
              python:
              from sfi import Data
              import numpy as np
              from sklearn.svm import SVC
              import matplotlib.pyplot as plt
              from mpl_toolkits.mplot3d import Axes3D
              
              # Use the sfi Data class to pull data from Stata variables into Python
              X = np.array(Data.get("seplen sepwid petlen petwid"))
              y = np.array(Data.get("iris"))
              
              # Draw a graph in Python and save as samplepy.png
              fig = plt.figure(1, figsize=(10, 8))
              ax = Axes3D(fig, elev=-155, azim=105)
              ax.scatter(X[:, 0], X[:, 1], X[:, 2], c=y, s=30)
              ax.set_xlabel("Sepal length (.cm)")
              ax.set_ylabel("Sepal width (.cm)")
              ax.set_zlabel("Petal length (.cm)")
              plt.savefig("samplepy.png")
              
              # Use the data to train C-Support Vector Classifier
              svc_clf = SVC(gamma='auto')
              svc_clf.fit(X, y)
              
              # Obtain prediction and store back into new Stata variable irispr
              irispr = svc_clf.predict(X)
              Data.addVarByte('irispr')
              Data.store('irispr', None, irispr)
              end
              
              * See results in Stata
              label values irispr species
              label variable irispr predicted
              tabulate iris irispr, row
              and I get pop up window error that says "This application failed to start because it could not find or load the Qt platform plugin "windows" in ""."

              Any idea on how to work around this?

              Comment


              • #22
                If using Python 3 through Anaconda
                Code:
                python:
                import os os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = "Your\\path\\to\\Anaconda3\\Library\\plugins"
                end

                Comment


                • #23
                  For those interested, do check my short blog entry on the quick setup of Python with Stata 16 https://fintechprofessor.com/2019/06...with-stata-16/
                  Regards
                  --------------------------------------------------
                  Attaullah Shah, PhD.
                  Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
                  FinTechProfessor.com
                  https://asdocx.com
                  Check out my asdoc program, which sends outputs to MS Word.
                  For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

                  Comment


                  • #24
                    Regarding Frame Manager, If I select more than one file from explorer and drag to Stata it uses only last file. There must be an option/prompt for opening them in different frames.

                    For using more than one file via drag and drop/ double click, I think Stata must open them in different frames with frame names as of file names.

                    Someone comment/suggest on this.

                    Regards,
                    asool Bux

                    Comment


                    • #25
                      Rasool Baloch

                      I don't think it's currently possible: drag and drop of a dta file is simply a shortcut for the -use- command (you can check the -use- command is called, in the output window).
                      Of course, it could use the -frame- prefix, but how is Stata supposed to guess you want to put the datafile in a new frame? And I'm not sure I would want this to be the default behavior.

                      A possibility would be to store the frame name together with the dataset when it's not the default one (say, as a characteristic) and automatically load in a frame with this name, when using drag and drop (with maybe a global setting to activate/deactivate this), and leave this as an option of -use- for programmers. That's the closest I see to R's behavior with save/load (variable names are stored in the file), while not getting too much annoying for Stata users.
                      There could be similar options in the various import windows.
                      Just an idea.

                      Comment


                      • #26
                        wbuchanan ivregress should support factor variables notation.

                        If you have an example where ivregress exits with an error stating that factor variable are not supported, please send it to tech support.

                        Comment


                        • #27
                          For what it's worth, I am thrilled that meta-analysis is now fully integrated into Stata! Thanks a lot for adding this new suite.

                          Comment


                          • #28
                            For what it's worth I think Frames is worth the price of admission alone.
                            Thanks.
                            Laurence

                            Comment


                            • #29
                              The meta-analysis kit was surely in my wish list. Great. That said, if I understood right, it gives basically the same we previously had under a mix of two user-written programs. Maybe I got it wrong. I didn’t check it out, but I hope to find something more when fiddling with the newest version.
                              Best regards,

                              Marcos

                              Comment


                              • #30
                                Can the Python installation be on a mapped server in Windows 10? Does it have to be a local installation?

                                Comment

                                Working...
                                X