[R] user defined covariance structure

From: Jonathan Smith <jon3smith_at_hotmail.com>
Date: Tue 01 Aug 2006 - 00:08:22 EST

I am writing as I am still having trouble trying to define my own covariance matrix. My code is displayed below. I am defining the covariance matrix in the form of an AR1 process so it can be easily checked if working correctly.   Another question I have is if it is possible to define the matrix without giving p a specific value and leaving it in as a coefficient. For the reason that it can be estimated when model is run. I figure that is the way AR1 works in GLS.
Thank you
Jon Smith
I would appreciate any help s I am stuck here and need to figure this out prior to continuing my research.

function ()

peep<-c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4) y<-c(11.78,9.53,11.03,9.89,10.80,8.74,10.25,10.69,5.60,7.27,6.81,4.56,7.01,5.64,6.30,8.31)
#This y data was created from and AR1 model with correlation coefficient
equaling 0.7.

dataframe<-data.frame(yMat,timMat,peepMat) p=0.7

tester2<-corSymm(value = c(p^(1),p^(2),p^(3),p^(1),p^(2),p^(1)),form = ~ timMat|peepMat)
tester2<-Initialize(tester2, data = dataframe) testMat2<-corMatrix(tester2)
# this appears to be working correctly

#smanGls<-gls(yMat~timMat,data = dataframe, corr = corAR1(form =
# works perfectly

smanGls<-gls(yMat~timMat,data = dataframe, corr = corSymm(tester2))


#this is what message I get when I try to use the covarince matrix I
#Error in gls(yMat ~ timMat, data = dataframe, corr = corSymm(tester2)) :
  # false convergence (8)


R-help@stat.math.ethz.ch 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. Received on Tue Aug 01 00:16:38 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 01 Aug 2006 - 02:16:53 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.