22_categorical_distributions: Categorical Models

Description Usage Arguments Details Value Note References See Also Examples

Description

Fit categorical distributions, from data.

NOTE THAT THESE OBJECTS ARE LIKELY TO BE CONVERTED TO S4 OBJECTS, IN THE NEAR FUTURE.
ALSO, NOTE THAT THEIR INTERNAL STRUCTURE (THAT IS, THEIR ATTRIBUTES/SLOTS), IS SUBJECT TO CHANGE.

IN PRINCIPLE, YOU SHOULD NOT ACCESS ATTRIBUTES/SLOTS, DIRECTLY.

Usage

1
2
3
4
5
6
7
8
9
#univariate
pmfuv.cat (g, h=1)
cdfuv.cat (g, h=1)
qfuv.cat (g, h=1)

#conditional
pmfc.cat (g, h=1, ..., conditions, warning=TRUE)
cdfc.cat (g, h=1, ..., conditions, warning=TRUE)
qfc.cat (g, h=1, ..., conditions, warning=TRUE)

Arguments

g

Integer/factor/character vector of groups.
Also, can be a named list of such vectors.

For univariate distributions, the list should only have one vector.
For conditional distributions, the list needs two or more equal-length vectors.

h

Optional numeric vector of frequencies (or weights).
It's length should be one or n, equal the length of the g vectors.

conditions

An integer vector of category indices, a character vector of category names, or a list which can contain either integers (indices) or strings (names).
The vector or list can be named (which is preferable) or unnamed.

If named, then the names are matched against the variable names.
If unnamed, then the first condition applies to the first variable, and the second condition applies to the second variable, and so on.

Note that the number of conditions needs to equal the number of variables minus one.

warning

Logical, if true, generate warning if there's no observations within the conditional window.

...

Additional arguments not allowed.

Details

PLEASE SET NOTES IN DESCRIPTION FIELD.

Refer to the vignette for more information.

Default variable names are generated, if the g list is unnamed.
(In conditional models, a warning is generated).

Value

Self-referencing function objects.

Refer to Runtime Function Objects

Except:
The constructors for conditional distributions, return NULL, if there's no observations within the conditional window.
(And by default, generate a warning).

Note

WARNING:

If a categorical distribution is constructed from integers, the category indices won't necessarily equal the category names. e.g. If unique g values were 10, 11 and 12, in contrast to 1, 2 and 3.

References

Refer to the vignette for an overview, references and better examples.

See Also

Succinct Constructors
Discrete Kernel Smoothing, Continuous Kernel Smoothing, Empirical-Like Distributions

Conditional Distributions with Mixed Input Types
These can be used for statistical classification purposes.

is.cat, ph.printf.phmodel, ph.plotf.catuv

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
prep.ph.data ()

gfh <- pmfuv.cat (crime.type, n.arrests)
gFht <- qfuv.cat (crime.type, n.arrests)

plot (gfh, freq=TRUE)
ph.mode (gfh)
ph.mode (gfh, level.names=TRUE)

gFht (0.5)
gFht (0.5, category=TRUE)

probhat documentation built on May 12, 2021, 5:08 p.m.