|  | 
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: corr_svy  & covariance matrix for survey data
Thanks Nick. The correlation runs successfully with my data, except  
for one issue, the values for one combination of variables (thkdish by  
trethara) are missing. Any ideas what might have caused this hole in  
the matrix?
. corr_svy lesscurt lessresp poorserv notsmart actfraid thkdisho  
actbettr callnmes trethara follstor [pweight=wgtcent], strata(stratum)  
psu(clust) subpop(dgs1sp) obs sig print(10)
Survey Correlation
pweight:  wgtcent
Strata:   stratum
PSU:      clust
Number of observations: 674
             |          lesscurt    lessresp    poorserv     
notsmart    actfraid    thkdisho    actbettr    callnmes     
trethara    follstor
------------- 
+ 
------------------------------------------------------------------------------------------------------------------------
    lesscurt |      1.0000
             |                 674
             |
             |
   lessresp |      0.8360      1.0000
             |                  674         674
             |            0.0000
             |
  poorserv |      0.4326       0.4556      1.0000
             |                  674             674         674
             |              0.0003      0.0002
             |
   notsmart |      0.5480      0.6199      0.4787      1.0000
             |                  674            674             
674           674
             |             0.0000      0.0000      0.0000
             |
    actfraid |      0.4981      0.5632      0.4310      0.5037       
1.0000
             |                 674            674             
674           674            674
             |           0.0000       0.0000      0.0001      0.0000
             |
  thkdisho |      0.4426      0.4273      0.4048      0.5294       
0.4423      1.0000
             |                 674            674            
674            674            674           674
             |            0.0001      0.0010      0.0001       
0.0011      0.0182
             |
    actbettr |      0.5747      0.6057      0.3899      0.6373       
0.6112      0.4671      1.0000
             |                 674            674            
674            674            674           674            674
             |           0.0000      0.0000      0.0030       
0.0000      0.0000      0.0010
             |
 callnmes |      0.3420      0.3819      0.3722      0.5454       
0.3377      0.3830      0.4690      1.0000
             |                 674            674             
674           674           674            674             
674            674
             |           0.0027       0.0015      0.0000       
0.0001      0.0053      0.0243      0.0026
             |
  trethara |      0.2388      0.3227      0.3974      0.4355       
0.4107                          0.4221      0.7472      1.0000
             |               674            674             
674            674           674                                 
674            674         674
             |         0.0093      0.0050      0.0001       
0.0175      0.0130                           0.0112      0.0001
             |
   follstor |      0.3973      0.4183      0.5286      0.4711       
0.4799      0.3877      0.4689      0.4855      0.5464      1.0000
             |              674            674             
674            674           674            674             
674            674           674            674
             |         0.0000      0.0000      0.0001       
0.0031      0.0000      0.0014      0.0005      0.0029      0.0005
--------------------------------------------------------------------------------------------------------------------------------------
Key: Estimated Correlation
     Number of observations
     Significance Level
Ishtar Govia
[email protected]
On Oct 3, 2008, at 8:32 AM, Nick Winter wrote:
Hi,
-lw- is not an option because listwise is the default.  So simply do  
not specify -pw-, and you will get listwise deletion.
-NW
Ishtar Govia wrote:
Thanks, Nick. The background information on the command and the  
Stata versions was insightful. The recommendations re: getting  
around the limitations of the syntax for the subpop were very  
helpful. I created the single variable (cases either in or out of  
the subpop) and the following code ran successfully.
corr_svy lesscurt lessresp poorserv notsmart actfraid thkdisho  
actbettr callnmes trethara follstor [pweight=wgtcent],  
strata(stratum) psu(clust) subpop(dgs1sp) pw obs sig print(10)
I tried to rerun it specifying a listwise correlation but received  
the following error message:
corr_svy lesscurt lessresp poorserv notsmart actfraid thkdisho  
actbettr callnmes trethara follstor [pweight =wgtcent],  
strata(stratum) psu(clust) subpop(dgs1sp) lw obs sig print(10)
option lw not allowed
r(198);
Is there a reason that lw option for -corr_svy- is not allowed? Or  
is this again something that is specific to the command being a  
version 7 command? Or is there some other command that is used to  
generate the listwise correlation using the -corr_svy-?
On Oct 2, 2008, at 1:02 PM, Nick Winter wrote:
Hi,
I wrote -corr_svy-, so here goes.
There are a couple of things going on here: (1) -corr_svy- is a  
version 7 command, and seems to be having some trouble interacting  
with the way that Stata 10 stores the survey characteristics as  
set by -svyset-.  (2) -corr_svy- uses the older, more limited  
syntax for the -subpop()- option.
Issue (2) means that your subpop option must be specified as a  
single variable name that takes on values 1 or 0 for cases that  
are in or out of your subpopulation, respectively.  If you have a  
complex condition, you must first generate such a variable.
So, the following *should* work, but does not:
. sysuse auto
. svyset rep78 [pw=weight]
. corr_svy mpg price , subpop(foreign) sig
Survey Correlation
pweight:  <none>
Strata:   <one>
PSU:      <observations>
Number of observations: 22
           |         mpg       price
