barchart.PDF: This function produces a plot of a conditional probability...

barchart.CPFR Documentation

This function produces a plot of a conditional probability frame.

Description

This is an extension of barchart.array for displaying conditional probability tables. In particular, it will display the output of calcDPCFrame.

Usage

## S3 method for class 'CPF'
barchart(x, data = NULL, ..., baseCol = "firebrick",
             auto.key=TRUE, par.settings)

Arguments

x

A conditional probaiblity frame (see as.CPF.

data

Ignore this value, used for compatability with barchart.

...

Other arguments passed on to barchart, in particular, other lattice graphics arguments.

baseCol

This should be a specification of a color. The color is designed as a gradient starting at the base color and getting progressively lighter. If its value is NULL, the colors are left at the default (pastel palette) and the value of par.settings is passed through unchanged.

auto.key

This is the auto.key parameter from barchart, it is overridden to have a default of true.

par.settings

This is the par.settings parameter from barchart. If baseCol is not null, then a value for superpose.polygon is added to set the bar colors.

Details

The function barchart.array and the function as.CPA to convert the conditional probability frame to an array do 90 percent of the work.

A few minor touches:

  • The function takes special care of one row [un]conditional probability frames.

  • The function overrides the default colors using colorspread to produce varying intensities of the same color.

  • The function adds the dimension names, so that the labels indicate which variables they belong to.

  • The function sets the default value of auto.key to TRUE so that a legend for the colors is produced.

Note that the color change is brought about internally by modifying par.settings. To suppress this behavior, set baseCol to null, and the user value for par.settings will be passed through unchanged.

Value

An object of class lattice that when printed will produce the graph.

Author(s)

Russell Almond

See Also

as.CPA, colorspread, barchart.array, calcDPCFrame

Examples


     ## Set up variables
     skill1l <- c("High","Medium","Low") 
     skill2l <- c("High","Medium","Low","LowerYet") 
     correctL <- c("Correct","Incorrect") 
     pcreditL <- c("Full","Partial","None")
     gradeL <- c("A","B","C","D","E") 

     cpfTheta <- calcDPCFrame(list(),skill1l,numeric(),0,rule="Compensatory",
                              link="normalLink",linkScale=.5)

     barchart.CPF(cpfTheta)

     cptComp <- calcDPCFrame(list(S2=skill2l,S1=skill1l),correctL,
                             lnAlphas=log(c(1.2,.8)), betas=0,
                             rule="Compensatory")
     barchart.CPF(cptComp,layout=c(3,1))

     cptPC1 <- calcDPCFrame(list(S1=skill1l,S2=skill2l),pcreditL,
                             lnAlphas=log(1),
                             betas=list(full=c(S1=0,S2=999),partial=c(S2=999,S2=0)),
                             rule="OffsetDisjunctive")
    barchart.CPF(cptPC1,baseCol="slateblue")


ralmond/CPTtools documentation built on Dec. 27, 2024, 7:15 a.m.