Learn R Programming

ndl (version 0.2.18)

plot.ndlClassify: Plot function for selected results of ndlClassify.

Description

This function presents visually the estimated weights or expected probabilities for a model fitted with ndlClassify

Usage

# S3 method for ndlClassify
plot(x, values="weights", …)

# S3 method for ndlWeights plot(x, type="density", predictors=NULL, outcomes=NULL, panes="single", lty=NULL, col=NULL, mfrow=NULL, main=NULL, legend.position="topright", …)

# S3 method for ndlProbabilities plot(x, type="density", select="all", panes="single", lty=NULL, col=NULL, pch=NULL, mfrow=NULL, main=NULL, legend.position="topright", …)

Arguments

x

A object of the class "ndlClassify" produced by ndlClassify, consisting of a list including estimated weights for predictors and association strengths for outcome-predictor combinations.

values

A character string specifiying whether estimated weights (default) or expected probabilities should be plotted.

type

A character string spefifying the type of plot to be drawn; density is available for both value types as default, while a histogram (hist) is available only for plot.ndlWeights and sorted values (sort) only for plot.ndlProbabilities.

panes

A character string specifying whether a single pane (default) integrating all component plots, or multiple panes for each individual component plot are to be plotted. If multiple panes are selected, the number or rows and columns is specified automatically. Alternatively, one can invoke the plotting of multiple panes by explicitly specifying the appropriate number of rows and columns with the parameter mfrow (N.B. this overrides panes="single").

predictors

A regular expression specifying which predictors and their values should be included in the plot(s); by default =NULL so that all predictors incorporated in the ndlClassify model will be included.

outcomes

A list of outcomes to be included in the plot; by default =NULL so that all outcomes will be considered.

select

For plot.ndlProbabilities, a character string specifying which instance-wise probability estimates should be plotted; by default all, other values are max for instance-wise maximum probabilities, min for instance-wise minimum probabilities, maxmin, minmax for both maximum and minimum instance-wise probabilities. Alternatively, a numeric vector c(1,2,…) specifying selected ranks of the instance-wise probability estimates can be provided, with 1 corresponding to the instance-wise maximum probability estimates.

lty, col, pch, mfrow, main, legend.position

Specifications of various graphical parameters (see par) to be used in the plots; if any of these is set to =NULL default settings will be used (for legend.position, the default value is topright). Note that lty is relevant only to plot.ndlWeights(…, type="density", …) and plot.ndlProbabilities(…, type="density", …), and pch only to plot.ndlProbabilities(…, type="sort", …).

Arguments to be passed to methods, such as graphical parameters (see par).

Value

A plot of the selected type is produced on the graphics device.

References

Arppe, A. and Baayen, R. H. (in prep.)

See Also

ndlClassify, acts2probs

Examples

Run this code
# NOT RUN {
data(think)
think.ndl <- ndlClassify(Lexeme ~ Agent + Patient + Section, data=think)

plot(think.ndl, values="weights")
plot(think.ndl, values="weights", type="hist", panes="multiple")
plot(think.ndl, values="weights", type="density", panes="multiple")
plot(think.ndl, values="weights", type="density", panes="multiple",
   predictors="Section*")
plot(think.ndl, values="weights", type="density", panes="multiple",
   predictors="Patient*")
plot(think.ndl, values="weights", type="hist", panes="multiple", col=1:4)
plot(think.ndl, values="weights", type="density", panes="single",
   outcomes=c("ajatella","miettia","pohtia","harkita"))

plot(think.ndl, values="probabilities")
plot(think.ndl, values="probabilities", panes="multiple")
plot(think.ndl, values="probabilities", select="max")
plot(think.ndl, values="probabilities", select=c(1:3))
plot(think.ndl, values="probabilities", panes="multiple", select=c(1:3))
plot(think.ndl, values="probabilities", type="sort", legend.position="topleft")
plot(think.ndl, values="probabilities", type="sort", pch=".",
   legend.position="topleft")
plot(think.ndl, values="probabilities", type="sort", pch=".", panes="multiple")
# }

Run the code above in your browser using DataLab