Hi all,
my question is how to generally deal with python or r code when spss data is weighted (fe weight by var1). As lot of spss syntax supports analysis on weighted data, r code would need some specific ",weight=x" option, code from the survey-package and so on. Is there any option to use active spss weights easily for further analysis in begin programm structures? Thanks for comments. Milko Mumdzhiev |
I do not know what to do about weights in R.
6 times recently people who know some SPSS told me they were using R. When I asked why they said that SPSS could not do what they wanted. When I asked what they wanted to do, it turned out that there were procedures in SPSS to accomplish their goals. YMMV but are you sure you need to use R for this task. R can be great for procedures that are at the developmental forefront of stat but most people are in the mainstream.
Art Kendall
Social Research Consultants |
In reply to this post by Mumdzhiev
You can use the Python or R apis - spss.GetWeightVar
in Python or spssdictionary.GetWeightVariable in R, to get the name of
the current weight variable. Then you can retrieve the values along
with the data you want and process it however is appropriate for your purposes.
Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: Mumdzhiev <[hidden email]> To: [hidden email] Date: 10/22/2014 04:52 AM Subject: [SPSSX-L] python and r codes on weighted spss data file Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi all, my question is how to generally deal with python or r code when spss data is weighted (fe weight by var1). As lot of spss syntax supports analysis on weighted data, r code would need some specific ",weight=x" option, code from the survey-package and so on. Is there any option to use active spss weights easily for further analysis in begin programm structures? Thanks for comments. Milko Mumdzhiev -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/python-and-r-codes-on-weighted-spss-data-file-tp5727668.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 |
Thanks for comments.
The problem we had was running r codes in spss syntax window, while spss data was weighted, and labeled so in the right d corner of the data/variable viewer. As spss points out if and when weights on are discarded for procedures (fe in spss cluster analysis), nobody remind if tables in output from r code output are weighted, and we had some confusion here because of the weighted data label in the data viewer. Switching to spss syntax code may be a solution (if possible), but one should be aware of when you have to. Jon, does it make sense to warn or message out that weights are discarded for r or python codes, as fe in spss cluster analysis is done? Thanks. |
It is up to the R code that is run to check
and issue such a warning. We generally intend to do that but sometimes
forget. Sorry about that.
Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: Mumdzhiev <[hidden email]> To: [hidden email] Date: 10/28/2014 09:27 AM Subject: Re: [SPSSX-L] python and r codes on weighted spss data file Sent by: "SPSSX(r) Discussion" <[hidden email]> Thanks for comments. The problem we had was running r codes in spss syntax window, while spss data was weighted, and labeled so in the right d corner of the data/variable viewer. As spss points out if and when weights on are discarded for procedures (fe in spss cluster analysis), nobody remind if tables in output from r code output are weighted, and we had some confusion here because of the weighted data label in the data viewer. Switching to spss syntax code may be a solution (if possible), but one should be aware of when you have to. Jon, does it make sense to warn or message out that weights are discarded for r or python codes, as fe in spss cluster analysis is done? Thanks. -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/python-and-r-codes-on-weighted-spss-data-file-tp5727668p5727708.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 |
Free forum by Nabble | Edit this page |