ZOLD-gmData: Old: Class "gmData" graphical meta data

zzz-gmDataR Documentation

Old: Class "gmData" graphical meta data

Description

A common class for representing data. No matter the actual representation of data, the important characteristics are contained in a graphical metadata object.

Usage

newgmData(varNames,
                   varTypes=rep(validVarTypes()[1],length(varNames)),
                   nLevels=NULL,
                   latent=NULL,
                   valueLabels=NULL,
                   observations=NULL,
                   description=NULL,
                   shortNames=NULL
                   )

Arguments

varNames

a vector of strings with names of variables.

varTypes

a vector of strings with values from validVarTypes giving the types of the variables; typical types are "Discrete","Ordinal","Continuous", but others can be defined. The types can be abbreviated.

nLevels

a numeric vector with integer values for discrete or ordinal variables giving the number of levels.

latent

a vector of strings with names of the latent variables.

valueLabels

a list of vectors of strings with names of the levels for each discrete or ordinal variable.

observations

an object containing the observations, eg. a dataframe or a table.

description

a string describing the origin of the data.

shortNames

a vector of strings giving a short name of each variable.

Details

If neither nLevels nor valueLabels are given, then all categorical variables are assumed to be binary. If valueLabels are given then nLevels are infered from these. valueLabels / nLevels are recycled if necessary.

Value

An object of class gmData holds information about the data and can be retrieved and changed by accessor functions.

Objects from the Class

Objects can be created by calls of the form newgmData( varNames, varTypes, nLevels, latent, valueLabels, observations, description).

More often, gmData objects will be created from a data.frame or table.

A gmData object contains the abstraction of data into a meta data object including variable names and types etc. However, the actual data might not be present or may be represented by a reference to data, such as a database file. Also, it may be possible to work without data, which may be valuable if the point of interest is in the model alone. Separating the specification of the variables from data has the benefit, that some properties of a model can be investigated without any reference to data, for example decomposability and collapsibility.

Author(s)

Søren Højsgaard, sorenh@math.aau.dk,
Claus Dethlefsen, dethlef@math.aau.dk

See Also

demo(gmData)

Examples


vn <- c("a","b","c","d")
z<-newgmData(vn,varTypes=c("dis","dis","con","con"))
summary(z)
z<-newgmData(vn,varTypes=c("dis","dis","con","con"),nLevels=c(4,3,NA,NA))
summary(z)
z<-newgmData(vn,varTypes=c("dis","dis","con","con"),nLevels=c(4,NA,NA,NA))
summary(z)
z<-newgmData(vn,varTypes=c("dis","dis","ord","con"),valueLabels=list("a"=1:2, "b"=1:4))
summary(z)

ccnames <- c("asia", "smoke", "tub", "lung", "bronc", "either", "xray", "dysp")
gmd <- newgmData(ccnames,valueLabels=c("yes","no"), description="Chest clinic")
summary(gmd)

data(mathmark)
as.gmData(mathmark)

data(HairEyeColor)
as.gmData(HairEyeColor)


hojsgaard/gRbase documentation built on Jan. 10, 2024, 9:40 p.m.