ctx {lfl} | R Documentation |
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 class 'ctx3'
as.ctx3(x)
## S3 method for class 'ctx3bilat'
as.ctx3(x)
## S3 method for class 'ctx5'
as.ctx3(x)
## S3 method for class 'ctx5bilat'
as.ctx3(x)
## Default S3 method:
as.ctx3(x)
as.ctx3bilat(x)
## S3 method for class 'ctx3bilat'
as.ctx3bilat(x)
## S3 method for class 'ctx3'
as.ctx3bilat(x)
## S3 method for class 'ctx5'
as.ctx3bilat(x)
## S3 method for class 'ctx5bilat'
as.ctx3bilat(x)
## Default S3 method:
as.ctx3bilat(x)
as.ctx5(x)
## S3 method for class 'ctx5'
as.ctx5(x)
## S3 method for class 'ctx3'
as.ctx5(x)
## S3 method for class 'ctx3bilat'
as.ctx5(x)
## S3 method for class 'ctx5bilat'
as.ctx5(x)
## Default S3 method:
as.ctx5(x)
as.ctx5bilat(x)
## S3 method for class 'ctx5bilat'
as.ctx5bilat(x)
## S3 method for class 'ctx3'
as.ctx5bilat(x)
## S3 method for class 'ctx3bilat'
as.ctx5bilat(x)
## S3 method for class 'ctx5'
as.ctx5bilat(x)
## Default S3 method:
as.ctx5bilat(x)
is.ctx3(x)
is.ctx3bilat(x)
is.ctx5(x)
is.ctx5bilat(x)
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 |
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 |
negLowerCenter |
A typical negative value between |
x |
A value to be examined or converted. For |
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:
ctx3 | ctx5 | ctx3bilat | ctx5bilat |
negMax | negMax | ||
negUpperCenter | |||
negCenter | negCenter | ||
negLowerCenter | |||
low | low | origin | origin |
lowerCenter | lowerCenter | ||
center | center | center | center |
upperCenter | upperCenter | ||
high | high | max | max |
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 oforigin
(orlow
) andmax
(orhigh
). -
lowerCenter
is computed as a mean oforigin
(orlow
) andcenter
. -
upperCenter
is computed as a mean ofmas
(orhigh
) andcenter
. negative points (such as
negMax
,negCenter
etc.) are computed symmetrically aroundorigin
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
).
Value
ctx*
and as.ctx*
return an instance of the appropriate
class. is.ctx*
returns TRUE
or FALSE
.
Author(s)
Michal Burda
See Also
minmax()
, lingexpr()
, horizon()
, hedge()
, fcut()
, lcut()
Examples
ctx3(low=0, high=10)
as.ctx3bilat(ctx3(low=0, high=10))