Variable-class: Class '"Variable"'

Description Objects from the Class Methods Author(s) Examples

Description

The Variable class is the base class for fixed and random variables in SimDat. There are four basic types of variables: nominal, ordinal, interval, and ratio variables. These can be fixed or random.

Objects from the Class

"Variable" itself is a virtual Class: No objects may be created from it. But there are constructor methods for the derived classes:

NominalVariable(data=factor(),name)

RandomNominalVariable(data=factor(),name)

OrdinalVariable(data=ordered(),name)

RandomOrdinalVariable(data=ordered(),name)

IntervalVariable(data=numeric(),name,digits=getOption('digits'))

RandomIntervalVariable(data=numeric(),name,digits=getOption('digits'),min=-Inf,max=Inf)

RatioVariable(data=numeric(),name,digits=getOption('digits'))

RandomRatioVariable(data=numeric(),name,digits=getOption('digits'),min=-Inf,max=Inf)

Methods

asFixed

signature(object = "Variable"): ...

asRandom

signature(object = "Variable"): ...

coerce

signature(from = "Variable", to = "IntervalVariable"): ...

coerce

signature(from = "Variable", to = "NominalVariable"): ...

coerce

signature(from = "Variable", to = "OrdinalVariable"): ...

coerce

signature(from = "Variable", to = "RandomIntervalVariable"): ...

coerce

signature(from = "Variable", to = "RandomNominalVariable"): ...

coerce

signature(from = "Variable", to = "RandomOrdinalVariable"): ...

coerce

signature(from = "Variable", to = "RandomRatioVariable"): ...

coerce

signature(from = "Variable", to = "RatioVariable"): ...

digits

signature(object = "Variable"): ...

isMetric

signature(object = "Variable"): ...

isRandom

signature(object = "Variable"): ...

labels

signature(object = "Variable"): ...

names<-

signature(x = "Variable"): ...

names

signature(x = "Variable"): ...

simulateFromModel

signature(object = "Variable", model = "GamlssModel"): ...

simulateFromModel

signature(object = "Variable", model = "MixedParModel"): ...

simulateFromModel

signature(object = "Variable", model = "MvnormModel"): ...

simulateFromModel

signature(object = "Variable", model = "UniformModel"): ...

simulate

signature(object = "Variable"): ...

Summary

signature(x = "Variable"): ...

Author(s)

Maarten Speekenbrink

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
showClass("Variable")
## create a Nominal variable
A <- NominalVariable(factor(1:2,labels="A1","A2"),name="A")
# derives some methods from 'factor':
levels(A)
levels(A) <- c("A1","A3")
## convert to a RandomInterval variable
rA <- as(A,"RandomNominalVariable")
## check that it is actually a random variable:
isRandom(rA)
## is it a metric (>= interval level) variable? 
isMetric(rA)
# construct a (truncated) interval variable
B <- RandomIntervalVariable(rnorm(10),name="B",digits=2,min=0,max=10)


Search within the simdat.base package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.