Last data update: 2014.03.03

R: Class "manifest"
manifest-classR Documentation

Class "manifest"

Description

It is not necessary to understand this help page if one merely wants to estimate a factor analysis model. This help page is intended for those who want to modify or extend FAiR or otherwise want some idea of how FAiR works “behind the scenes”.

This class contains information in its slots about the left-hand side of a factor analysis model.

Details

In the future, the advantages of formal S4 classes will be exploited more fully. For example, to include a new model in FAiR, the first step might be to define a a new class that extends "manifest" if necessary. Then, appropriate methods for this class would need to be written. Here is a table of the class hierarchy:

Class Parent Class Comment
"manifest" none none (virtual class)
"manifest.basic" "manifest" Can be used for any model
"manifest.basic.userW" "manifest.basic" ADF with user-specified weight matrix
"manifest.data" "manifest.basic" Can be used for any model
"manifest.data.ordinal" "manifest.data" Used when some variables are ordinal
"manifest.data.ranks" "manifest.data" Used when variables are converted to their ranks
"manifest.data.mcd" "manifest.data" Can be used for any model

Objects from the Class

Objects can be created by calls of the form new("manifest", ...). However, it is not recommended to do so in normal usage since make_manifest provides the constructor for users.

Slots

The "manifest" is virtual and has the following slots:

n.obs

An integer indicating the number of observations.

how

A character string indicating how the covariance matrix among the manifest variables was calculated.

call

The call to make_manifest.

An object of class "manifest.basic" inherits from the "manifest" class and has five additional slots:

cov

A sample covariance matrix among manifest variables.

cor

A sample correlation matrix among manifest variables.

sds

A numeric vector containing the square root of the diagonal of the sample covariance matrix.

center

A numeric vector containing the mean of the manifest variables.

diag

A logical indicating whether the diagonal elements of the sample “covariance” matrix are all 1.0.

An object of class "manifest.data" inherits from the "manifest.basic" class and and has four additional slots:

X

A numeric matrix of manifest variables (unstandardized).

wt

A numeric vector whose length is the same as the number of rows in X indicating the weight of each observation in calculating the sample covariance matrix.

acov

An object of dsyMatrix-class from the Matrix package representing an asymptotic estimate of the fourth-order central moments of the data

An object of class "manifest.data.ordinal" inherits from the "manifest.data" but has no additional slots. It is used when some of the manifest variables are ordered factors. Likewise for the "manifest.data.ranks" class which has no additional slots and is used when Spearman correlations are calculated. An object of class "manifest.data.mcd" inherits from the "manifest.data" class and has one additional slot, CovMcd, which is an object of CovMcd-class that is defined in the rrcov package.

Methods

Technically, "manifest" is in the signature of all the model-fitting generic functions documented in S4GenericsFAiR and the same is true for make_restrictions However, at the moment those methods are only defined for the "manifest.basic" class. The following methods are defined for the "manifest.basic" class, but some of them are also defined for inherited classes if their behavior needs to differ in small ways.

cormat

signature(object = "manifest.basic")

model.matrix

signature(object = "manifest.basic"), which also has a standardized = TRUE argument that controls whether the sample correlation matrix or sample covariance matrix is extracted

show

signature(object = "manifest.basic")

plot

signature(x = "manifest.basic", y = "ANY")

screeplot

signature(x = "manifest.basic")

Author(s)

Ben Goodrich

See Also

make_manifest and S4GenericsFAiR

Examples

showClass("manifest")
showClass("manifest.basic")
showClass("manifest.data")
showClass("manifest.data.mcd")
man <- make_manifest(covmat = Harman74.cor)
show(man)
plot(man)
str(man)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(FAiR)
Loading required package: rgenoud
##  rgenoud (Version 5.7-12.4, Build Date: 2015-07-19)
##  See http://sekhon.berkeley.edu/rgenoud for additional documentation.
##  Please cite software as:
##   Walter Mebane, Jr. and Jasjeet S. Sekhon. 2011.
##   ``Genetic Optimization Using Derivatives: The rgenoud package for R.''
##   Journal of Statistical Software, 42(11): 1-26. 
##

Loading required package: gWidgetsRGtk2
Loading required package: RGtk2
Loading required package: gWidgets
Loading required package: cairoDevice
Loading required package: stats4
Loading required package: rrcov
Loading required package: robustbase
Scalable Robust Estimators with High Breakdown Point (version 1.3-11)

Loading required package: Matrix
##  FAiR Version 0.4-15 Build Date: 2014-02-08
## See http://wiki.r-project.org/rwiki/doku.php?id=packages:cran:fair for more info
FAiR  Copyright (C) 2008 -- 2012  Benjamin King Goodrich
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions, namely those specified in the LICENSE file
in the root directory of the source code.
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/FAiR/manifest-class.Rd_%03d_medium.png", width=480, height=480)
> ### Name: manifest-class
> ### Title: Class "manifest"
> ### Aliases: manifest-class manifest.basic-class manifest.basic.userW-class
> ###   manifest.data-class manifest.data.ordinal-class
> ###   manifest.data.ranks-class manifest.data.mcd-class
> ###   cormat,manifest.basic-method model.matrix,manifest.basic-method
> ###   show,manifest.basic-method plot,manifest.basic,missing-method
> ###   screeplot,manifest.basic-method
> ### Keywords: classes
> 
> ### ** Examples
> 
> showClass("manifest")
Class "manifest" [package "FAiR"]

