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

Unable to do Tobit Regression in SPSS 26 due to R Integration

  • 1.  Unable to do Tobit Regression in SPSS 26 due to R Integration

    Posted Tue March 16, 2021 06:18 PM

    Hi, I ran some error when integrating my R to SPSS 26. I've Installed R 3.5.3, SPSS 26.0.0.1 fixpatch, set my R.3.5 Configuration to C:\Program Files\R\R-3.5.3 and this is the error I get in SPSS.

    1. When I try to print hello in SPSS by
    begin program R. print ("hello") end program.

    this is the result

    print ("hello") end program. >Error # 4702 in column 7. Text: ( >An unexpected symbol was encountered on an output command. >Execution of this command stops. >Error # 4702 in column 15. Text: ) >An unexpected symbol was encountered on an output command. >Error # 4700 in column 1. Text: end >An output command contains an unrecognized keyword. The recognized keywords >are OUTFILE, RECORDS, TABLE, NOTABLE ENCODING and BOM. >Error # 4700 in column 5. Text: program >An output command contains an unrecognized keyword. The recognized keywords >are OUTFILE, RECORDS, TABLE, NOTABLE ENCODING and BOM.

    Then, when I try the tobit regression, here's the error:

    SPSSINC TOBIT REGR DEPENDENT = DIVIDEND_PAYOUT_RATIO ENTER = MANAGEMENT_COMPENSATION FreeCashFlow LOWERBOUND=0 DISTRIBUTION=GAUSSIAN /OPTIONS MISSING=LISTWISE /SAVE. Loading required package: car Loading required package: carData Error: package or namespace load failed for 'car' in rbind(info, getNamespaceInfo(env, "S3methods")): number of columns of matrices must match (see arg 2) Error: The R AER package is required but could not be loaded.

    This error looked like my car, carData, and AER is missing or couldn't be loaded. But I've installed all those packages from https://cran.r-project.org/bin/windows/contrib/3.5/ which is reasonable I think.

    Can anyone help me with this issue :( thanks!






    #SPSSStatistics
    #Support
    #SupportMigration


  • 2.  RE: Unable to do Tobit Regression in SPSS 26 due to R Integration

    Posted Tue March 16, 2021 07:36 PM

    On the first point, I suspect that you did not select all three lines to run. You are getting an SPSS error message, which indicates that the begin program r. line was not executed. It's also possible that you had an unterminated command just ahead of this.

    On the second, run this to see if the library packages were really installed in the right place.

    begin program r.

    library(car)

    library(AER)

    end program.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 3.  RE: Unable to do Tobit Regression in SPSS 26 due to R Integration

    Posted Wed March 17, 2021 03:55 AM

    Hi! Thanks for replying!


    So on the first point, you are correct. Now I'm able to print "hello" in my SPSS. Thanks!


    On the second point, I've run your code and here's the result.


    begin program r. 

     

    library(car) 

     

    library(AER) 

     

    end program. 

    Error: package or namespace load failed for 'car' in rbind(info, getNamespaceInfo(env, "S3methods")): 

     number of columns of matrices must match (see arg 2) 

    Loading required package: car 

    Error: package or namespace load failed for 'car' in rbind(info, getNamespaceInfo(env, "S3methods")): 

     number of columns of matrices must match (see arg 2) 

    Error: package 'car' could not be loaded


    seems like the "car" package is the problem. Should I reintsall the car from https://cran.r-project.org/bin/windows/contrib/3.5/ ? I think I've done it with still same error like this. I reinstall it by remove.packages("car") then install it again.






    #SPSSStatistics
    #Support
    #SupportMigration