Learn R Programming

lfl (version 2.2.0)

ctx: Context for linguistic expressions

Description

A context describes a range of allowed values for a data column.

Usage

ctx3(
  low = 0,
  center = low + (high - low) * relCenter,
  high = 1,
  relCenter = 0.5
)

ctx3bilat( negMax = -1, negCenter = origin + (negMax - origin) * relCenter, origin = 0, center = origin + (max - origin) * relCenter, max = 1, relCenter = 0.5 )

ctx5( low = 0, lowerCenter = mean(c(low, center)), center = low + (high - low) * relCenter, upperCenter = mean(c(center, high)), high = 1, relCenter = 0.5 )

ctx5bilat( negMax = -1, negUpperCenter = mean(c(negCenter, negMax)), negCenter = origin + (negMax - origin) * relCenter, negLowerCenter = mean(c(origin, negCenter)), origin = 0, lowerCenter = mean(c(origin, center)), center = origin + (max - origin) * relCenter, upperCenter = mean(c(center, max)), max = 1, relCenter = 0.5 )

as.ctx3(x)

# S3 method for ctx3 as.ctx3(x)

# S3 method for ctx3bilat as.ctx3(x)

# S3 method for ctx5 as.ctx3(x)

# S3 method for ctx5bilat as.ctx3(x)

# S3 method for default as.ctx3(x)

as.ctx3bilat(x)

# S3 method for ctx3bilat as.ctx3bilat(x)

# S3 method for ctx3 as.ctx3bilat(x)

# S3 method for ctx5 as.ctx3bilat(x)

# S3 method for ctx5bilat as.ctx3bilat(x)

# S3 method for default as.ctx3bilat(x)

as.ctx5(x)

# S3 method for ctx5 as.ctx5(x)

# S3 method for ctx3 as.ctx5(x)

# S3 method for ctx3bilat as.ctx5(x)

# S3 method for ctx5bilat as.ctx5(x)

# S3 method for default as.ctx5(x)

as.ctx5bilat(x)

# S3 method for ctx5bilat as.ctx5bilat(x)

# S3 method for ctx3 as.ctx5bilat(x)

# S3 method for ctx3bilat as.ctx5bilat(x)

# S3 method for ctx5 as.ctx5bilat(x)

# S3 method for default as.ctx5bilat(x)

is.ctx3(x)

is.ctx3bilat(x)

is.ctx5(x)

is.ctx5bilat(x)

Value

ctx* and as.ctx* return an instance of the appropriate class. is.ctx* returns TRUE or FALSE.

Arguments

low

Lowest value of an unilateral context.

center

A positive middle value of a bilateral context, or simply a middle value of an unilateral context.

high

Highest value of an unilateral context.

relCenter

A relative quantity used to compute the negCenter and/or center, if they are not specified explicitly. The sensible value is 0.5 for context symmetric around center, or 0.42 as proposed by Novak.

negMax

Lowest negative value of a bilateral context.

negCenter

A negative middle value.

origin

Origin, i.e. the initial point of the bilateral context. It is typically a value of zero.

max

Highest value of a bilateral context.

lowerCenter

A typical positive value between origin and center.

upperCenter

A typical positive value between center and maximum.

negUpperCenter

A typical negative value between negMax and negCenter.

negLowerCenter

A typical negative value between negCenter and negOrigin.

x

A value to be examined or converted. For as.ctx*, it can be an instance of any ctx* class or a numeric vector of size equal to the number of points required for the given context type.

Author

Michal Burda

Details

A context describes a range of allowed values for a data column. For that, only the borders of the interval, i.e. minimum and maximum, are usually needed, but we use contexts to hold more additional information that is crucial for the construction of linguistic expressions.

Currently, four different contexts are supported that determine the types of possible linguistic expressions, as constructed with lingexpr(). Unilateral or bilateral context is allowed in the variants of trichotomy or pentachotomy. Trichotomy distinguishes three points in the interval: the lowest value, highest value, and center. Pentachotomy adds lower center and upper center to them. As opposite to unilateral, the bilateral context handles explicitly the negative values. That is, bilateral context expects some middle point, the origin (usually 0), around which the positive and negative values are placed.

Concretely, the type of the context determines the allowed atomic expressions as follows:

  • ctx3: trichotomy (low, center, high) enables atomic expressions: small, medium, big;

  • ctx5: pentachotomy (low, lowerCenter, center, upperCenter, high) enables atomic expressions: small, lower medium, medium, upper medium, big;

  • ctx3bilat: bilateral trichotomy (negMax, negCenter, origin, center, max) enables atomic expressions: negative big, negative medium, negative small, zero, small, medium, big;

  • ctx5bilat: bilateral pentachotomy (negMax, negCenter, origin, center, max) enables atomic expressions: negative big, negative medium, negative small, zero, small, medium, big.

The as.ctx* functions return instance of the appropriate class. The functions perform the conversion so that missing points of the new context are computed from the old context that is being transformed. In the subsequent table, rows represent compatible values of different context types:

ctx3ctx5ctx3bilatctx5bilat
negMaxnegMax
negUpperCenter
negCenternegCenter
negLowerCenter
lowloworiginorigin
lowerCenterlowerCenter
centercentercentercenter
upperCenterupperCenter
highhighmaxmax

The as.ctx* conversion is performed by replacing values by rows, as indicated in the table above. When converting from a context with less points to a context with more points (e.g. from unilateral to bilateral, or from trichotomy to pentachotomy), missing points are computed as follows:

  • center is computed as a mean of origin (or low) and max (or high).

  • lowerCenter is computed as a mean of origin (or low) and center.

  • upperCenter is computed as a mean of mas (or high) and center.

  • negative points (such as negMax, negCenter etc.) are computed symmetrically around origin to the corresponding positive points.

The code as.ctx* functions allow the parameter to be also a numeric vector of size equal to the number of points required for the given context type, i.e. 3 (ctx3), 5 (ctx3bilat, ctx5), or 9 (ctx5bilat).

See Also

minmax(), lingexpr(), horizon(), hedge(), fcut(), lcut()

Examples

Run this code
    ctx3(low=0, high=10)
    as.ctx3bilat(ctx3(low=0, high=10))

Run the code above in your browser using DataLab