Slots:
                          
Name:      n.obs       how
Class:   integer character

Known Subclasses: 
Class "manifest.basic", directly
Class "manifest.basic.userW", by class "manifest.basic", distance 2
Class "manifest.data", by class "manifest.basic", distance 2
Class "manifest.data.ordinal", by class "manifest.data", distance 3
Class "manifest.data.ranks", by class "manifest.data", distance 3
Class "manifest.data.mcd", by class "manifest.data", distance 3
> showClass("manifest.basic")
Class "manifest.basic" [package "FAiR"]

Slots:
                                                                            
Name:        cov       cor       sds    center      diag     n.obs       how
Class:    matrix    matrix   numeric   numeric   logical   integer character

Extends: "manifest"

Known Subclasses: 
Class "manifest.basic.userW", directly
Class "manifest.data", directly
Class "manifest.data.ordinal", by class "manifest.data", distance 2
Class "manifest.data.ranks", by class "manifest.data", distance 2
Class "manifest.data.mcd", by class "manifest.data", distance 2
> showClass("manifest.data")
Class "manifest.data" [package "FAiR"]

Slots:
                                                                            
Name:          X        wt      acov       cov       cor       sds    center
Class:    matrix   numeric   dMatrix    matrix    matrix   numeric   numeric
                                    
Name:       diag     n.obs       how
Class:   logical   integer character

Extends: 
Class "manifest.basic", directly
Class "manifest", by class "manifest.basic", distance 2

Known Subclasses: "manifest.data.ordinal", "manifest.data.ranks", "manifest.data.mcd"
> showClass("manifest.data.mcd")
Class "manifest.data.mcd" [package "FAiR"]

Slots:
                                                                            
Name:        mcd         X        wt      acov       cov       cor       sds
Class:    CovMcd    matrix   numeric   dMatrix    matrix    matrix   numeric
                                              
Name:     center      diag     n.obs       how
Class:   numeric   logical   integer character

Extends: 
Class "manifest.data", directly
Class "manifest.basic", by class "manifest.data", distance 2
Class "manifest", by class "manifest.data", distance 3
> man <- make_manifest(covmat = Harman74.cor)
Warning message:
In FAiR_make_manifest_list(covmat, shrink) :
  it is strongly preferable to pass the raw data to make_manifest()
> show(man)
Number of observations:  145 
Number of manifest variables:  24 
Proportion of positive correlations:  0.9963768 
p-value for null hypothesis that manifest variables are uncorrelated:  2.399561e-175 
p-value for null hypothesis that the anti-images are uncorrelated:  1.813451e-49 
Kaiser-Meyer-Okin Measure of Sampling Adequacy:  0.8813335 
Kaiser-Meyer-Okin Measure of Homogeneity of Each Manifest Variable
                            [,1]
VisualPerception       0.8978013
Cubes                  0.8426122
PaperFormBoard         0.7799350
Flags                  0.8468740
GeneralInformation     0.8757394
PargraphComprehension  0.8949593
SentenceCompletion     0.8891066
WordClassification     0.9150278
WordMeaning            0.8808171
Addition               0.8085253
Code                   0.8495071
CountingDots           0.8362994
StraightCurvedCapitals 0.8944582
WordRecognition        0.8504097
NumberRecognition      0.8753181
FigureRecognition      0.8896798
ObjectNumber           0.8506564
NumberFigure           0.8842255
FigureWord             0.8327328
Deduction              0.9335137
NumericalPuzzles       0.9090277
ProblemReasoning       0.9258794
SeriesCompletion       0.9070959
ArithmeticProblems     0.9232881

Eigenvalues of sample correlation matrix
 [1] 8.1354441 2.0960408 1.6926049 1.5018343 1.0252044 0.9429365 0.9012169
 [8] 0.8159449 0.7902186 0.7068670 0.6393667 0.5433084 0.5330397 0.5094265
[15] 0.4774630 0.3897347 0.3819639 0.3403650 0.3337787 0.3157519 0.2971980
[22] 0.2681326 0.1896638 0.1724946
> plot(man)
> str(man)
Formal class 'manifest.basic' [package "FAiR"] with 7 slots
  ..@ cov   : num [1:24, 1:24] 1 0.318 0.403 0.468 0.321 0.335 0.304 0.332 0.326 0.116 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : chr [1:24] "VisualPerception" "Cubes" "PaperFormBoard" "Flags" ...
  .. .. ..$ : chr [1:24] "VisualPerception" "Cubes" "PaperFormBoard" "Flags" ...
  ..@ cor   : num [1:24, 1:24] 1 0.318 0.403 0.468 0.321 0.335 0.304 0.332 0.326 0.116 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : chr [1:24] "VisualPerception" "Cubes" "PaperFormBoard" "Flags" ...
  .. .. ..$ : chr [1:24] "VisualPerception" "Cubes" "PaperFormBoard" "Flags" ...
  ..@ sds   : Named num [1:24] 1 1 1 1 1 1 1 1 1 1 ...
  .. ..- attr(*, "names")= chr [1:24] "VisualPerception" "Cubes" "PaperFormBoard" "Flags" ...
  ..@ center: num [1:24] 0 0 0 0 0 0 0 0 0 0 ...
  ..@ diag  : logi FALSE
  ..@ n.obs : int 145
  ..@ how   : chr "unknown"
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>