[R] sample variogram construction

Dan Bebber danbebber at forestecology.co.uk
Mon Oct 25 12:57:22 CEST 2004

Hi Matt,

there are several R packages that will compute the sample variogram for you.
Check out GeoR, sgeostat, nlme, spatial. There's no point in recoding the
whole lot yourself, unless as a learning excercise.


p.s. For time series autocorrelations, you could use acf in package stats.

Message: 9
Date: Mon, 25 Oct 2004 02:02:06 -0400
From: matt.kowgier at utoronto.ca
Subject: [R] sample variogram construction
To: r-help at stat.math.ethz.ch
Message-ID: <1098684126.417c96de334e1 at webmail.utoronto.ca>
Content-Type: text/plain; charset=US-ASCII


Im attempting to build a sample variogram for 300 obersvations of
longitudinal data. So what I need to do is compute the half 
squared differences  between pairs of residuals (for instance if a subject
has 4 obersvations, this is 4 choose 2 paird differences) for each subject.
Also, then I need the corresponding time differences within each individual.
So the end result will be a 300 by 2 matrix with columns corresponding to
paired difference residuals within subject and time differences within
subject. Basically im having trouble coding this kind of matrix in R, if
anyone can help me out or give me some tips id appreciate it.

Stuck in the for loop

More information about the R-help mailing list