s-news
[Top] [All Lists]

Re: [S] Looping

To: Lars Karlsson <lars@ana.unibe.ch>
Subject: Re: [S] Looping
From: Prof Brian D Ripley <ripley@stats.ox.ac.uk>
Date: Fri, 21 Aug 1998 09:41:00 +0100 (BST)
Cc: s-news@wubios.wustl.edu
In-reply-to: <3.0.32.19980821091202.0068ec00@130.92.22.10>
Sender: owner-s-news@wubios.wustl.edu
On Fri, 21 Aug 1998, Lars Karlsson wrote:

> Is there a way to avoid the loops below?
> vec is a vector of length n. I want to count the number of instances
> where an element and the next j-th element both equals 1.

This is up to scaling the non-centred acf of the vector vec==1. So you
should be able to adapt the output of acf() for your purpose. That uses
Fortran for the loops. 

[ completely different solution clipped ]

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>