I am working on a custom CorStruct class based on CorCompSymm. There will be a single parameter passed into the class for optimization, like rho.The grouping will be ~ 1 | Subject. Initially i plan to use this with gls but ultimately would like to extend to lme also.
The complication in this case is that the calculation of the correlation matrices requires another fixed parameter that varies between pairs of repeated observations within each subject - this will be passed into the functions as a numerical lower.tri() vector. Within corMatrix I need to be sure that I am applying the correct parameter value from the vector to the correct pair of observations for the within-Subject correlation matrix.
For example: in a Subject with 3 observations, fixparam[1,2] = fixparam[2,1] = 0.25; fixparam[1,3] = param[3,1] = 0.125, etc.
(this is a genetics application but I?m keeping genetics out of the discussion).