spec: Fit a spectrum with no time component / homogeneous across...

Description Usage Arguments Value References See Also Examples

View source: R/spectrum.R

Description

Fit a spectrum with no time component / homogeneous across time. The corresponding spectrum is modeled nonparametrically using a mixture of a smooth radial basis expansion and a number of local deviations from the smooth term representing spectral emission lines. The corresponding tuning parameter is determined via the minimum description length principle.

Usage

1
2
3
spec(x, y, A, delta.t, delta.w, reps = 1, display = TRUE,
opt = get.opt.spec(), assign.emiss = NA, emdl = TRUE,
simple = TRUE, v = 1) 

Arguments

x

A vector containing wavelengths, corresponding to the vector of observed counts y

y

A vector containing the observed counts or aggregated observed counts over homogeneous time segments

A

A vector containing the effective areas

delta.t

Bin width of time

delta.w

Bin width of wavelength

reps

Number of time bins that you aggregate the counts over

display

If TRUE, progress bar is printed during fitting

opt

An option list returned by get.opt.spec. This is used in the homogeneous spectrum fitting between change points. If assign.emiss=NULL, nlambda will be automatically set to 10000 if it is set smaller than 10000. If this automatic change is not desired, one can set lam.ratio.len=-1. (lam.ratio.len is a useless parameter if assign.emiss=NULL)

assign.emiss

Indices of wavelength bins that are allowed to have emission line. If NA, assign_emiss will be set to 1:length(y). If NULL, no emission line will be fitted.

emdl

If TRUE, extended MDL, rather than MDL, is used.

simple

If TRUE, a simplified output is returned. That is, results of the grid search (beta_cube) will be not be output.

v

An ad-hoc parameter for tuning the strength of the penalty. That means, (v * penalty) will be the ultimate penalty used in the MDL / extended MDL. More penalty leads to a smoother spectrum and/or fewer emission lines. It is set to 1.0 by default.

Value

best.beta

Regression coefficients of the output spectrum

fitted.logbright

Linear predictor of the output spectrum; exp(fitted_logbright) is the fitted brightness function.

fitted.logbright.ne

Linear predictor without emission lines

df

df[1]: Degree of freedoms of the continuum (does not count the intercept)\ df[2]: Degree of freedoms of the emission lines

out.ind

Indices of the time points with emission lines

mdl

All MDLs in the grid search of the tuning parameter

mdl.ind

Index of the smallest MDL in the grid search of the tuning parameter

mdl.pen

All penalties in MDLs in the grid search of the tuning parameter

beta.cube

All fitted regression coefficients of all fits in the grid search of the tuning parameter

References

Raymond K. W. Wong, Vinay L. Kashyap, Thomas C. M. Lee and David A. van Dyk (2016). Detecting Abrupt Changes in the Spectra of High-energy Astrophysical Sources. The Annals of Applied Statistics, 10(2), 1107-1134.

See Also

plotspec

Examples

1
2
3
4
5
6
7
8
library(Automark)           # load library
data(dat)                   # load example data
y1 <- apply(dat$y, 1, sum)  # aggregate data over time
## Not run: 
out <- spec(dat$x2, y1, dat$A, dat$delta.t, dat$delta.w, reps=ncol(dat$y))
plotspec(dat$x2, out)

## End(Not run)

astrostat/Automark documentation built on Dec. 4, 2019, 12:30 a.m.