SPSS Statistics

SPSS Statistics

Your hub for statistical analysis, data management, and data documentation. Connect, learn, and share with your peers! 

 View Only
Expand all | Collapse all

Modifying the output of propensity Score matching with PSMATCHING3

  • 1.  Modifying the output of propensity Score matching with PSMATCHING3

    Posted Wed January 27, 2021 12:18 PM

    I am attempting to run several iterations of the PSMATCHING3 command sequentially. The output of this is partly in the viewer (tables) and partly as a new .sav file. I then need to run a logistic regression on this output file.

    My aim is to repeat the process (propensity score match, then logistic regression on the matched sample) >60 times with a differing "binary treatment indicator". I have had success in the past of running this number of logistic regressions sequentially but these all draw from the same .sav file. Because this process creates new .sav files I am struggling to see how I will chain these together.

    The syntax for the process is as follows:

    PSMATCHING3

    /VARS

    ID = ID

    TREAT = "Binary treatment indicator"

    COVS = "Covariates"

    Osteoporosis

    /MATCHIT

    MATCH=NEAREST

    EST =LOGIT

    DISCARD = BOTH

    MORDER = LARGEST

    RATIO = 1

    CALIPER = 0

    /PLOT RESOLUTION = 96

    /OUTPUT MATCHED.

    The final line selects my output preference. I assume that there is information in the .spe file (the file I installed the PSMATCHING3 extension from) which specifies how this preference is then interpreted to mean I get a separate .sav file as an output.

    I do not know how to edit .spe files and the output command has too few parameters to allow me to modify it to my specifications. Can anybody suggest a work around or a fix for this?

    I am currently using SPSS 22 to do this as the .spe file only works in older versions. I have licensed versions of SPSS 26 and 27 with corresponding R packages and essentials for R but for some reason these throw up an error saying FUZZY is not installed (which it is, and I can see in my extensions) so will not run propensity scoring. These versions do however have output code I could modify to my purposes so if I could get these working I might be able to say goodbye to the old version.

    Sincerely,

    A frustrated ITU doctor who needs a day off.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 2.  RE: Modifying the output of propensity Score matching with PSMATCHING3

    Posted Wed January 27, 2021 03:12 PM

    You have two different ps matching procedures mixed together. PS3MATCHING3 is an R-based extension (not from IBM) and does not use FUZZY. The other one is Python based and uses FUZZY.

    spe files are like zip files and hold all the component files for an extension. Once you have installed it, you can just word with the component files. For PSMATCHING3, that would be PSMATCHING.R. For the other one, the code, not including FUZZY, is in the dialog box that is installed.

    The PSMATCHING3 procedure has keywords MATCHED_CASES_ONLY and PAIRED that determine the content of the sav file.

    The FUZZY-based extension command is not quite a full extension, and the error message you are getting about FUZZY is probably inaccurate as it lumps together several possible failures. You can check for the presence of FUZZY by running this code.

    begin program (or begin program python3 in V27),

    import FUZZY

    end program.

    Neither of these will address the issue of different sav files. But there is an extension command, SPSSINC PROCESS FILES, that can iterate over data files and apply a syntax file to each one. You write a small syntax file that opens data as determined by the PROCESS FILES command and then runs the desired code. PROCESS FILES creates a FILE HANDLE that you use in that syntax file.

    You might do something like

    SPSSINC PROCESS FILES DIRECTORY="c:/mydata/*.sav"

    SYNTAX="c:/myjobs/mysyntax.sps".

    to iterate over all the sav files in a directory running mysyntax.sps for each. You would use a macro or file handle reference in that syntax file to generate a name for the output sav file.

    This would work with either extension. If you want to dig into the FUZZY problem, I would need to see the output file (spv file) that contains the error information (jkpeckSupport Member).






    #SPSSStatistics
    #Support
    #SupportMigration