[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Alexandru Voicu" <voicu@iza.org> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: programming help |

Date |
Tue, 22 Feb 2005 15:12:25 +0100 |

Yes. -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Seb Buechte Sent: Tuesday, February 22, 2005 3:08 PM To: statalist@hsphsun2.harvard.edu Subject: Re: st: programming help So would this work out to look like the following, correct? 1) attach rank vector to X an Y 2) sort X descending 3) sort Y ascending 4) Loop over the elements while Yi is greater than Xi and save the larger values including its rank to a result matrix 5) sort the result matrix according to the ranks of its elements On Tue, 22 Feb 2005 14:55:54 +0100, Alexandru Voicu <voicu@iza.org> wrote: > Not really. If the ordering is important, you can attach a rank vector > to result matrix result = rank~X, sort it according to the elements of > x, then do the whole thing for the second column of the result matrix, > then resort it with respect to its first column. > > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Seb Buechte > Sent: Tuesday, February 22, 2005 2:51 PM > To: statalist@hsphsun2.harvard.edu > Subject: Re: st: programming help > > I am wondering: do you need to preserve the order of elements in your > vector(s)? In that case sorting etc. will not help and the whole > problem remains more complex... > > seb > > On Tue, 22 Feb 2005 07:58:17 -0500, MITRA PINAKI (MAR1PXM) > <mar1pxm@ups.com> wrote: > > Dear all, > > > > I am struggling with the following problem and wondering if I > > can get any help on this. I have two row vectors, X=(x11, x21, x31, > > ..., xn1)' and Y=(y11, y21, y31, ..., yn1)' where n=300 (I have 300 > > elements in each of the row vectors). My problem is the following: > > 1) I need to calculate the largest value of Y and the smallest value > > of X. 2) If the largest value of Y is grater than the smallest value > > of X, replace the smallest value of X by the largest value of Y. 3) > > At the next step, ignore the previous largest value of Y and find > > the largest from the rest of the 299 elements of Y. Also for X, find > > the smallest value of X from the rest of the 299 elements of X and > > if the largest value of Y is grater than the smallest value of X, > > replace the > > > smallest value of X by the largest value of Y. 4) The loop stops > > when the largest value of Y from the rest of Y elements is less than > > equal to the smallest value of X from the rest of X elements. 5) > > Construct the new X vector (X_NEW) with the new elements of Y after > > replacement keeping the unchanged elements of X. > > > > My problem is that I am not able to construct the loop correctly and > > getting no where. Thank you for your help. > > > > Pinaki > > > > _____________________________ > > Pinaki Mitra > > UPS Capital > > 35 Glenlake Parkway, NE > > Atlanta, GA 30345 > > Office: (404) 828-6759; 5-490-6759 (UPS Atlas) > > Fax: (404) 828-6660 > > Cell: (404) 668-6575 > > Web: www.upscapital.com > > > > * > > * 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/ > > > > -- > - Seb F Buechte > - > - Stay in touch! > * > * 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/ > -- - Seb F Buechte - - Stay tuned! * * 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/

**References**:**Re: st: programming help***From:*Seb Buechte <sfbuechte@gmail.com>

- Prev by Date:
**RE: st: programming help** - Next by Date:
**Re: st: RE: nonsense category in ordered logit** - Previous by thread:
**Re: st: programming help** - Next by thread:
**Re: st: programming help** - Index(es):

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