Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: how to compare the values of a variable at different observations


From   sarah smith <[email protected]>
To   [email protected]
Subject   st: how to compare the values of a variable at different observations
Date   Mon, 18 Jul 2005 10:55:14 -0400

Dear STATA users,

I wonder how I can compare the values of a variable, say var1, at
different observations? (In particular I want to do regressions such
as the one below)

if var1(at line 2) = var1(at line 10 ) {

regress y x in 2/10
}

Thanks for suggestions,
Sarah


On 7/18/05, Jeff Pitblado, StataCorp LP <[email protected]> wrote:
> Alexander Cavallo <[email protected]> asks two general questions
> about the survey data capabilities in Stata:
> 
> 1.  What happens when you use -svy jackknife- with data from a design with 2
> PSUs in each stratum?
> 
> 2.  Why isn't there a -svyclogit- command?
> 
> *****************************************************************************
> Question 1:
> 
> > I am using complex survey data with stratified and clustered design.  I
> > have over 200 strata and 2 PSUs per strata (or are these clusters??).
> >
> > If I want to use the delete 1 jackknife for variance estimation, wouldn't
> > each replication involve a strata with a singleton PSU?
> 
> Yes.  However -svy jackknife- uses the "replicated" point estimates from the
> delete-1 fits to compute it's own variance estimator for the model parameters.
> These delete-1 fits do not employ the linearized variance estimator; in fact,
> the variance from each of these delete-1 fits are entirely discarded.
> 
> > Can I do jackknife variance estimation in this case?
> 
> Yes, the above procedure works.
> 
> > Could I drop an entire strata and use the jackknife calculations for delete
> > 1 strata instead?
> 
> Only if you change the way you -svyset- your data.  I'm not recommending this,
> but you could treat your strata variable as a PSU variable in your -svyset-,
> then -svy jackknife- will delete your strata instead of the PSUs.
> 
> *****************************************************************************
> Question 2:
> 
> > I am interested in estimating the CLOGIT model with complex survey data. I
> > am estimating a choice model with some variables that are attributes of
> > the choice X(j) and others that are characteristics of the individual
> > Z(i).
> >
> > The model is
> >
> > Pr(i choses j) = exp[beta*X(j) + gamma(j)*Z(i)] / sum k=1 to M {
> > exp[beta*X(k) + gamma(k)*Z(i)}
> >
> > The model can be estimated by converting the data to long format where
> > each observation becomes M observations with a single instance of the
> > indicator S=1 for the chosen category.  To estimate the gamma(j)
> > paramaters I need to create interactions of Z(i) with with dummy variables
> > for the choices.
> >
> > I am planning to use jackknife deletion of one PSU to estimate the
> > variance of the parameter vector.
> >
> > My questions are:
> >
> > Why is there no svyclogit - is there a theoretical reason that it is not
> > implemented?
> 
> No.  Until recently there were some technical reasons why we hadn't
> implemented -svy: clogit-.  I can make no guarantee, or even give a timeline;
> but we are working to get the -svy- prefix to work with other estimation
> commands, including -clogit-.
> 
> For the time being, you can use -svy jackknife- with -clogit- in the following
> way:
> 
> 1.  Make sure to -svyset- using -iweights- instead of -pweights-, -clogit-
> currently will not accept -pweights-.
> 
> 2.  Prefix your call to -clogit- with -svy jackknife _b:-, this will bypass
> -svy jackknife-'s check for supported estimation commands.  This allows users
> to experiment with -svy-'s resampling methods on commands that are not
> identified as supported.
> 
> 3.  Use -svy- to replay the estimation results, -clogit- does not recoginize
> survey estimation results and does not display a proper header.
> 
> --Jeff
> [email protected]
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index