How can I incorporate spatially correlated data into linear mixed effect model which is fitlmematrix method I am trying to use?

1 view (last 30 days)
lme = fitlmematrix(X,y,Z,G,'CovariancePattern','isotrophic','FitMethod','REML')
Here the covariance pattern is for random effect as much as I know. But I want to incorporate spatially correlated data into the model where my error variance would be ~N(0,R). Here R may b Gaussian Correlation function. The model fitlme assumed that error~N(0,sigma^2). So how can I incorporate Gaussian correlation function as error variance matrix here?

Accepted Answer

Gautam Pendse
Gautam Pendse on 6 Feb 2018
Hi Mithun,
One way to approach this problem would be to use fitrgp but with a kernel function that combines Z and R. So if your model is y = X*beta + Z*b + epsilon, you could define Z*b + epsilon as a combined error term with covariance function Z*D*Z' + R which can be coded as a custom kernel function.
I am attaching an example that illustrates this using D = sigmaB^2*I and R as the squared exponential covariance.
Hope this helps,
Gautam

More Answers (1)

Bernhard Suhm
Bernhard Suhm on 26 Jan 2018
The covariance matrix of the response in a linear mixed effects model has 2 components – a random effects component ( sigma^2)*sum_i{ Z_i*D_i*Z_i’} and an error component (sigma^2)*R, where D_i and R are typically block diagonal. These two components can compete in the sense that the same overall covariance can result from a complex random effects component + a simpler error component or a simpler random effects component + a complex error component. In fitlmematrix and fitlme, correlation between groups and observations is modelled by specifying Z_i and D_i whereas R is assumed to be the identity matrix. Depending on the structure of R, the same model could be obtained by selecting appropriate Z_i and D_i. Can you say more about the structure of R in the model? An alternative to modeling spatially correlated data would be to use Gaussian processes (see function fitrgp).

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by