Learn R Programming

Biograph (version 2.0.6)

plot.occup.S: Plots state occupancies

Description

Plots state occupancies. It plots the state occupancies (counts in sample or population under observation) as estimated by Occup. The data are produced by the Occup function.

Usage

"plot"(x,namstates.desired,colours,title,area,xmin,xmax,...)

Arguments

x
State occupancies in sample population, by age. An object of class occup.S produced by the Occup function.
namstates.desired
Desired sequence of states in plot. The argument is used to specify an informative ordering of the state occupancies or state probabilities to be stacked.
colours
Colours selected to distinguish the states in the state space.
title
title of plot
area
logical variable.If area is TRUE, area plot is displayed (using geom_area of ggplot2). If area is FALSE, a bar plot is displayed (using geom_bar of ggplot2)
xmin
Minimum age in plot
xmax
Maximum age in plot
...
Further arguments to plot

Value

occup.S
State occupancies
plot
The figure of state occupancies

Details

The function uses the ggplot2 package

Examples

Run this code
    data(GLHS)
    Bdata.a <- date_b (GLHS,format.out="age",covs=c("marriage","LMentry"))
    occup <- Occup(Bdata.a)
    dd <- occup$state_occup
    t <- "States occupancies. GLHS"
    cc <- c("red","green","lightgrey")
    xx <- c("N","J","Censored")
    z<- plot (x=dd,namstates.desired=xx,colours=cc,title=t,area=TRUE,xmin=10,xmax=55) 
     

Run the code above in your browser using DataLab