Learn R Programming

probhat (version 0.4.1)

23_mixed_conditional: Conditional Distributions with Mixed Categorical-Continuous Input

Description

Fit conditional categorical or continuous distributions with mixed categorical-continuous input. (These resemble conditional CAT and CKS models). And the categorical distributions can be used for statistical classification purposes.

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

#conditional categorical
ph4.pmfc.gmix (g, x, …, conditions, warning=TRUE, w)
ph4.cdfc.gmix (g, x, …, conditions, warning=TRUE, w)
ph4.qfc.gmix (g, x, …, conditions, warning=TRUE, w)

#conditional continuous ph4.pdfc.xmix (g, x, …, conditions, warning=TRUE, w) ph4.cdfc.xmix (g, x, …, conditions, warning=TRUE, w) ph4.qfc.xmix (g, x, …, conditions, warning=TRUE, w)

Arguments

g

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

x

A numeric vector or a numeric matrix, preferably with column names. The length of x (if standard vector) or the number or rows (if a matrix) should equal the length of the g vectors.

conditions

Refer to the conditions arg in categorical and continuous conditional models. This is the same, except that the vector or list, needs to be named (unnamed conditions are not allowed), and can include both categorical and continuous variables. Note that the number of conditions needs to equal the number of variables minus one. (For categorical distributions, there should be one categorical variable left out, and for continuous distributions there should be one continuous variable left out). The resulting probability distribution should be the conditional distribution of the variable not included in the conditions.

w

Optional numeric vector of weights.

warning

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

In categorical distributions, further arguments for pdfmv.cks, which is called on the continuous conditioning variables. In continuous distributions, further arguments for pdfuv or pdfc, which is called on the continuous conditional variable.

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 you can check names (and their order), with names method. This may be useful for conditional distributions. (By default, only the conditional variables are returned).

Details

PLEASE SET NOTES IN DESCRIPTION FIELD.

Refer to the vignette for more information.

Default variable names are generated, if the g/x list/matrix are unnamed. (And a warning is generated).

Note that categorical and continuous variables need different names.

References

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

See Also

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

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

Examples

Run this code
# NOT RUN {
prep.ph.data ()

fh.gmix <- ph4.pmfc.gmix (species, cbind (sepal.length, sepal.width),
    conditions = c (sepal.length=6, sepal.width=3) )
Fht.gmix <- ph4.qfc.gmix (species, cbind (sepal.length, sepal.width),
    conditions = c (sepal.length=6, sepal.width=3) )

plot (fh.gmix)
ph.mode (fh.gmix)
ph.mode (fh.gmix, level.names=TRUE)

Fht.gmix (0.5)
Fht.gmix (0.5, category=TRUE)
# }

Run the code above in your browser using DataLab