Intentional Fail

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

Intentional Fail

ChetMeinzer
Is there a way to create a conditional fail?
This will stop the production and keep it from continuing.  
e.g.
if x=1 causeError.
Reply | Threaded
Open this post in threaded view
|

Re: Intentional Fail

David Marso
Administrator

Perhaps you would provide a bit more context if you expect a response?

ChetMeinzer wrote
Is there a way to create a conditional fail?
This will stop the production and keep it from continuing.  
e.g.
if x=1 causeError.
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
|

Marginal Homogenenity: SPSS vs. Stata

Dale Glaser
Any clarification for the following will be most appreciated (and some of this may just be my semantic misinterpretation).
 
I have a 3 x 3 contingency table for a categorical item measured across two years of test administration.  I tested the relationship of these two variables using the symmetry option in Stata 11,0, and it returns an asymptotic value of 1.5 (p = .682).  In the Stata manual this is referred to as a marginal homogeneity test.  In SPSS, the marginal homogeneity (MH) test is housed under the nonparametric related option, and it returned a MH statistic with a p value of .862.  Referring to the SPSS algorithm documentation, the MH option is for paired ordinal variables, hence I assumed different algorithims were used for the MH options in SPSS and Stata. However, as I just discovered, in the SPSS Crosstabs option there is a McNemar-Browker test and it gave me the same values as Stata. 
 
Making sure I have the proper vernacular, I have seen the marginal homogeneity test used for categorical variables as per examples in the Stata manual and a text by Bishop and Fienberg (Discrete Multivariate Analysis)'.  But the MH option, at least per SPSS, is for ordinal items.  So can I assume that that the MH test can be applied to both nominal and ordinal level data, and one just has to be mindful of which algorithm they apply?
 
thank you very much....Dale Glaser
 
 


Dale Glaser, Ph.D.
Principal--Glaser Consulting
Lecturer/Adjunct Faculty--SDSU/USD/Alliant
3115 4th Avenue
San Diego, CA 92103
phone: 619-220-0602
fax: 619-220-0412
email: [hidden email]
website: www.glaserconsult.com

Reply | Threaded
Open this post in threaded view
|

Re: Marginal Homogenenity: SPSS vs. Stata

Rich Ulrich
You properly describe that the MH test is testing for ordered
alternatives, so I am confused by your actual question at the
end.  Can "MH ... be applied to ... nominal level data...?"   - Sure,
if you want to test the ordered hypotheses.  For the general test
of heterogeneity, No.

The List had a discussion on 5/17/2013 and 5/18/2013 that drew
distinctions between several tests.  Subject:  Repeated Measures
Chi Squared. 
http://spssx-discussion.1045642.n5.nabble.com/Repeated-Measures-Chi-Squared-tt5720309.html

Searching is easier when you correct the spelling to Bowker.

--
Rich Ulrich


Date: Tue, 25 Jun 2013 21:15:44 -0700
From: [hidden email]
Subject: Marginal Homogenenity: SPSS vs. Stata
To: [hidden email]

Any clarification for the following will be most appreciated (and some of this may just be my semantic misinterpretation).
 
I have a 3 x 3 contingency table for a categorical item measured across two years of test administration.  I tested the relationship of these two variables using the symmetry option in Stata 11,0, and it returns an asymptotic value of 1.5 (p = .682).  In the Stata manual this is referred to as a marginal homogeneity test.  In SPSS, the marginal homogeneity (MH) test is housed under the nonparametric related option, and it returned a MH statistic with a p value of .862.  Referring to the SPSS algorithm documentation, the MH option is for paired ordinal variables, hence I assumed different algorithims were used for the MH options in SPSS and Stata. However, as I just discovered, in the SPSS Crosstabs option there is a McNemar-Browker test and it gave me the same values as Stata. 
 
Making sure I have the proper vernacular, I have seen the marginal homogeneity test used for categorical variables as per examples in the Stata manual and a text by Bishop and Fienberg (Discrete Multivariate Analysis)'.  But the MH option, at least per SPSS, is for ordinal items.  So can I assume that that the MH test can be applied to both nominal and ordinal level data, and one just has to be mindful of which algorithm they apply?
 
thank you very much....Dale Glaser
 
 


Dale Glaser, Ph.D.
Principal--Glaser Consulting
Lecturer/Adjunct Faculty--SDSU/USD/Alliant
3115 4th Avenue
San Diego, CA 92103
phone: 619-220-0602
fax: 619-220-0412
email: [hidden email]
website: www.glaserconsult.com

Reply | Threaded
Open this post in threaded view
|

SIGNOFF SPSSX-L

Dwane Allen
In reply to this post by ChetMeinzer

SIGNOFF SPSSX-L
 
Dwane Allen, Ph.D.
 
Reply | Threaded
Open this post in threaded view
|

