longitudinal_plot: Plot longitudinal random effects in time-lag form

View source: R/longitudinal_plot.R

longitudinal_plotR Documentation

Plot longitudinal random effects in time-lag form

Description

Plot longitudinal random effects in time-lag form

Usage

longitudinal_plot(
  input,
  type = "dyadic",
  mode = "cor",
  parameter_set,
  results,
  normalized = FALSE,
  HPDI = 0.9,
  plot = TRUE,
  export_as_table = FALSE,
  save_plot = NULL,
  height = 6,
  width = 6,
  palette = NULL
)

Arguments

input

A STRAND model object, obtained by fitting a longitudinal combined stochastic block and social relations model.

type

Plot dyadic reciprocity ("dyadic") or generalized reciprocity ("generalized")?. Can use "custom", if the user passes in an appropriate data frame.

mode

For dyadic plots, should the dyadic correlation "cor" be plotted, or the dyadic covariance "cov", or the adjusted dyadic+error correlation "adj".

parameter_set

A labeled list of paramters to plot. E.g.: parameter_set = list(focal="Age", target="Age", focal="Sex", target="Sex", dyadic = "Relatedness"). The names must be focal, target, or dyadic, and the quoted text must be paramters given in the regression equations. E.g., focal_regression = ~ Age + Sex.

results

A results data.frame or matrix with colnames: c("Variable", "Layer", "Target" , "Base" , "Median", "L", "H", "Mean","SD","LayerNumeric")

normalized

Should effects be normalized? Only valid for type="coefficient".

HPDI

Highest Posterior Density Interval. Ranges in (0,1).

plot

Should a plot be displayed?

export_as_table

Should the tabular data rather than a ggplot object be returned?

save_plot

Should a plot be exported to working directory? If so, set save_plot="desired_filename.pdf".

height

Height of exported plot.

width

Width of exported plot.

palette

Override the default palette with a vector of color codes. "dyadic" need 3 colors, "generalized" needs 5 colors, and "coefficient" needs as many colors as supplied parameters.

Value

A figure or tabluar data to make a figure.

Examples

## Not run: 
res = longitudinal_plot(input = fit)

## End(Not run)


ctross/STRAND documentation built on Dec. 15, 2024, 6:02 a.m.