dfplotcov: Plot parameter covariance matrix

Description Usage Arguments Author(s) See Also Examples

View source: R/dfplotcov.R

Description

This function displays the parameter covariances of the distribution function parameters (e.g. the mass function parameters) fitted using dffit.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
dfplotcov(
  data,
  master = 1,
  order = seq(length(data)),
  names = NULL,
  col = c("blue", "black", "red", "green", "orange"),
  lwd = 1,
  lty = 1,
  cex = 1.2,
  pch = 20,
  cloud.alpha = 0.1,
  cloud.nmax = NULL,
  hist.alpha = 0.4,
  show.histogram = TRUE,
  show.cloud = TRUE,
  show.gaussian = TRUE,
  show.expectation = TRUE,
  show.ellipse.68 = TRUE,
  show.ellipse.95 = TRUE,
  show.xlab = TRUE,
  show.ylab = TRUE,
  title = "",
  nstd = 10,
  pmin = NULL,
  pmax = NULL,
  vert.stretch = 1,
  nbins = NULL,
  lower = TRUE,
  upper = FALSE,
  margins = c(4, 4, 0.5, 0.5),
  text.size.labels = 1.1,
  text.size.numbers = 0.8,
  text.offset.labels = c(0, 0),
  text.offset.numbers = c(0, 0),
  text.format.numbers = "%4.1f"
)

Arguments

data

List of objects to be plotted. Each object in this list must be one of the following four: (1) a vector of parameters; (2) a list of two objects, a vector of parameters and an associated covariance matrix; (3) a matrix, where each row represents a set of model parameters, to be displayed as a point of a cloud; (4) an output list produced by dffit. The plot will be centered on the parameters (or average parameters) of the first object in the data list, unless the argument master is set to a different index.

master

Integer specifying the index of the object in the data list defining the axes scales

order

Vector of integer specifying the order of drawing.

names

Optional list of parameter names

col

Vector of colors of each object in the data-list

lwd

Vector of line width of each object in the data-list

lty

Vector of line types of each object in the data-list

cex

Vector of point sizes for the central parameters each object in the data-list

pch

Vector of point type for the central parameters each object in the data-list

cloud.alpha

Vector of alpha values setting the transparency of the point clouds

cloud.nmax

Vector specifying the maximum number of points to be plotted in a point cloud

hist.alpha

Vector of alpha values setting the transparency of the histograms

show.histogram

= Logical vector specifying whether to plot histograms

show.cloud

Logical vector specifying whether to plot the point cloud

show.gaussian

Logical vector specifying whether to draw the Gaussian apprixmation of the parameter distribution

show.expectation

Logical vector specifying whether to mark the expected values (= averages if a parameter set is specified)

show.ellipse.68

Logical vector specifying whether to draw 68% confidence ellipses

show.ellipse.95

Logical vector specifying whether to draw 95% confidence ellipses

show.xlab

Logical flag indicating whether labels+numbers along x-axis are displayed

show.ylab

Logical flag indicating whether labels+numbers along y-axis are displayed

title

Optional plot title

nstd

Width of the plots in multiples of the standard deviations of the model, i.e. the square roots of the diagonal elements of covariance.

pmin

optional P-vector with lower parameter limits to be potted. If given, pmax must also be given and nstd is ignored.

pmax

optional P-vector with lower parameter limits to be potted. If given, pmin must also be given and nstd is ignored.

vert.stretch

P-vector specifying the vertical stretch of the diagonal panels.

nbins

Optional integer specifying the number of bins used in histograms. If set to NULL, this number is determined automatically.

lower

Logical flag indicating whether the lower triangle is shown

upper

Logical flag indicating whether the lower triangle is shown

margins

Plot margins (bottom,left,top,right)

text.size.labels

Text size of parameter names

text.size.numbers

Text size of numbers

text.offset.labels

2-element vector to adjust the position of the vertical and horizontal parameter names

text.offset.numbers

2-element vector to adjust the position of the vertical and horizontal numbers

text.format.numbers

String specifying the floating point format of the numbers. (see sprintf)

Author(s)

Danail Obreschkow

See Also

See examples in dffit.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# generate two random correlated vectors p[1,] and p[2,] of n elements
# and display their covariance plot
n = 100
p = array(NA,c(n,2))
p[,1] = rnorm(n)
p[,2] = 0.25*p[,1]+rnorm(n,1,0.5)
dfplotcov(list(p))

# now produce the same plot, but increase the number of bins
# add in red color the theoretical expectation
expected_mean = c(0,1)
expected_covariance = cbind(c(1,0.5^2),c(0.5^2,0.5^2+0.25^2))
dfplotcov(list(p,list(expected_mean,expected_covariance)), nbins=20, col=c('black','red'))

# Fit a Schechter function to a mock survey, plot the best-fitting parameters
# with uncertainties in blue and add input parameters as black crosses
dat = dfmockdata(n=1000,sigma=0.5)
survey = dffit(dat$x, dat$veff, dat$x.err)
ptrue = c(-2,11,-1.3)
dfplotcov(list(survey,ptrue), col=c('blue','black'), pch=c(20,3))

obreschkow/dftools documentation built on June 25, 2021, 10:45 p.m.