Re: Intentional Fail

ChetMeinzer
In reply to this post by David Marso
Yes, sometimes its so clear when you are immersed.
clarification:
I'm running code through production mode with a settings 'interrupt processing at error'.
My need is for the code to stop running if a condition is met.  So, we set up a scenario where if two dates are the same, we want the code to stop running, otherwise to continue to other jobs in the same production.  We have it set to stop running upon errors, so if i can create an error, I can stop when the condition is met.  

Thus, I want the syntax to produce an error if a condition is met.  I need will stop the overnight production mode from running more code.

Is there a better method to use in the first place, and is this a job for python?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Intentional Fail

Bruce Weaver
Administrator
I've never used the Production Facility, but if all you need is for an error to occur when the two dates are equal, how about something like this?

COMPUTE @junk@ = 1 / (Date2 - Date1).



ChetMeinzer wrote
Yes, sometimes its so clear when you are immersed.
clarification:
I'm running code through production mode with a settings 'interrupt processing at error'.
My need is for the code to stop running if a condition is met.  So, we set up a scenario where if two dates are the same, we want the code to stop running, otherwise to continue to other jobs in the same production.  We have it set to stop running upon errors, so if i can create an error, I can stop when the condition is met.  

Thus, I want the syntax to produce an error if a condition is met.  I need will stop the overnight production mode from running more code.

Is there a better method to use in the first place, and is this a job for python?

Thanks
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Intentional Fail

Albert-Jan Roskam
In reply to this post by ChetMeinzer
> From: ChetMeinzer <[hidden email]>

> To: [hidden email]
> Cc:
> Sent: Tuesday, June 25, 2013 11:30 PM
> Subject: [SPSSX-L] Intentional Fail
>
> Is there a way to create a conditional fail?
> This will stop the production and keep it from continuing.
> e.g.
> if x=1 causeError.

Like this? You could also use
assert 1 not in record, "oh no, now what?"
or simply raise a RuntimeError or whatever.

dataset declare agg.
compute target = (x eq 1).
aggregate outfile = agg /target = max(target).
begin program.
import spss
class ChetMeinzerError(Exception): pass
try:
    cur = spss.Cursor()
    record = cur.fetchone()[0] # not sure about [0]
    if 1 in record:
        raise ChetMeinzerError("oh no, now what?")
finally:
    cur.close()
    spss.Submit("dataset close agg.")
end program.

=====================
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: Intentional Fail

ChetMeinzer
In reply to this post by Bruce Weaver
close
That gives me a warning, but i need a level 3 error to stop processing.
Reply | Threaded
Open this post in threaded view
|

RE: SIGNOFF SPSSX-L

ChetMeinzer
In reply to this post by Dwane Allen

How am I supposed to use this forum?

 

From: Dwane Allen [via SPSSX Discussion] [mailto:[hidden email]]
Sent: Wednesday, June 26, 2013 9:38 AM
To: Meinzer, Chet BHCS
Subject: SIGNOFF SPSSX-L

 


SIGNOFF SPSSX-L

 

Dwane Allen, Ph.D.

 

 


If you reply to this email, your message will be added to the discussion below:

http://spssx-discussion.1045642.n5.nabble.com/Intentional-Fail-tp5720891p5720904.html

To unsubscribe from Intentional Fail, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: SIGNOFF SPSSX-L

MaxJasper

You can subscribe to: [hidden email]

 

From: ChetMeinzer [via SPSSX Discussion] [mailto:[hidden email]]
Sent: 2013-Jun-26 12:55
To: MaxJasper
Subject: RE: SIGNOFF SPSSX-L

 

How am I supposed to use this forum?

Reply | Threaded
Open this post in threaded view
|

Re: Intentional Fail

Albert-Jan Roskam
In reply to this post by ChetMeinzer
----- Original Message -----
> From: ChetMeinzer <[hidden email]>
> To: [hidden email]
> Cc:
> Sent: Wednesday, June 26, 2013 8:48 PM
> Subject: Re: [SPSSX-L] Intentional Fail
>
> close
> That gives me a warning, but i need a level 3 error to stop processing.

Please post your code/syntax and also consider bottom-posting as this thread is hard to follow, esp. for those who search the archives.

* sample data.
data list free / x (f).
begin data
1
0
0
0
end data.

* code.
dataset declare agg.
compute target = (x eq 1).
aggregate outfile = agg /target = max(target).
dataset activate agg. /* I previously forgot this command.
begin program.
import spss
try:
    cur = spss.Cursor()
    record = cur.fetchone()
    if 1 in record:
        raise RuntimeError("oh no, now what?")
finally:
    cur.close()
    spss.Submit("dataset close agg.")
end program.

Returns the following:
Traceback (most recent call last):
File "<string>", line 9, in <module>
RuntimeError: oh no, now what?

=====================
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