? stato filtrato un testo allegato il cui set di caratteri non era indicato... Nome: non disponibile Url: https://stat.ethz.ch/pipermail/r-help/attachments/20071009/365764b4/attachment.pl
On Tue, 2007-10-09 at 16:28 +0200, Niccol? Bassani wrote:> dear R users, I've got kind of strange problem that I can't solve, even > though it's not that difficult. I need to compute the wald-wolfowitz run > test on the residuals from a gee model, and I'm trying to build the > quantities I need by hand. Whereas for the expected and the variance there's > no problem, I do not know how to quantify the number of runs, i.e. the > number of sequences of equal values. > With a short vector like 1 1 1 0 0 1 1 1 1 1 1 it is easy to see 3 > sequences, but my residuals are more than 7000, so it's quite difficult to > trust on eyes only. I'm looking for a way to get this one, but I can't > figure out. > Moreover, i found the wawotest function in the adehabitat package doing this > test, but the results (which is mean, variance...) are different from what I > got by calculatin them by hand so I wanted to finish my calculations to > better understand what's going on. > Any help will be appreciated. Just give me a hint, and I'll do my best to > rule this out... > thanks > niccolLook at ?rle Example:> Vec[1] 1 1 1 0 0 1 1 1 1 1 1> rle(Vec)Run Length Encoding lengths: int [1:3] 3 2 6 values : num [1:3] 1 0 1> length(rle(Vec)$lengths)[1] 3 HTH, Marc Schwartz
this seems to be a good candidate for a \concept{} entry since it is it is not found by help.search("runs") on R version 2.6.0 Under development (unstable) (2007-09-03 r42749). url: www.econ.uiuc.edu/~roger Roger Koenker email rkoenker at uiuc.edu Department of Economics vox: 217-333-4558 University of Illinois fax: 217-244-6678 Champaign, IL 61820 On Oct 9, 2007, at 9:41 AM, Marc Schwartz wrote:> O > > Look at ?rle > > Example: > >> Vec > [1] 1 1 1 0 0 1 1 1 1 1 1 > >> rle(Vec) > Run Length Encoding > lengths: int [1:3] 3 2 6 > values : num [1:3] 1 0 1 > >> length(rle(Vec)$lengths) > [1] 3 > > > HTH, > > Marc Schwartz >
Try: help.search("run") Ravi. ---------------------------------------------------------------------------- ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: rvaradhan at jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html ---------------------------------------------------------------------------- -------- -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of roger koenker Sent: Tuesday, October 09, 2007 11:26 AM To: marc_schwartz at comcast.net Cc: r-help at stat.math.ethz.ch Subject: Re: [R] identify number of sequences from a vector this seems to be a good candidate for a \concept{} entry since it is it is not found by help.search("runs") on R version 2.6.0 Under development (unstable) (2007-09-03 r42749). url: www.econ.uiuc.edu/~roger Roger Koenker email rkoenker at uiuc.edu Department of Economics vox: 217-333-4558 University of Illinois fax: 217-244-6678 Champaign, IL 61820 On Oct 9, 2007, at 9:41 AM, Marc Schwartz wrote:> O > > Look at ?rle > > Example: > >> Vec > [1] 1 1 1 0 0 1 1 1 1 1 1 > >> rle(Vec) > Run Length Encoding > lengths: int [1:3] 3 2 6 > values : num [1:3] 1 0 1 > >> length(rle(Vec)$lengths) > [1] 3 > > > HTH, > > Marc Schwartz >______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.