Bruce,With the simple 2X2 table discussed by the OP and a decent sample size, I would expect a standard binary logistic regression model fit via the GENLIN procedure to yield a reasonable standard error. The risk difference test of interest is provided in the EMMEANS Table. A little simulation experiment is provided below my name.Admittedly, I haven't given this a tremendous amount of thought. I'll examine the article and your code when time permits.Ryan--*Generate Data.
SET SEED 98765432.
NEW FILE.
INPUT PROGRAM.
LOOP ID= 1 to 100.
COMPUTE x= rv.bernoulli(0.5).
COMPUTE y = rv.bernoulli(exp(-1.5 + 0.9*x) / (1+ exp(-1.5 + 0.9*x))).
END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.
EXECUTE.
* Generalized Linear Models.
GENLIN y (REFERENCE=LAST) BY x (ORDER=ASCENDING)
/MODEL x INTERCEPT=YES
DISTRIBUTION=BINOMIAL LINK=LOGIT
/EMMEANS TABLES=x SCALE=ORIGINAL COMPARE=x CONTRAST=DIFFERENCE PADJUST=LSD
/MISSING CLASSMISSING=EXCLUDE
/PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION.On Tue, May 28, 2013 at 6:43 PM, Bruce Weaver <[hidden email]> wrote:
It sounds to me as if you want the /risk difference/ (rather than the odds
ratio, for example). If so, you might want to look at this article by
Cheung (2007):
http://aje.oxfordjournals.org/content/166/11/1337.full
I've also included below some syntax I wrote after looking at that article
myself a couple years ago.
HTH.
* ==================================================================
* File: risk difference with robust SEs.SPS .
* Date: 12-May-2011 .
* Author: Bruce Weaver, [hidden email]
* ================================================================== .
* Compute Huber-White robust variance when using
using linear regression to obtain risk difference.
* Macro to define folder with SPSS sample data files.
define !spssdata () "C:\SPSSdata\" !enddefine.
new file.
dataset close all.
get file = !spssdata + "bankloan.sav".
* Variables in model:
Y = default (1=Yes, 0=No)
X1 = Age
X2 = Education (3 indicator variables)
X3 = Debt to Income Ratio
.
select if nmiss(default, age, ed, debtinc) EQ 0.
freq ed.
compute ed1 = (ed EQ 1).
compute ed2 = (ed EQ 2).
compute ed3 = (ed EQ 3).
compute ed45 = any(ed,4,5).
format ed1 to ed45 (f1.0).
crosstabs ed by ed1 to ed45.
graph histogram age.
* Center AGE on 20 (value near the minimum), and make unit 5 years.
compute AGE.20.5 = (age - 20)/5.
graph histogram age.20.5 .
graph histogram debtinc.
* Set unit = 5 for DEBTINC .
compute debtinc.0.5 = debtinc/5.
graph histogram debtinc.0.5 .
* First try GENLIN with LINK=IDENTITY and ERROR=BINOMIAL.
* Generalized Linear Models.
GENLIN default (REFERENCE=FIRST) WITH age ed2 ed3 ed45 debtinc
/MODEL age ed2 ed3 ed45 debtinc INTERCEPT=YES
DISTRIBUTION=BINOMIAL LINK=IDENTITY
/CRITERIA METHOD=FISHER(1) SCALE=1 COVB=MODEL MAXITERATIONS=100
MAXSTEPHALVING=5
PCONVERGE=1E-006(ABSOLUTE) SINGULAR=1E-012 ANALYSISTYPE=3(LR) CILEVEL=95
CITYPE=WALD LIKELIHOOD=FULL
/MISSING CLASSMISSING=EXCLUDE
/PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION.
* There are problems, which is not unusual according to Cheung (2007).
* Now try OLS linear regression -- save fitted values & residuals.
REGRESSION
/STATISTICS COEFF
/DEPENDENT default
/METHOD=ENTER age.20.5 ed2 ed3 ed45 debtinc.0.5
/SAVE PRED (fitted_y) RESID (residual).
* The constant = the risk (of Y being 1) when all explanatory variable = 0.
* The coefficients for the other variables are risk differences associated
* with a one-unit increase in that explanatory variable, controlling for the
others.
* But because the Y-variable is conditionally dichotmous (rather than
contitionally
* normal), the standard errors are not correct. This is why the Huber-White
robust
* errors are needed.
* Run the same model via GENLIN.
GENLIN default WITH AGE.20.5 ed2 ed3 ed45 debtinc.0.5
/MODEL AGE.20.5 ed2 ed3 ed45 debtinc.0.5 INTERCEPT=YES
DISTRIBUTION=NORMAL LINK=IDENTITY
/CRITERIA SCALE=MLE COVB=MODEL PCONVERGE=1E-006(ABSOLUTE) SINGULAR=1E-012
ANALYSISTYPE=3(LR)
CILEVEL=95 CITYPE=WALD LIKELIHOOD=FULL
/MISSING CLASSMISSING=EXCLUDE
/PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION
/SAVE MEANPRED RESID.
* Results match those from REGRESSION very closely--slight
differences are due to use of MLE rather than OLS.
* Note that this model still has incorrect standard errors.
* ---------------------------------------------------------------------- .
* Same model, but with COVB=ROBUST.
* This should give the Huber-White standard errors.
* Reference: https://www-304.ibm.com/support/docview.wss?uid=swg21477323 .
* ---------------------------------------------------------------------- .
GENLIN default WITH AGE.20.5 ed2 ed3 ed45 debtinc.0.5
/MODEL AGE.20.5 ed2 ed3 ed45 debtinc.0.5 INTERCEPT=YES
DISTRIBUTION=NORMAL LINK=IDENTITY
/CRITERIA SCALE=MLE COVB=ROBUST PCONVERGE=1E-006(ABSOLUTE) SINGULAR=1E-012
ANALYSISTYPE=3(LR)
CILEVEL=95 CITYPE=WALD LIKELIHOOD=FULL
/MISSING CLASSMISSING=EXCLUDE
/PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION
/SAVE MEANPRED RESID.
* The coefficients are the same as before, but
* now we have the correct, robust standard errors.
* ================================================================== .
DKUKEC wrote
> Greetings,-----
>
> Is it possible to calculate percent change in 2x2 crosstab? If yes, can
> you please point me in the right direction.
>
> I have a crosstab with two vars (treatment group (1) and control group
> (0)) x (recidivist (1) non-recidivist (0)). I would like to be able to
> generate the percent difference in recivisim between the treatment group
> and the control group, and then percent change between the two vars. I
> have reviewed the archives and internet; however, I was unsuccessful in my
> search.
>
> Thank you,
> Damir
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."
NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Percent-Change-Crosstabs-tp5720440p5720443.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
Free forum by Nabble | Edit this page |