Using SPSS java plugin to retrive AIC from generalized linear model

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Using SPSS java plugin to retrive AIC from generalized linear model

Luckyluke
Hi SPSS guru,

I have written apiece of code to retrieve AIC from a generalized linear model using JAVA plugin


package spss;

import com.ibm.statistics.plugin.StatsException;
import com.ibm.statistics.plugin.StatsUtil;

/**
 *
 * @author s3911541
 */
public class SPSSJavaPlugin {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
       
        try {
StatsUtil.start();
String[] command={
      "GET",
  "FILE='X:/chapter1/patientanalysis10.sav'.",
 
 
  "OMS SELECT TABLES ",
                        "/IF COMMANDS=['GENLN'] SUBTYPES=['Goodness of Fit'] ",
                        "/DESTINATION FORMAT=OXML XMLWORKSPACE='Goodness_of_Fit' ",
                        "/TAG='fit'.",
                        "GENLIN TrueAdverseEvents (REFERENCE=LAST) WITH sex1 DayOfWeek_Weekends DayOfWeek_Weekday DyOfWeek_Daybeforeafterweekends AdmissionSource_CasualtyAccidentEmerg AdmissionSource_OtherIncludesReferalsfromLMOetc AdmissionSource_WaitingList AdmissionSource_TransferfromOtherAcuteHospExtCareRehabGer AdmissionSource_QualifiedUnqualifiedNewborn AdmissionSource_ChangefromPsychUnitorPsychogeriatric Age add1 bed1 diss1 pe1",
                        "/MODEL sex1 DayOfWeek_Weekends DayOfWeek_Weekday DyOfWeek_Daybeforeafterweekends AdmissionSource_CasualtyAccidentEmerg AdmissionSource_OtherIncludesReferalsfromLMOetc AdmissionSource_WaitingList AdmissionSource_TransferfromOtherAcuteHospExtCareRehabGer AdmissionSource_QualifiedUnqualifiedNewborn AdmissionSource_ChangefromPsychUnitorPsychogeriatric Age add1 bed1 diss1 pe1 INTERCEPT=YES DISTRIBUTION=BINOMIAL LINK=LOGit" ,
                        "/CRITERIA METHOD=FISHER(1) SCALE=1 COVB=MODEL MAXITERATIONS=100 MAXSTEPHALVING=5 PCONVERGE=1E-006(ABSOLUTE) SINGULAR=1E-012 ANALYSISTYPE=3(WALD) CILEVEL=95 CITYPE=WALD LIKELIHOOD=FULL ",
                        "/MISSING CLASSMISSING=EXCLUDE ",
                        "/PRINT FIT",
                        //"OMSEND TAG='fit'."
                                               

   
 };
StatsUtil.submit(command);
//StatsUtil.stop();


String handle = "Goodness_of_Fit";
                        String context = "/outputTree";
                        String xpath = "//category[@text='Akaike's Information Criterion (AIC)']/cell/@text";
                        Double result = Double.valueOf(StatsUtil.evaluateXPath(handle, context, xpath)[0]);
                        StatsUtil.deleteXPathHandle(handle);
}
       
        catch (StatsException e) {
e.printStackTrace();
}
    }
   
}

However, I got exception at the bold line


com.ibm.statistics.plugin.StatsException: Invalid handle object.
        at com.ibm.statistics.plugin.XDAPI.evaluateXPath(Unknown Source)
        at com.ibm.statistics.plugin.StatsUtil.evaluateXPath(Unknown Source)
        at spss.SPSSJavaPlugin.main(SPSSJavaPlugin.java:75)


The reasults for GEnrlized linear model shows coorectly but I think my XPath or other things are wronmg..doesn anyobne can help or have any clue..is my XPATh is correct?

Thanks for any help
Reply | Threaded
Open this post in threaded view
|

Re: Using SPSS java plugin to retrive AIC from generalized linear model

Jon K Peck
The code in the email is too scrambled for me to make sense of, but it appears that you have invalid SPSS variable names in the program.  Names are limited to 64 bytes, and at least one is 75 bytes long.  That would presumably cause the procedure to fail, and there would nothing for OMS to capture for the workspace.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Luckyluke <[hidden email]>
To:        [hidden email]
Date:        09/24/2015 07:37 AM
Subject:        [SPSSX-L] Using SPSS java plugin to retrive AIC from generalized linear model
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi SPSS guru,

