I am using Stata 14.1, I have a dataset obtained via survey, where I have circa. 10 variables which consist of a 1-5 ranking (answers to questions such as: "from 1 to 5, how much do you identify the following statement with Y party?"), circa. 5 which consist on a 0-10 ranking ("from 0 left to 10 right, where do you position Y party?") and demographic variables (gender, age, self positioning on the left-right scale...)
Since the demographic of respondents was not representative in terms of proportions (too many males, too left leaning...) but I had a good amount of responses (circa. 6000) I have also created a weight variable, where it is stated how much weight each observation should have, taking into account known data of gender and left right self positioning.
I want to perform a t testto find out if there is significant difference in means due to gender and membership to a party; and between male and female members of the party. I have come to understand that t test cannot be performed with weights, but I am not aware of any alternatives.
I have tried the following code:
and
I have read of the possibility of using the following code, but I do not know if it is equivalent to a ttest or how to interpret it (how to find out significance).
Any help? Thanks in advance!
Since the demographic of respondents was not representative in terms of proportions (too many males, too left leaning...) but I had a good amount of responses (circa. 6000) I have also created a weight variable, where it is stated how much weight each observation should have, taking into account known data of gender and left right self positioning.
I want to perform a t testto find out if there is significant difference in means due to gender and membership to a party; and between male and female members of the party. I have come to understand that t test cannot be performed with weights, but I am not aware of any alternatives.
I have tried the following code:
Code:
svyset [iw=gndrlrweight] svy: ttest lrPP, by(gndr) svy: ttest liberalism if member==2, by(gndr)
Code:
svyset [iw=gndrlrweight] svy: regttest lrPP, by(gndr)
Code:
svyset [iw=gndrlrweight] test [lrPP]Male = [lrPP]Female
Any help? Thanks in advance!
Comment