Hi;

I'm attempting to use variables I extracted from a raster stack

(insect diversity and environmental variables) to construct a SEM

model, but I have a lot of autocorrelation in my data for most of my

variables, but I'm having trouble accounting for it.

I've attempted to do this in two ways, and tried it with my crs as

both WGS84 and laea:

1.make a covariance matrix and incorporate it into the model

I attempted to use the package sesem to construct a covariance matrix

using lag distance bins which is incorporated into the SEM model from

package lavaan. When I followed the tutorial for sesem and ran

'runModels' I got the error message 'sample covariance

matrix is not positive definite'. I suspect that the way my data is

spatially distributed is causing problems with this?

I also did a super hacky thing where I created a vcv(I hope this is

the right term) matrix and then turned into a phylogenetic tree in

using ape and then incorporated it into my model with phylopath (which

I've been using for other path models), but this seems highly illicit.

2. incorporate autocovariate values into the model using spdep

I also tried creating auto-covariate values with spdep. I was able to

account for my auto-correlation when my data was in WGS84 but not laea

(because the numbers are so large?)

My questions are;

Is using autocovariate values a good way to account for

autocorrelation data in path models? I feel more comfortable using the

VCV matrices, but people do do this spdep thing.

If I can use the autocovariate values;

should I create a value for each of my variables which I find

autocorrelation for and include the autocovariates in my model as

exogenous variables with an edge going to each of the variables I

created it with

(i.e. variable1 ~ autocovariate1,

variable2 ~ autocovariate2,

variable3 ~ variable2 + autocovariate3,

variable4 ~ variable1 + variable3 + autocovariate4)

or should I only include the variable for the endogenous variable I am

looking for the causality for?

(i.e. variable3 ~ variable2,

variable4 ~ variable1 + variable3 + autocovariate4)

If the autocovariate values are not appropriate for this model, why

does sesem create a matrix which is not positive definite, and how can

I fix that OR is there another way I can integrate VCV matrices in my

path models?

Thank you for reading this novel, and any solutions you might have for me!

Thank you!

Gwendolyn

_______________________________________________

R-sig-Geo mailing list

[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo