plot_transition: Plot the transition function of an estimated PSTR model

View source: R/utils.R

plot_transitionR Documentation

Plot the transition function of an estimated PSTR model

Description

This function plots the estimated transition function g(q;\gamma,c) of a fitted PSTR model.

Usage

plot_transition(
  obj,
  size = 1.5,
  color = "blue",
  xlim = NULL,
  ylim = NULL,
  fill = NULL,
  alpha = NULL
)

Arguments

obj

An object of class "PSTR".

size

Point size.

color

Point colour.

xlim

Optional numeric vector of length 2 specifying x-axis limits.

ylim

Optional numeric vector of length 2 specifying y-axis limits.

fill

Optional colour for highlighting the support of observed q.

alpha

Transparency level for points and shading.

Details

Observed transition values are displayed together with the fitted transition curve. For models with multiple switches, multiple curves are shown.

In addition to the exported function plot_transition(obj = ...), the same functionality is available as an R6 method via obj$plot_transition(...).

Value

A ggplot2 object.

Examples


pstr <- NewPSTR(Hansen99, dep = "inva", indep = 4:20,
                indep_k = c("vala","debta","cfa","sales"),
                tvars = c("vala"), iT = 14)

pstr <- EstPSTR(use = pstr, im = 1, iq = 1,
                useDelta = TRUE, par = c(.63,0), method = "CG")

# Exported function
plot_transition(pstr)

# R6 method
pstr$plot_transition()



PSTR documentation built on Feb. 28, 2026, 1:06 a.m.