I have written apiece of code to retrieve AIC from a generalized linear
model using JAVA plugin


package spss;

import com.ibm.statistics.plugin.StatsException;
import com.ibm.statistics.plugin.StatsUtil;

/**
*
* @author s3911541
*/
public class SPSSJavaPlugin {

   /**
    * @param args the command line arguments
    */
   public static void main(String[] args) {
       // TODO code application logic here
       
       try {
StatsUtil.start();
String[] command={
     "GET",
 "FILE='X:/chapter1/patientanalysis10.sav'.",


                 "OMS SELECT TABLES ",
                                                                                            "/IF COMMANDS=['GENLN'] SUBTYPES=['Goodness of Fit'] ",
                                                                                            "/DESTINATION FORMAT=OXML XMLWORKSPACE='Goodness_of_Fit' ",
                                                                                            "/TAG='fit'.",
                                                                                            "GENLIN TrueAdverseEvents (REFERENCE=LAST) WITH sex1
DayOfWeek_Weekends DayOfWeek_Weekday DyOfWeek_Daybeforeafterweekends
AdmissionSource_CasualtyAccidentEmerg
AdmissionSource_OtherIncludesReferalsfromLMOetc AdmissionSource_WaitingList
AdmissionSource_TransferfromOtherAcuteHospExtCareRehabGer
AdmissionSource_QualifiedUnqualifiedNewborn
AdmissionSource_ChangefromPsychUnitorPsychogeriatric Age add1 bed1 diss1
pe1",
                                                                                            "/MODEL sex1 DayOfWeek_Weekends DayOfWeek_Weekday
DyOfWeek_Daybeforeafterweekends AdmissionSource_CasualtyAccidentEmerg
AdmissionSource_OtherIncludesReferalsfromLMOetc AdmissionSource_WaitingList
AdmissionSource_TransferfromOtherAcuteHospExtCareRehabGer
AdmissionSource_QualifiedUnqualifiedNewborn
AdmissionSource_ChangefromPsychUnitorPsychogeriatric Age add1 bed1 diss1 pe1
INTERCEPT=YES DISTRIBUTION=BINOMIAL LINK=LOGit" ,
                                                                                            "/CRITERIA METHOD=FISHER(1) SCALE=1 COVB=MODEL
MAXITERATIONS=100 MAXSTEPHALVING=5 PCONVERGE=1E-006(ABSOLUTE)
SINGULAR=1E-012 ANALYSISTYPE=3(WALD) CILEVEL=95 CITYPE=WALD LIKELIHOOD=FULL
",
                                                                                            "/MISSING CLASSMISSING=EXCLUDE ",
                                                                                            "/PRINT FIT",
                                                                                            //"OMSEND TAG='fit'."
                                               

   
};
StatsUtil.submit(command);
//StatsUtil.stop();


String handle = "Goodness_of_Fit";
                                                                                            String context = "/outputTree";
                                                                                            String xpath = "//category[@text='Akaike's Information
Criterion (AIC)']/cell/@text";
                                                                                            *Double result = Double.valueOf(StatsUtil.evaluateXPath(handle,
context, xpath)[0]);*
                                                                                            StatsUtil.deleteXPathHandle(handle);
}
       
       catch (StatsException e) {
e.printStackTrace();
}
   }
   
}

However, I got exception at the bold line


com.ibm.statistics.plugin.StatsException: Invalid handle object.
                at com.ibm.statistics.plugin.XDAPI.evaluateXPath(Unknown Source)
                at com.ibm.statistics.plugin.StatsUtil.evaluateXPath(Unknown Source)
                at spss.SPSSJavaPlugin.main(SPSSJavaPlugin.java:75)


The reasults for GEnrlized linear model shows coorectly but I think my XPath
or other things are wronmg..doesn anyobne can help or have any clue..is my
XPATh is correct?

Thanks for any help



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Using-SPSS-java-plugin-to-retrive-AIC-from-generalized-linear-model-tp5730654.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD



===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Using SPSS java plugin to retrive AIC from generalized linear model

