read.triangular: Input a Covariance or Correlation Matrix

Description Usage Arguments Value Author(s) See Also Examples

View source: R/GPLv3_or_later.R

Description

This help file and function are essentially copied from read.moments, which is written by John Fox. This function makes it simpler to input covariance (preferable) or correlation matrix to be analyzed. The matrix is input in lower-triangular form on as many lines as is convenient, omitting the above-diagonal elements. The elements on the diagonal may also optionally be omitted, in which case they are taken to be 1. In terms of features that FAiR supports, it is preferable to input the raw data if available, followed by inputting a covariance matrix, and inputting a correlation matrix is a last resort.

Usage

1
2
read.triangular(file = "", diag = TRUE, 
                names = paste("X", 1:n, sep = ""), ...)

Arguments

file

The (quoted) file from which to read the model specification, including the path to the file if it is not in the current directory. If "" (the default), then the specification is read from the standard input stream, and is terminated by a blank line.

diag

If TRUE (the default), then the input matrix includes diagonal elements, which is preferable in FAiR.

names

a character vector containing the names of the variables, to label the rows and columns of the moment matrix.

...

further arguments passed to scan

Value

Returns a square, symmetric covariance or correlation matrix, suitable for input to the covmat argument of make_manifest.

Author(s)

John Fox, with some small changes by Ben Goodrich

See Also

make_manifest

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
R.DHP <- read.triangular(diag=FALSE, names=c("ROccAsp", "REdAsp", "FOccAsp", 
                "FEdAsp", "RParAsp", "RIQ", "RSES", "FSES", "FIQ", "FParAsp"),
                nlines = 9)
    .6247     
    .3269  .3669       
    .4216  .3275  .6404
    .2137  .2742  .1124  .0839
    .4105  .4043  .2903  .2598  .1839
    .3240  .4047  .3054  .2786  .0489  .2220
    .2930  .2407  .4105  .3607  .0186  .1861  .2707
    .2995  .2863  .5191  .5007  .0782  .3355  .2302  .2950
    .0760  .0702  .2784  .1988  .1147  .1021  .0931 -.0438  .2087

R.DHP

## End(Not run)

FAiR documentation built on May 29, 2017, 6:08 p.m.