Learn R Programming

probhat (version 0.3.1)

26_mixed_conditional: Conditional Distributions with Mixed Input Types

Description

Fit conditional categorical or continuous distributions with mixed input data. Such categorical distributions can be used for statistical classification purposes.

Usage

#conditional categorical
pmfc.gmixp (g, x, …, conditions, warning=TRUE, w=NA, freq=FALSE)
cdfc.gmixp (g, x, …, conditions, warning=TRUE, w=NA)
qfc.gmixp (g, x, …, conditions, warning=TRUE, w=NA)

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

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.

freq

Logical, if true, the resulting function object returns frequencies, by default.

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 Mockup 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).

Details

Refer to the vignette for more information.

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, print.phmodel, plot.catuv

Examples

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

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

ph.mode (fh.gmix)
gmode (fh.gmix)

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

Run the code above in your browser using DataLab