Click or drag to resize

CategoricalVariable Class

Represents a statistical variable that can take on one of a fixed number of possible values.
Inheritance Hierarchy
SystemObject
  Novacta.AnalyticsCategoricalVariable

Namespace:  Novacta.Analytics
Assembly:  Novacta.Analytics (in Novacta.Analytics.dll) Version: 2.0.0
Syntax
public class CategoricalVariable : IEnumerable<Category>, 
	IEnumerable

The CategoricalVariable type exposes the following members.

Constructors
  NameDescription
Public methodCategoricalVariable
Initializes a new instance of the CategoricalVariable class having the specified name.
Top
Properties
  NameDescription
Public propertyCategories
Exposes the list of categories in the CategoricalVariable.
Public propertyCategoryCodes
Exposes the enumerator which iterates over the collection of category codes in the CategoricalVariable.
Public propertyCategoryLabels
Exposes the enumerator which iterates over the collection of category labels in the CategoricalVariable.
Public propertyIsReadOnly
Gets a value indicating whether this instance is read only.
Public propertyName
Gets or sets the variable name.
Public propertyNumberOfCategories
Gets the number of categories.
Top
Methods
  NameDescription
Public methodAdd(Double)
Adds a category having the specified code and a default label to the CategoricalVariable.
Public methodAdd(Double, String)
Adds a category having the specified code and label to the CategoricalVariable.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodStatic memberFromDoubleMatrix
Converts from DoubleMatrix to CategoricalVariable.
Public methodGetEnumerator
Returns an enumerator that iterates through the collection.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodRemove(Double)
Removes the category having the specified code from the CategoricalVariable.
Public methodRemove(String)
Removes the category having the specified label from the CategoricalVariable.
Public methodSetAsReadOnly
Sets the CategoricalVariable as read only.
Public methodStatic memberToDoubleMatrix
Converts from CategoricalVariable to DoubleMatrix.
Public methodToString
Returns a String that represents this instance.
(Overrides ObjectToString.)
Public methodTryGet(Double, Category)
Tries to get the category corresponding to a given code.
Public methodTryGet(String, Category)
Tries to get the category corresponding to a given label.
Top
Operators
Explicit Interface Implementations
  NameDescription
Explicit interface implementationPrivate methodIEnumerableGetEnumerator
Returns an enumerator that iterates through a collection.
Top
Remarks

Instantiation

You can instantiate a CategoricalVariable object by calling its constructor. See the CategoricalVariable constructor summary.

Categories

Each of the possible values of a categorical variable is represented by an instance of type Category. Categories can be added to or removed from a given categorical variable, provided that it wasn't set as read-only by calling SetAsReadOnly. This condition can be verified by inspecting property IsReadOnly. Categories must be identifiable, both by their Code and by their Label. As a consequence, a category can be added only if, in the given categorical variable, no other category already exists having the same code or the same label. Furthermore, a category can be removed by passing its code to method Remove(Double), or its label to method Remove(String).

Use property NumberOfCategories to know how many categories are currently associated to a given variable. Property Categories lists category instances. Category codes, or labels, can be enumerated by inspecting, respectively, properties CategoryCodes and CategoryLabels.

You can verify if a category is in the variable by passing its code to method TryGet(Double, Category), or its label to method TryGet(String, Category).

See Also