Stata's PSGRAPH in SPSS?

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

Stata's PSGRAPH in SPSS?

Ives, Melissa L

Is there a way to get a graph in SPSS that is similar to the graph that results from Stata's 'psgraph' command?


(example in: Garrido, M. M., Kelley, A. S., Paris, J., Roza, K., Meier, D. E., Morrison, R. S., et al. (2014). Methods for constructing and assessing propensity scores. Health Services Research, 49(5), 1701-1720. 


Melissa





This correspondence contains proprietary information some or all of which may be legally privileged; it is for the intended recipient only. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this correspondence and completely dispose of the correspondence immediately. Please notify the sender if you have received this email in error. NOTE: Messages to or from the State of Connecticut domain may be subject to the Freedom of Information statutes and regulations.

===================== 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: Stata's PSGRAPH in SPSS?

Bruce Weaver
Administrator
That article appears to be freely available here:

   https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4213057/

I assume you are referring to Figure 1.  



Ives, Melissa L wrote

> Is there a way to get a graph in SPSS that is similar to the graph that
> results from Stata's 'psgraph' command?
>
>
> (example in: Garrido, M. M., Kelley, A. S., Paris, J., Roza, K., Meier, D.
> E., Morrison, R. S., et al. (2014). Methods for constructing and assessing
> propensity scores. Health Services Research, 49(5), 1701-1720.
>
>
> Melissa
>
> ?
>
> ________________________________
>
> This correspondence contains proprietary information some or all of which
> may be legally privileged; it is for the intended recipient only. If you
> are not the intended recipient you must not use, disclose, distribute,
> copy, print, or rely on this correspondence and completely dispose of the
> correspondence immediately. Please notify the sender if you have received
> this email in error. NOTE: Messages to or from the State of Connecticut
> domain may be subject to the Freedom of Information statutes and
> regulations.
>
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

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





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

--
Sent from: http://spssx-discussion.1045642.n5.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
--
Bruce Weaver
bweaver@lakeheadu.ca
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.
Reply | Threaded
Open this post in threaded view
|

Re: Stata's PSGRAPH in SPSS?

Ives, Melissa L
Yes, that is the article and I am asking about Figure 1.

I've run a regular line graph by group.
I'm actually not clear on what Figure 1 shows that is better/clearer than the line graph, so I'm interested to hear thoughts on that as well.

Melissa

________________________________________
From: SPSSX(r) Discussion <[hidden email]> on behalf of Bruce Weaver <[hidden email]>
Sent: Monday, April 30, 2018 10:28 AM
To: [hidden email]
Subject: Re: [SPSSX-L] Stata's PSGRAPH in SPSS?

That article appears to be freely available here:

   https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4213057/

I assume you are referring to Figure 1.



Ives, Melissa L wrote

> Is there a way to get a graph in SPSS that is similar to the graph that
> results from Stata's 'psgraph' command?
>
>
> (example in: Garrido, M. M., Kelley, A. S., Paris, J., Roza, K., Meier, D.
> E., Morrison, R. S., et al. (2014). Methods for constructing and assessing
> propensity scores. Health Services Research, 49(5), 1701-1720.
>
>
> Melissa
>
> ?
>
> ________________________________
>
> This correspondence contains proprietary information some or all of which
> may be legally privileged; it is for the intended recipient only. If you
> are not the intended recipient you must not use, disclose, distribute,
> copy, print, or rely on this correspondence and completely dispose of the
> correspondence immediately. Please notify the sender if you have received
> this email in error. NOTE: Messages to or from the State of Connecticut
> domain may be subject to the Freedom of Information statutes and
> regulations.
>
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

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





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

--
Sent from: http://spssx-discussion.1045642.n5.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

________________________________

This correspondence contains proprietary information some or all of which may be legally privileged; it is for the intended recipient only. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this correspondence and completely dispose of the correspondence immediately. Please notify the sender if you have received this email in error. NOTE: Messages to or from the State of Connecticut domain may be subject to the Freedom of Information statutes and regulations.

=====================
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: Stata's PSGRAPH in SPSS?

bdates

Melissa,


This website for V23.0 has instructions for creating mirrored panel charts. You may want to check there. I did a real simple one, and it worked, but it's done through the chart editor. I've not been able to locate syntax in any of my searches, though.


https://www.ibm.com/support/knowledgecenter/en/SSLVMB_23.0.0/spss/base/idh_webhelp_panel_palette.html


Brian

From: SPSSX(r) Discussion <[hidden email]> on behalf of Ives, Melissa L <[hidden email]>
Sent: Monday, April 30, 2018 11:13:44 AM
To: [hidden email]
Subject: Re: Stata's PSGRAPH in SPSS?
 
Yes, that is the article and I am asking about Figure 1.

I've run a regular line graph by group.
I'm actually not clear on what Figure 1 shows that is better/clearer than the line graph, so I'm interested to hear thoughts on that as well.

Melissa

________________________________________
From: SPSSX(r) Discussion <[hidden email]> on behalf of Bruce Weaver <[hidden email]>
Sent: Monday, April 30, 2018 10:28 AM
To: [hidden email]
Subject: Re: [SPSSX-L] Stata's PSGRAPH in SPSS?

That article appears to be freely available here:

   https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4213057/

I assume you are referring to Figure 1.



Ives, Melissa L wrote
> Is there a way to get a graph in SPSS that is similar to the graph that
> results from Stata's 'psgraph' command?
>
>
> (example in: Garrido, M. M., Kelley, A. S., Paris, J., Roza, K., Meier, D.
> E., Morrison, R. S., et al. (2014). Methods for constructing and assessing
> propensity scores. Health Services Research, 49(5), 1701-1720.
>
>
> Melissa
>
> ?
>
> ________________________________
>
> This correspondence contains proprietary information some or all of which
> may be legally privileged; it is for the intended recipient only. If you
> are not the intended recipient you must not use, disclose, distribute,
> copy, print, or rely on this correspondence and completely dispose of the
> correspondence immediately. Please notify the sender if you have received
> this email in error. NOTE: Messages to or from the State of Connecticut
> domain may be subject to the Freedom of Information statutes and
> regulations.
>
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

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





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

--
Sent from: http://spssx-discussion.1045642.n5.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

________________________________

This correspondence contains proprietary information some or all of which may be legally privileged; it is for the intended recipient only. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this correspondence and completely dispose of the correspondence immediately. Please notify the sender if you have received this email in error. NOTE: Messages to or from the State of Connecticut domain may be subject to the Freedom of Information statutes and regulations.

=====================
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: Stata's PSGRAPH in SPSS?

Andy W
In reply to this post by Ives, Melissa L
Here is an example of pretty much that figure 1.

***********************************************************************************************************************************.
SET SEED 10.
INPUT PROGRAM.
LOOP Id = 1 TO 1000.
END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.
DATASET NAME Sim.
*Covariate.
COMPUTE SymptomBase = RV.UNIFORM(0,4).
*Predicts selection into treatment.
COMPUTE #T = 0.5*SymptomBase + RV.NORMAL(0,1).
COMPUTE Treated = (#T > 2).
FORMATS Treated (F1.0) SymptomBase (F2.1) Id (F4.0).
VALUE LABELS Treated
 0 'Not Treated'
 1 'Treated'
.
EXECUTE.

*Calculating the propensity score.
PLUM Treated WITH SymptomBase /SAVE=ESTPROB.
*EST2_1 is the predicted probability of treatment.

*Now making the side-by-side pyramid, making it on % scale so each is
weighted the same.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=EST2_1 Treated
MISSING=LISTWISE REPORTMISSING=NO
  /GRAPHSPEC SOURCE=INLINE
  /FRAME INNER=YES.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"))
  DATA: EST2_1=col(source(s), name("EST2_1"))
  DATA: Treated=col(source(s), name("Treated"), unit.category())
  COORD: mirror(rect(dim(1,2)))
  GUIDE: axis(dim(1), label("Propensity Score"), delta(0.1))
  GUIDE: axis(dim(1), opposite(), label("Propensity Score"), delta(0.1))
  GUIDE: axis(dim(2), label("Percent"))
  GUIDE: axis(dim(4), gap(0px), opposite())
  GUIDE: legend(aesthetic(aesthetic.color), null())
  SCALE: linear(dim(2), min(0))
  ELEMENT:
interval(position(summary.percent.count(bin.rect(EST2_1*1*1*Treated,
binWidth(0.05)), base.aesthetic(aesthetic(aesthetic.color.interior)))),
color.interior(Treated))
END GPL.
*I needed to edit so the zero part of the Y axis was not shifted slightly
due to my chart template.
***********************************************************************************************************************************.

<http://spssx-discussion.1045642.n5.nabble.com/file/t329824/PropScore.png>

I think a better image is to superimpose the kernel density estimates (so
you forgo making the arbitrary bins at all), which here is an example of
doing that for unequally weighted groups in SPSS, but unfortunately SPSS
smears the weight beyond 0-1, so it is not quite right. See this blog post
of mine that discusses this problem,
https://andrewpwheeler.wordpress.com/2015/07/20/transforming-kde-estimates-from-logistic-to-probability-scale-in-r/.

***********************************************************************************************************************************.
*Making a weighted kernel density plot.
AGGREGATE OUTFILE=* MODE=ADDVARIABLES
  /BREAK Treated
  /TotTreated = N.

*So they have the same weight.
COMPUTE InvTot = 1/TotTreated.
FORMATS InvTot (F3.2).
EXECUTE.

*Now can weight so the areas under the curves are the same.
GGRAPH
  /GRAPHDATASET NAME="graphdataset" VARIABLES=EST2_1 Treated InvTot
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("graphdataset"), weight(weightedVar))
  DATA: weightedVar=col(source(s), name("InvTot"))
  DATA: EST2_1=col(source(s), name("EST2_1"))
  DATA: Treated=col(source(s), name("Treated"), unit.category())
  GUIDE: axis(dim(1), label("Propensity Score"))
  GUIDE: axis(dim(2), label("Kernel Density Estimate"))
  GUIDE: legend(aesthetic(aesthetic.color.interior))
  ELEMENT: line(position(density.kernel.epanechnikov(EST2_1*Treated)),
color(Treated))
END GPL.
***********************************************************************************************************************************.

<http://spssx-discussion.1045642.n5.nabble.com/file/t329824/PropScore1.png>

For some more shameless promotion, you might be interested in these blog
posts on viz:

 - https://andrewpwheeler.wordpress.com/2012/05/20/bean-plots-in-spss/
 -
https://andrewpwheeler.wordpress.com/2012/04/29/comparing-continuous-distributions-of-unequal-size-groups-in-spss/

And these on propensity score matching:

 -
https://andrewpwheeler.wordpress.com/2016/07/11/comparing-samples-post-matching-some-helper-functions-after-fuzzy-spss/
 -
https://andrewpwheeler.wordpress.com/2015/05/20/fuzzy-matching-in-spss-using-a-custom-python-function/



-----
Andy W
[hidden email]
http://andrewpwheeler.wordpress.com/
--
Sent from: http://spssx-discussion.1045642.n5.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
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/