David Marso
Administrator
I didn't even notice that!
Maybe try working on useful abbreviations.  These names are a complete joke and would be a complete PITA to work with for any period of time.
AdmissionSource?  Maybe AdmSrc?
NOTE: SPSS Supports VARIABLE LABELS?  
Maybe you DON'T want to have your variable names to be VARIABLE LABELS.
HINT:  Make sure your code works in a regular syntax window before stuffing into a MACRO/Python/Java wrapper!!!
Haven't we been down this road with you previously?
----
Jon K Peck wrote
The code in the email is too scrambled for me to make sense of, but it
appears that you have invalid SPSS variable names in the program.  Names
are limited to 64 bytes, and at least one is 75 bytes long.  That would
presumably cause the procedure to fail, and there would nothing for OMS to
capture for the workspace.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:   Luckyluke <[hidden email]>
To:     [hidden email]
Date:   09/24/2015 07:37 AM
Subject:        [SPSSX-L] Using SPSS java plugin to retrive AIC from
generalized linear model
Sent by:        "SPSSX(r) Discussion" <[hidden email]>



Hi SPSS guru,

I have written apiece of code to retrieve AIC from a generalized linear
model using JAVA plugin


package spss;

import com.ibm.statistics.plugin.StatsException;
import com.ibm.statistics.plugin.StatsUtil;

/**
 *
 * @author s3911541
 */
public class SPSSJavaPlugin {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
 
        try {
StatsUtil.start();
String[] command={
      "GET",
  "FILE='X:/chapter1/patientanalysis10.sav'.",
 
 
                 "OMS SELECT TABLES ",
         "/IF COMMANDS=['GENLN'] SUBTYPES=['Goodness of Fit'] ",
         "/DESTINATION FORMAT=OXML XMLWORKSPACE='Goodness_of_Fit' ",
         "/TAG='fit'.",
         "GENLIN TrueAdverseEvents (REFERENCE=LAST) WITH sex1
DayOfWeek_Weekends DayOfWeek_Weekday DyOfWeek_Daybeforeafterweekends
AdmissionSource_CasualtyAccidentEmerg
AdmissionSource_OtherIncludesReferalsfromLMOetc
AdmissionSource_WaitingList
AdmissionSource_TransferfromOtherAcuteHospExtCareRehabGer
AdmissionSource_QualifiedUnqualifiedNewborn
AdmissionSource_ChangefromPsychUnitorPsychogeriatric Age add1 bed1 diss1
pe1",
         "/MODEL sex1 DayOfWeek_Weekends DayOfWeek_Weekday
DyOfWeek_Daybeforeafterweekends AdmissionSource_CasualtyAccidentEmerg
AdmissionSource_OtherIncludesReferalsfromLMOetc
AdmissionSource_WaitingList
AdmissionSource_TransferfromOtherAcuteHospExtCareRehabGer
AdmissionSource_QualifiedUnqualifiedNewborn
AdmissionSource_ChangefromPsychUnitorPsychogeriatric Age add1 bed1 diss1
pe1
INTERCEPT=YES DISTRIBUTION=BINOMIAL LINK=LOGit" ,
         "/CRITERIA METHOD=FISHER(1) SCALE=1 COVB=MODEL
MAXITERATIONS=100 MAXSTEPHALVING=5 PCONVERGE=1E-006(ABSOLUTE)
SINGULAR=1E-012 ANALYSISTYPE=3(WALD) CILEVEL=95 CITYPE=WALD
LIKELIHOOD=FULL
",
         "/MISSING CLASSMISSING=EXCLUDE ",
         "/PRINT FIT",
         //"OMSEND TAG='fit'."
 

 
 };
StatsUtil.submit(command);
//StatsUtil.stop();


String handle = "Goodness_of_Fit";
         String context = "/outputTree";
         String xpath = "//category[@text='Akaike's Information
Criterion (AIC)']/cell/@text";
         *Double result = Double.valueOf(StatsUtil.evaluateXPath(handle,
context, xpath)[0]);*
         StatsUtil.deleteXPathHandle(handle);
}
 
        catch (StatsException e) {
e.printStackTrace();
}
    }
 
}

However, I got exception at the bold line


com.ibm.statistics.plugin.StatsException: Invalid handle object.
                 at com.ibm.statistics.plugin.XDAPI.evaluateXPath(Unknown
Source)
                 at
com.ibm.statistics.plugin.StatsUtil.evaluateXPath(Unknown Source)
                 at spss.SPSSJavaPlugin.main(SPSSJavaPlugin.java:75)


The reasults for GEnrlized linear model shows coorectly but I think my
XPath
or other things are wronmg..doesn anyobne can help or have any clue..is my
XPATh is correct?