-------------+------------------------
       mpg |      1.0000
           |
           |
     price |     -0.6313      1.0000
           |      0.0042
--------------------------------------
Key: Estimated Correlation
   Significance Level
As indicated in the output, -corr_svy- has ignored the survey  
characteristics.
However, you can specify the survey characteristics in the - 
corr_svy- command itself:
. corr_svy mpg price [pw=weight], psu(rep78) subpop(foreign) sig
Survey Correlation
pweight:  weight
Strata:   <one>
PSU:      rep78
Number of observations: 21
           |         mpg       price
-------------+------------------------
       mpg |      1.0000
           |
           |
     price |     -0.5735      1.0000
           |      0.0344
--------------------------------------
Key: Estimated Correlation
   Significance Level
This gives you what you wanted.
(-corr_svy- will also set the survey characteristics you specify  
in a way that subsequent calls to -corr_svy- can see, so you  
really only need to specify them in the first run.)
What's going on?  With version 9 Stata reworked completely the way  
that survey characteristics are stored, presumably to support the  
enhancements to the survey capabilities (such as supporting  
multiple rounds of sampling).  -corr_svy- uses the un/non- 
documented Stata program -svy_get- to retrieve survey  
characteristics if they are not specified in the command line.   
Unfortunately this is a Stata 8 command, and cannot "see" the  
version 9+ survey characteristics.
In the long run I will fix -corr_svy- to deal with the new survey  
characteristics. In the short run you can simply specify them when  
you run -corr_svy_, or with a call to the version 8 -svyset-, like  
this:
. version 8: svyset ....
As a side effect, this means that -corr_svy- cannot deal with the  
more complex sample specifications allowed with version 9+.
- Nick Winter
Ishtar Govia wrote:
Dear List,
I am using Stata 10/SE 10.1 for Macs. I have two questions. One  
concerning the --corr_svy-- module and error messages I have been  
getting, the second concerning how to obtain a covariance matrix  
for complex survey sample data, within Stata.
I am working with a complex survey sample dataset and am using  
Stata for some preliminary data analyses (univariate and  
multivariate checks for normality, efas) before moving to Mplus  
for SEM modeling. I installed the --corr_svy-- module from within  
Stata by typing "ssc install corr_svy"
However, in my first attempt below, I got the following error  
message:
svy, subpop (if race3cat==2 & sex==1 & (riwyes==1 & riwyes <.)):  
corr_svy lesscurt lessresp poorserv notsmart actfraid thkdisho  
actbettr callnmes trethara follstor, pw obs sig
corr_svy is not supported by svy with vce(linearized); see help  
svy estimation for a list of Stata estimation commands that are  
supported by svy
r(322);
I then attempted to reset the weight and design variables, and  
run the --corr_svy--, following the example in the "help" for the  
--corr_svy--, excluding my subpop specification.
. svyset clust [pweight=wgtcentriw], strata (stratum) ||_n
Note: stage 1 is sampled with replacement; all further stages  
will be ignored
    pweight: wgtcentriw
        VCE: linearized
Single unit: missing
   Strata 1: stratum
       SU 1: clust
      FPC 1: <zero>
. corr_svy lesscurt lessresp poorserv notsmart actfraid thkdisho  
actbettr callnmes trethara follstor, pw obs sig
This worked--but it didn't include my subpop specification. I  
then tried the same thing with my subpop specifcation and it  
DIDN'T work. Any ideas on how to use the corr_svy module to  
obtain the correlation matrix, accounting for the weight and  
design variables and allowing me to restrict my analyses to my  
subpop of interest?
corr_svy lesscurt lessresp poorserv notsmart actfraid thkdisho  
actbettr callnmes trethara follstor [pweight=wgtcent],  
strata(stratum) psu(clust) subpop(if race3cat==2 & sex==1 &  
(riwyes==1 & riwyes <.)) pw obs sig print(10) star(5)
subpop() does not contain a valid varname
r(198);
. svyset clust [pweight=wgtcentriw], strata (stratum) ||_n
Note: stage 1 is sampled with replacement; all further stages  
will be ignored
    pweight: wgtcentriw
        VCE: linearized
Single unit: missing
   Strata 1: stratum
       SU 1: clust
      FPC 1: <zero>
. corr_svy lesscurt lessresp poorserv notsmart actfraid thkdisho  
actbettr callnmes trethara follstor, pw obs sig
In addition, does anyone know how to use the matrix I am trying  
to obtain above to obtain a covariance matrix that can be easily  
transferred to Mplus or LISREL for CFA and SEM analyses?
Thanks for your consideration,
Ishtar Govia
[email protected]
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
--
--------------------------------------------------------------
Nicholas Winter                                 434.924.6994 t
Assistant Professor                             434.924.3359 f
Department of Politics                  [email protected] e
University of Virginia          faculty.virginia.edu/nwinter w
PO Box 400787, 100 Cabell Hall
Charlottesville, VA 22904
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
--
--------------------------------------------------------------
Nicholas Winter                                 434.924.6994 t
Assistant Professor                             434.924.3359 f
Department of Politics                  [email protected] e
University of Virginia          faculty.virginia.edu/nwinter w
PO Box 400787, 100 Cabell Hall
Charlottesville, VA 22904
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/