Learn R Programming

sesem (version 1.0.1)

make.covar: Function to calculate covariance matrices for a set of lag distance bins

Description

calculates variance covariance matrices for each lag distance bin and for a flat (non-spatial) bin

Usage

make.covar(datafile,dist.mat,binsize,binname)

Arguments

datafile
a dataset where the first two columns are x and y coordinates. Further columns contain observed variables for subsequent sesem modeling.
dist.mat
a vector containing distances between all X-Y sample pairs in a dataset. Produced by function calc.dist.
binsize
A vector of bin size cutoff distances starting with zero. Produced using make.bin
binname
A character vector of bin names. This vector has one element less than binsize.

Value

  • 1A bin summary with colums binname, lower cutoff distance, upper cutoff distance, and sample size
  • 2A list of observed variable names
  • 3the flat (non-spatial) variance-covariance matrix
  • 4contains elements [[4]][,,i] where each i is the variance - covariance matrix for a particular lag distance bin

Details

Calculates variance-covariance matrices for a series of lag distance bins and for a flat (non-spatial) bin. This function produces a list object with four components: [[1]]bin.summary, [[2]] variable names [[3]] flat covariance matrix, [[4]][,,i] covariance matrices for each bin i. A summary of the bins is printed.

References

Lamb, E. G., K. Mengersen, K. J. Stewart, U. Attanayake, and S. D. Siciliano. Submitted. Spatially explicit structural equation modeling. Ecology.

See Also

make.bin, make.covar, runModels

Examples

Run this code
data=truelove
truelove_red<-truelove[c(1:60),c(1:5)]
distancematrix<-calc.dist(truelove_red)

#calc.dist and make.covar can be time consuming to run, 
# therefore only a small dataset utilized here

Truelove_bins<-make.bin(distancematrix,type="ALL",p.dist=5)
binsize<-Truelove_bins[1][[1]] #truelove lowland bin sizes
binname<-Truelove_bins[2][[1]] #truelove lowland bin names

covariances<-make.covar(truelove_red,distancematrix,binsize,binname)
covariances

Run the code above in your browser using DataLab