Thanks for any help



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Using-SPSS-java-plugin-to-retrive-AIC-from-generalized-linear-model-tp5730654.html

Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD





=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Using SPSS java plugin to retrive AIC from generalized linear model

Luckyluke
In reply to this post by Jon K Peck
Hi Thanks for the reply,

I got the same error when I shortened the variable name

my commend is as follow:

"GET",
  "FILE='X:/chapter1/patientanalysis10.sav'.",
  "OMS SELECT TABLES ",
  "/IF COMMANDS=['GENLN'] SUBTYPES=['Goodness of Fit'] ",
  "/DESTINATION FORMAT=OXML XMLWORKSPACE='Goodness_of_Fit' ",
  "/TAG='fit'.",
  "DATASET NAME DataSet1 WINDOW=FRONT.",
  "GENLIN TrueAdverseEvents (ORDER=ASCENDING) BY D_Weekends D_Weekday D_Daybeforeafterweekends A_CasualtyAccidentEmerg A_OtherIncludesReferalsfromLMOetc A_WaitingList A_TransferfromOtherAcuteHosp A_QualifiedUnqualifiedNewborn A_ChangefromPsychUnit sex1 (ORDER=ASCENDING) WITH add1 bed1 diss1 pe1 Age ",
  "/MODEL D_Weekends D_Weekday D_Daybeforeafterweekends A_CasualtyAccidentEmerg A_OtherIncludesReferalsfromLMOetc A_WaitingList A_TransferfromOtherAcuteHosp A_QualifiedUnqualifiedNewborn A_ChangefromPsychUnit sex1 add1 bed1 diss1 pe1 Age INTERCEPT=YES",
   "DISTRIBUTION=MULTINOMIAL LINK=CUMLOGIT",
  "/CRITERIA METHOD=FISHER(1) SCALE=1 COVB=ROBUST MAXITERATIONS=100 MAXSTEPHALVING=5",
    "PCONVERGE=1E-006(ABSOLUTE) SINGULAR=1E-012 ANALYSISTYPE=3(WALD) CILEVEL=95 CITYPE=WALD",
    "LIKELIHOOD=FULL",
  "/MISSING CLASSMISSING=EXCLUDE",
  "/PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION."


The output shows the AIC and other information regrding the GENLIN but it cant retrieve the AIC using the xpath..

I have put the complete source file here

can you mention what is wrong with the codes?
Reply | Threaded
Open this post in threaded view
|

Re: Using SPSS java plugin to retrive AIC from generalized linear model

Jon K Peck
I still see variable names that are too long, e.g.,
A_CasualtyAccidentEmerg A_OtherIncludesReferalsfromLMOetc A_WaitingList
which is 71 characters.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Luckyluke <[hidden email]>
To:        [hidden email]
Date:        09/25/2015 07:36 AM
Subject:        Re: [SPSSX-L] Using SPSS java plugin to retrive AIC from generalized linear model
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi Thanks for the reply,

I got the same error when I shortened the variable name

my commend is as follow:

"GET",
 "FILE='X:/chapter1/patientanalysis10.sav'.",
 "OMS SELECT TABLES ",
 "/IF COMMANDS=['GENLN'] SUBTYPES=['Goodness of Fit'] ",
 "/DESTINATION FORMAT=OXML XMLWORKSPACE='Goodness_of_Fit' ",
 "/TAG='fit'.",
 "DATASET NAME DataSet1 WINDOW=FRONT.",
 "GENLIN TrueAdverseEvents (ORDER=ASCENDING) BY D_Weekends D_Weekday
D_Daybeforeafterweekends A_CasualtyAccidentEmerg
A_OtherIncludesReferalsfromLMOetc A_WaitingList A_TransferfromOtherAcuteHosp
A_QualifiedUnqualifiedNewborn A_ChangefromPsychUnit sex1 (ORDER=ASCENDING)
WITH add1 bed1 diss1 pe1 Age ",
 "/MODEL D_Weekends D_Weekday D_Daybeforeafterweekends
A_CasualtyAccidentEmerg A_OtherIncludesReferalsfromLMOetc A_WaitingList
A_TransferfromOtherAcuteHosp A_QualifiedUnqualifiedNewborn
A_ChangefromPsychUnit sex1 add1 bed1 diss1 pe1 Age INTERCEPT=YES",
  "DISTRIBUTION=MULTINOMIAL LINK=CUMLOGIT",
 "/CRITERIA METHOD=FISHER(1) SCALE=1 COVB=ROBUST MAXITERATIONS=100
