RE: [R] sample variogram construction

2004-10-26 Thread Dan Bebber
Matt,

In this case you are plotting the variogram of the residuals of the lme
object, not of the data themselves. In your model you are assuming a linear
relationship between count and time, with different intercepts and slopes
for your different individuals. You are also assuming that the residuals
exhibit stationarity. The Variogram function *should* work, so I can only
suggest that there is something wrong with your data or code. Mixed-Effects
Models in S and S-Plus by Pinheiro and Bates will probably help.

Dan

Department of Plant Sciences
University of Oxford
South Parks Road
Oxford OX1 3RB
UK
Tel. 01865 275000



 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: 25 October 2004 18:32
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: RE: [R] sample variogram construction
 
 
 Okay thanks!
 No I have the following difficulty implementing a variogram 
 in the nlme package:
 
  cd1 - lme(count ~ time, data=cd4,random= ~ time | id) 
  plot(Variogram(cd1, form= ~ time | id, robust=TRUE))
 Error in as.array(X) : attempt to set an attribute on NULL
 
 Im not sure how to fix this, and apply this function to
 a longitudinal data with unequal times?
 
 Any help would be appreciated
 
 
 Quoting Dan Bebber [EMAIL PROTECTED]:
 
  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.
  
  D
  
  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: [EMAIL PROTECTED]
  Subject: [R] sample variogram construction
  To: [EMAIL PROTECTED]
  Message-ID: [EMAIL PROTECTED]
  Content-Type: text/plain; charset=US-ASCII
  
  Hi
  
  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.
  
  Thanks.
  Stuck in the for loop
  student
  
  
 


__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] sample variogram construction

2004-10-25 Thread Dan Bebber
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.

D

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: [EMAIL PROTECTED]
Subject: [R] sample variogram construction
To: [EMAIL PROTECTED]
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=US-ASCII

Hi

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.

Thanks.
Stuck in the for loop
student

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] sample variogram construction

2004-10-25 Thread matt . kowgier
Okay thanks!
No I have the following difficulty implementing a variogram in the
nlme package:

 cd1 - lme(count ~ time, data=cd4,random= ~ time | id)
 plot(Variogram(cd1, form= ~ time | id, robust=TRUE))
Error in as.array(X) : attempt to set an attribute on NULL

Im not sure how to fix this, and apply this function to
a longitudinal data with unequal times?

Any help would be appreciated


Quoting Dan Bebber [EMAIL PROTECTED]:

 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.
 
 D
 
 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: [EMAIL PROTECTED]
 Subject: [R] sample variogram construction
 To: [EMAIL PROTECTED]
 Message-ID: [EMAIL PROTECTED]
 Content-Type: text/plain; charset=US-ASCII
 
 Hi
 
 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.
 
 Thanks.
 Stuck in the for loop
 student
 


__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html