MAXSTEPHALVING=5",
   "PCONVERGE=1E-006(ABSOLUTE) SINGULAR=1E-012 ANALYSISTYPE=3(WALD)
CILEVEL=95 CITYPE=WALD",
   "LIKELIHOOD=FULL",
 "/MISSING CLASSMISSING=EXCLUDE",
 "/PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION."


The output shows the AIC and other information regrding the GENLIN but it
cant retrieve the AIC using the xpath..

I have put the complete source file  here
<
http://www.megafileupload.com/9oiY/SPSSJavaPlugin.java>  

can you mention what is wrong with the codes?



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Using-SPSS-java-plugin-to-retrive-AIC-from-generalized-linear-model-tp5730654p5730665.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD



===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Using SPSS java plugin to retrive AIC from generalized linear model

Luckyluke
Hi john,

That is three variables not one variable as having spaces between them...

Jon K Peck wrote
I still see variable names that are too long, e.g.,
A_CasualtyAccidentEmerg A_OtherIncludesReferalsfromLMOetc A_WaitingList
which is 71 characters.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:   Luckyluke <[hidden email]>
To:     [hidden email]
Date:   09/25/2015 07:36 AM
Subject:        Re: [SPSSX-L] Using SPSS java plugin to retrive AIC from
generalized linear model
Sent by:        "SPSSX(r) Discussion" <[hidden email]>



Hi Thanks for the reply,

I got the same error when I shortened the variable name

my commend is as follow:

"GET",
  "FILE='X:/chapter1/patientanalysis10.sav'.",
  "OMS SELECT TABLES ",
  "/IF COMMANDS=['GENLN'] SUBTYPES=['Goodness of Fit'] ",
  "/DESTINATION FORMAT=OXML XMLWORKSPACE='Goodness_of_Fit' ",
  "/TAG='fit'.",
  "DATASET NAME DataSet1 WINDOW=FRONT.",
  "GENLIN TrueAdverseEvents (ORDER=ASCENDING) BY D_Weekends D_Weekday
D_Daybeforeafterweekends A_CasualtyAccidentEmerg
A_OtherIncludesReferalsfromLMOetc A_WaitingList
A_TransferfromOtherAcuteHosp
A_QualifiedUnqualifiedNewborn A_ChangefromPsychUnit sex1 (ORDER=ASCENDING)
WITH add1 bed1 diss1 pe1 Age ",
  "/MODEL D_Weekends D_Weekday D_Daybeforeafterweekends
A_CasualtyAccidentEmerg A_OtherIncludesReferalsfromLMOetc A_WaitingList
A_TransferfromOtherAcuteHosp A_QualifiedUnqualifiedNewborn
A_ChangefromPsychUnit sex1 add1 bed1 diss1 pe1 Age INTERCEPT=YES",
   "DISTRIBUTION=MULTINOMIAL LINK=CUMLOGIT",
  "/CRITERIA METHOD=FISHER(1) SCALE=1 COVB=ROBUST MAXITERATIONS=100
MAXSTEPHALVING=5",
    "PCONVERGE=1E-006(ABSOLUTE) SINGULAR=1E-012 ANALYSISTYPE=3(WALD)
CILEVEL=95 CITYPE=WALD",
    "LIKELIHOOD=FULL",
  "/MISSING CLASSMISSING=EXCLUDE",
  "/PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION."


The output shows the AIC and other information regrding the GENLIN but it
cant retrieve the AIC using the xpath..

I have put the complete source file  here
<http://www.megafileupload.com/9oiY/SPSSJavaPlugin.java> 

can you mention what is wrong with the codes?



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Using-SPSS-java-plugin-to-retrive-AIC-from-generalized-linear-model-tp5730654p5730665.html

Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD





=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Using SPSS java plugin to retrive AIC from generalized linear model

PRogman
In reply to this post by Luckyluke
This later version have added the terminating point after the subcommand /PRINT. Did the GENLIN command work in the SPSS Syntax Window?
Your first line ('GENLIN TrueAdverseEvents (ORDER=ASCENDING) BY D_Weekends ...' is 296 characters, and the /MODEL statement is 248. There is a line length limit of 256 bytes after which the command gets truncated. See Help on 'Running Commands'.
Does it work if the variables are on different lines?

  "GENLIN TrueAdverseEvents (ORDER=ASCENDING) ",
  "    BY D_Weekends                   D_Weekday                         D_Daybeforeafterweekends ",
  "       A_CasualtyAccidentEmerg      A_OtherIncludesReferalsfromLMOetc A_WaitingList ",
  "       A_TransferfromOtherAcuteHosp A_QualifiedUnqualifiedNewborn     A_ChangefromPsychUnit ",
  "       sex1 ",
  "       (ORDER=ASCENDING) ",
  "  WITH add1 bed1 diss1 pe1 Age ",
  "/MODEL D_Weekends                   D_Weekday                         D_Daybeforeafterweekends ",
  "       A_CasualtyAccidentEmerg      A_OtherIncludesReferalsfromLMOetc A_WaitingList ",
  "       A_TransferfromOtherAcuteHosp A_QualifiedUnqualifiedNewborn     A_ChangefromPsychUnit ",
  "       sex1 add1 bed1 diss1 pe1 Age ",
  "       INTERCEPT=YES DISTRIBUTION=MULTINOMIAL LINK=CUMLOGIT",
  "/CRITERIA METHOD=FISHER(1) SCALE=1 COVB=ROBUST MAXITERATIONS=100 MAXSTEPHALVING=5",
  "     PCONVERGE=1E-006(ABSOLUTE) SINGULAR=1E-012 ",
  "     ANALYSISTYPE=3(WALD) CILEVEL=95 CITYPE=WALD LIKELIHOOD=FULL",
  "/MISSING CLASSMISSING=EXCLUDE",
  "/PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION.",

Otherwise you should try to abbreviate your variable names and get each command line to be less than 256 characters. You have all 15 variable names (some very long) in both BY and MODEL lines so efficient abbreviation should make difference in both lines.

HTH, PRogman


Luckyluke wrote
Hi Thanks for the reply,

I got the same error when I shortened the variable name

my commend is as follow:

"GET",
  "FILE='X:/chapter1/patientanalysis10.sav'.",
  "OMS SELECT TABLES ",
  "/IF COMMANDS=['GENLN'] SUBTYPES=['Goodness of Fit'] ",
  "/DESTINATION FORMAT=OXML XMLWORKSPACE='Goodness_of_Fit' ",
  "/TAG='fit'.",
  "DATASET NAME DataSet1 WINDOW=FRONT.",
  "GENLIN TrueAdverseEvents (ORDER=ASCENDING) BY D_Weekends D_Weekday D_Daybeforeafterweekends A_CasualtyAccidentEmerg A_OtherIncludesReferalsfromLMOetc A_WaitingList A_TransferfromOtherAcuteHosp A_QualifiedUnqualifiedNewborn A_ChangefromPsychUnit sex1 (ORDER=ASCENDING) WITH add1 bed1 diss1 pe1 Age ",
  "/MODEL D_Weekends D_Weekday D_Daybeforeafterweekends A_CasualtyAccidentEmerg A_OtherIncludesReferalsfromLMOetc A_WaitingList A_TransferfromOtherAcuteHosp A_QualifiedUnqualifiedNewborn A_ChangefromPsychUnit sex1 add1 bed1 diss1 pe1 Age INTERCEPT=YES",
   "DISTRIBUTION=MULTINOMIAL LINK=CUMLOGIT",
  "/CRITERIA METHOD=FISHER(1) SCALE=1 COVB=ROBUST MAXITERATIONS=100 MAXSTEPHALVING=5",
    "PCONVERGE=1E-006(ABSOLUTE) SINGULAR=1E-012 ANALYSISTYPE=3(WALD) CILEVEL=95 CITYPE=WALD",
    "LIKELIHOOD=FULL",
  "/MISSING CLASSMISSING=EXCLUDE",
  "/PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION."


The output shows the AIC and other information regrding the GENLIN but it cant retrieve the AIC using the xpath..

I have put the complete source file here

can you mention what is wrong with the codes?
Reply | Threaded
Open this post in threaded view
|

Re: Using SPSS java plugin to retrive AIC from generalized linear model

Luckyluke
This post was updated on .
Hi,

I have shortened them but still getting the same error ..as I told it shows the results (including AIC) to the console of Netbeans..but not getting the xpath..I think there is something wrong with my XPATh or expression

  "GET ",
  "FILE='X:/chapter1/patientanalysis10.sav'. ",
  "OMS SELECT TABLES ",
  "/IF COMMANDS=['GENLN'] SUBTYPES=['Goodness of Fit'] ",
  "/DESTINATION FORMAT=OXML XMLWORKSPACE='Goodness_of_Fit' ",
  "/TAG='fit'. ",
  "DATASET NAME DataSet1 WINDOW=FRONT.",
  "GENLIN TrueAdverseEvents (ORDER=ASCENDING) BY D_Weekends D_Weekday D_Beforeafterweekends A_Casualty A_ReferalsfromLMO A_WaitingList A_OtherAcuteHosp A_Newborn A_PsychUnit sex1 (ORDER=ASCENDING) WITH Age add1 bed1 diss1 pe1 ",
  "/MODEL D_Weekends D_Weekday D_Beforeafterweekends A_Casualty A_ReferalsfromLMO A_WaitingList A_OtherAcuteHosp A_Newborn A_PsychUnit sex1 Age add1 bed1 diss1 pe1 ",
 "DISTRIBUTION=MULTINOMIAL LINK=CUMLOGIT ",
  "/CRITERIA METHOD=FISHER(1) SCALE=1 COVB=MODEL MAXITERATIONS=100 MAXSTEPHALVING=5 ",
    "PCONVERGE=1E-006(ABSOLUTE) SINGULAR=1E-012 ANALYSISTYPE=3(WALD) CILEVEL=95 CITYPE=WALD ",
    "LIKELIHOOD=FULL ",
  "/MISSING CLASSMISSING=EXCLUDE ",
  "/PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION. "

Reply | Threaded
Open this post in threaded view
|

Re: Using SPSS java plugin to retrive AIC from generalized linear model

Jon K Peck
You have the wrong identifier in your OMS command.  It should look something like
  /IF COMMANDS=['Generalized Linear Models'] SUBTYPES=['Goodness of Fit']


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Luckyluke <[hidden email]>
To:        [hidden email]
Date:        09/28/2015 07:54 AM
Subject:        Re: [SPSSX-L] Using SPSS java plugin to retrive AIC from generalized linear model
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi,

I have shortened them but still getting the same error ..as I told it shows
the results (including AIC) to the console of Netbeans..but not getting the
xpath..I think there is something wrong with my XPATh or expression

 "GET ",
 "FILE='X:/chapter1/patientanalysis10.sav'. ",
 "OMS SELECT TABLES ",
 "/IF COMMANDS=['GENLN'] SUBTYPES=['Goodness of Fit'] ",
 "/DESTINATION FORMAT=OXML XMLWORKSPACE='Goodness_of_Fit' ",
 "/TAG='fit'. ",
 "DATASET NAME DataSet1 WINDOW=FRONT.",
 "GENLIN TrueAdverseEvents (ORDER=ASCENDING) BY D_Weekends D_Weekday
D_Beforeafterweekends A_Casualty A_ReferalsfromLMO A_WaitingList
A_OtherAcuteHosp A_Newborn A_PsychUnit sex1 (ORDER=ASCENDING) WITH Age add1
bed1 diss1 pe1 ",
 "/MODEL D_Weekends D_Weekday D_Beforeafterweekends A_Casualty
A_ReferalsfromLMO A_WaitingList A_OtherAcuteHosp A_Newborn A_PsychUnit sex1
Age add1 bed1 diss1 pe1 ",
"DISTRIBUTION=MULTINOMIAL LINK=CUMLOGIT ",
 "/CRITERIA METHOD=FISHER(1) SCALE=1 COVB=MODEL MAXITERATIONS=100
MAXSTEPHALVING=5 ",
   "PCONVERGE=1E-006(ABSOLUTE) SINGULAR=1E-012 ANALYSISTYPE=3(WALD)
CILEVEL=95 CITYPE=WALD ",
   "LIKELIHOOD=FULL ",
 "/MISSING CLASSMISSING=EXCLUDE ",
 "/PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION. "


I am just outputing the console to a text file and then getting AIC from
that...



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/Using-SPSS-java-plugin-to-retrive-AIC-from-generalized-linear-model-tp5730654p5730680.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD



===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Using SPSS java plugin to retrive AIC from generalized linear model

Luckyluke
Hi,

It doesn't matter.. getting the same error.