Type: Package
Title: Modified Skew Discrete Laplace Regression for Integer-Valued and Paired Discrete Data
Version: 0.1.2
Description: Implementation of the modified skew discrete Laplace (SDL) regression model. The package provides a set of functions for a complete analysis of integer-valued data, where the dependent variable is assumed to follow a modified SDL distribution. This regression model is useful for the analysis of integer-valued data and experimental studies in which paired discrete observations are collected.
URL: https://github.com/rdmatheus/sdlrm
License: GPL-3
Encoding: UTF-8
LazyData: true
Imports: Formula (≥ 1.2.3), Rfast
RoxygenNote: 7.3.2
Depends: R (≥ 3.5)
NeedsCompilation: no
Packaged: 2025-04-02 17:41:12 UTC; rodri
Author: Rodrigo Medeiros [aut, cre]
Maintainer: Rodrigo Medeiros <rodrigo.matheus@ufrn.br>
Repository: CRAN
Date/Publication: 2025-04-08 08:20:02 UTC

Choose the Mode of the Modified Skew Discrete Laplace Regression

Description

Estimation of the mode in a modified skew discrete Laplace (SDL) regression fit via profile log-likelihood.

Usage

choose_mode(
  object,
  grid = -5:5,
  trace = TRUE,
  plot = TRUE,
  control = sdl_control(...),
  ...
)

## S3 method for class 'choose_mode'
print(x, ...)

## S3 method for class 'choose_mode'
plot(x, ...)

Arguments

object

an object of class "sdlrm", a result of a call to sdlrm.

grid

grid of values that will be used to evaluate the profile log-likelihood function.

trace

logical; if TRUE, a summary with the profile log-likelihood value, the AIC, and the BIC of the fit is displayed.

plot

logical; if TRUE, a graph of the profiled log-likelihood evaluated in the considered grid of values is shown.

control

a list of control arguments specified via sdl_control.

...

further arguments passed to sdl_control.

x

an object of class "choose_mode".

Value

An object of class "choose_mode". More specifically, it returns a list in which each element consists of the fit of the modified SDL regression with each value of the mode specified in grid. In addition, it has the elements “logLik” with the vector of log-likelihood values for each adjustment and “grid” with the specified grid of values.

The print function summarizes the fits by displaying, for each value in grid, the log-likelihood value and the Akaike (AIC) and Bayesian (BIC) information criteria. The plot function returns a graph of the profiled likelihood of the mode, highlighting its maximum.

Author(s)

Rodrigo M. R. de Medeiros <rodrigo.matheus@ufrn.br>

References

Medeiros, R. M. R., and Bourguignon, M. (2025). Modified skew discrete Laplace regression models for integer valued data with applications to paired samples. Manuscript submitted for publication.

Examples

# Data set: pss (for description run ?pss)
barplot(table(pss$difference), xlab = "PSS index difference", ylab = "Frequency")
boxplot(pss$difference ~ pss$group, xlab = "Group", ylab = "PSS index difference")

# Fit with a model only for the mean with xi = 0 (default)
fit0 <- sdlrm(difference ~ group, data = pss)

# Choosing the mode on the grid {-10, -9, ..., 0, ..., 9, 10}
fit <- choose_mode(fit0, grid = -10:10)

# Class
class(fit)

# It is possible to recovery the plot:
plot(fit)

# and the trace:
fit

# Fit with xi = 1
fit[[1]]

Test for Constant Dispersion in the Modified Skew Discrete Laplace Regression

Description

Hypothesis test on constant dispersion in the modified skew discrete Laplace regression.

Usage

disp_test(object)

Arguments

object

an object of class "sdlrm", a result of a call to sdlrm.

Value

the function disp_test returns the values and corresponding asymptotic p-values of the score, Wald, likelihood ratio, and gradient test statistics

References

Medeiros, R. M. R., and Bourguignon, M. (2025). Modified skew discrete Laplace regression models for integer valued data with applications to paired samples. Manuscript submitted for publication.

Examples

## Data set: pss (for description run ?pss)
barplot(table(pss$difference), xlab = "PSS index difference", ylab = "Frequency")
boxplot(pss$difference ~ pss$group, xlab = "Group", ylab = "PSS index difference")

## Fit a double model (mode = 1)
fit0 <- sdlrm(difference ~ group | group, data = pss, xi = 1)

## Constant dispersion test
disp_test(fit0)


Envelope Plot for the Residuals of a Modified Skew Discrete Laplace Regression Fit

Description

Provides the normal probability plot with simulated envelope of Pearson residuals and randomized quantile residuals resulting from the modified skew discrete Laplace (SDL) regression fit.

Usage

envelope(object, nsim = 99, progressBar = TRUE, plot = TRUE, ...)

## S3 method for class 'envelope'
print(x, ...)

## S3 method for class 'envelope'
plot(x, type = c("quantile", "pearson"), level = 0.95, ...)

Arguments

object, x

an object of class "sdlrm", a result of a call to sdlrm.

nsim

the number of replicates. The default is nsim = 99.

progressBar

logical; if TRUE, a progress bar is displayed giving the progress of making the graph. It can slow down the function considerably in applications with a large sample size.

plot

logical; if TRUE, the envelope plot of the residuals is displayed.

...

further arguments passed to or from other methods.

type

character; specifies which residual should be produced in the envelope plot. The available options are "quantile" (default) and "pearson" ((y - mean) / sd).

level

level of the sample quantile of the residual used in the construction of confidence bands.

Value

envelope returns an "sdlrm_envel" object which consists of a list with the following components:

residuals

a list with the quantile and pearson residuals resulting from the fit of the SDL regression model.

simulation

a list whose components are matrices containing the ordered quantile and pearson residuals of the simulation for the plot envelope.

The method plot makes the envelope plot.

Author(s)

Rodrigo M. R. de Medeiros <rodrigo.matheus@ufrn.br>

References

Medeiros, R. M. R., and Bourguignon, M. (2025). Modified skew discrete Laplace regression models for integer valued data with applications to paired samples. Manuscript submitted for publication.

Examples

## Data set: pss (for description run ?pss)
barplot(table(pss$difference), xlab = "PSS index difference", ylab = "Frequency")
boxplot(pss$difference ~ pss$group, xlab = "Group", ylab = "PSS index difference")

## Fit with a model only for the mean (mode = 1)
fit <- sdlrm(difference ~ group, data = pss, xi = 1)

## Building the envelope plot
envel <- envelope(fit, plot = FALSE)

# Class
class(envel)
envel

# Plot for the randomized quantile residuals (default)
plot(envel)

# Plot for the Pearson residuals
plot(envel, type = "pearson")

Diagnostic Plots for the Modified Skew Discrete Laplace Regression

Description

This function provides plots for diagnostic analysis of a modified skew discrete Laplace regression fit.

Usage

## S3 method for class 'sdlrm'
plot(
  x,
  which = 1:4,
  type = c("quantile", "pearson", "response"),
  ask = prod(graphics::par("mfcol")) < length(which) && grDevices::dev.interactive(),
  pch = "+",
  lty = 2,
  ...
)

Arguments

x

an object of class "sdlrm", a result of a call to sdlrm.

which

numeric; if a subset of the plots is required, specify a subset of the numbers 1:6.

type

character; specifies which residual should be produced in the envelope plot. The available options are "quantile" (default), "pearson", and "response" (raw residuals, y - mu).

ask

logical; if TRUE, the user is asked before each plot.

pch, lty, ...

graphical parameters (see par)

Details

The plot method for "sdlrm" objects provides six types of diagnostic plots in the following order:

Residuals vs fitted values

a plot of the residuals against fitted values.

Residuals vs observation indices.

an index plot of the residuals against observation indices.

Normal probability plot

a normal probability plot of the residuals.

Fitted vs observed frequencies

a bar plot with comparisons of the observed and fitted frequencies.

Sample autocorrelation plot

sample autocorrelation function plot of the residuals.

Sample partial autocorrelation plot

sample partial autocorrelation function plot of the residuals.

The which argument can be used to select a subset of the implemented plots. Default is which = 1:4.

Value

plot method for "sdlrm" objects returns six types of diagnostic plots.

Author(s)

Francisco F. de Queiroz <felipeq@ime.usp.br>

Rodrigo M. R. de Medeiros <rodrigo.matheus@ufrn.br>

Examples

## Data set: pss (for description run ?pss)
barplot(table(pss$difference), xlab = "PSS index difference", ylab = "Frequency")
boxplot(pss$difference ~ pss$group, xlab = "Group", ylab = "PSS index difference")

## Fit with a model only for the mean (mode = 1)
fit <- sdlrm(difference ~ group, data = pss, xi = 1)

## Available plots (using the randomized quantile residuals):
# Residuals versus fitted values
plot(fit, which = 1)

# Residuals versus observation indices
plot(fit, which = 2)

# Normal Q-Q plot
plot(fit, which = 3)

# Observed versus fitted frequencies
plot(fit, which = 4)

# Sample autocorelation function of residuals
plot(fit, which = 5)

# Sample partial autocorelation of residuals
plot(fit, which = 6)

Predict Method for a Modified Skew Discrete Laplace Regression Fit

Description

Obtains predictions from a fitted modified skew discrete Laplace regression object.

Usage

## S3 method for class 'sdlrm'
predict(
  object,
  newdata = NULL,
  type = c("response", "dispersion", "variance", "quantile"),
  at = 0.5,
  na.action = stats::na.pass,
  ...
)

Arguments

object

an object of class "sdlrm", a result of a call to sdlrm.

newdata

optionally, a data frame in which to look for variables with which to predict. If omitted, the fitted linear predictors are used.

type

the type of prediction required. The default is on the scale of the response variable ("response"), that is, the fitted values (fitted means). The alternative "dispersion" provides the fitted dispersion parameters, while "variance" provides the fitted variances. Finally, the option "quantile" gives the fitted quantiles in the order specified via at.

at

the order of the quantile to be predicted if type = "quantile". The default is to predict the median, that is, at = 0.5.

na.action

function determining what should be done with missing values in newdata. The default is to predict NA.

...

arguments passed to or from other methods.

Value

A vector with the required predictions.

Author(s)

Rodrigo M. R. de Medeiros <rodrigo.matheus@ufrn.br>

References

Medeiros, R. M. R., and Bourguignon, M. (2025). Modified skew discrete Laplace regression models for integer valued data with applications to paired samples. Manuscript submitted for publication.

Examples

## Data set: pss (for description run ?pss)
barplot(table(pss$difference), xlab = "PSS index difference", ylab = "Frequency")
boxplot(pss$difference ~ pss$group, xlab = "Group", ylab = "PSS index difference")

## Fit a double model (mode = 1)
fit <- sdlrm(difference ~ group | group, data = pss, xi = 1)

## Fitted values (fitted means)
means <- predict(fit)
means

## Fitted dispersion parameter
phi <- predict(fit, type = "dispersion")
phi

## Fitted variances
vars <- predict(fit, type = "variance")
vars

## Fitted medians
medians <- predict(fit, type = "quantile")
medians

## Fitted third quartiles
quantiles <- predict(fit, type = "quantile", at = 0.75)
quantiles

Stress in Prison

Description

This data set consists of the stress levels presented by 26 individuals in an experimental study conducted by Verdot et al. (2010) in a French penitentiary. The inmates were divided into two groups, one formed by individuals who spontaneously opted to practice sports; and another one with those who did not wish to perform physical activity. The observations consist of the stress levels presented by detainees at the beginning and end of the experiment.

Usage

data(pss)

Format

A data frame with 26 observations on the following 4 variables.

Details

To measure the stress level, Verdot et al (2010) used the Perceived Stress Scale (PSS) (Cohen, Kamarck and Mermelstein, 1983), which is a discrete scale and one of the most used psychological tools to measure the levels of perceived non-specific stress in an individual.

References

Cohen, S., Kamarck, T., and Mermelstein, R. (1983). A global measure of perceived stress. Journal of Health and Social Behavior, 24, 385—396.

Verdot, C., Champely, S., Clément, M., and Massarelli, R. (2010). A simple tool to ameliorate detainees’ mood and well-being in prison: Physical activities. International Review on Sport & Violence, 2, 83—93.


Extract Model Residuals for a Modified Skew Discrete Laplace Regression Fit

Description

Residuals resulting from fitting a modified Laplace discrete skew regression.

Usage

## S3 method for class 'sdlrm'
residuals(object, type = c("quantile", "pearson", "response"), ...)

Arguments

object

an object of class "sdlrm", a result of a call to sdlrm.

type

character; specifies which residual should be extracted. The available arguments are "quantile" (randomized quantile residuals; default), "pearson" (Pearson residuals, i.e., (y - mean) / sd), and "response" (raw residuals, i.e., y - mean).

...

further arguments passed to or from other methods.

Value

A vector with the required residuals.

Examples

## Data set: pss (for description run ?pss)
barplot(table(pss$difference), xlab = "PSS index difference", ylab = "Frequency")
boxplot(pss$difference ~ pss$group, xlab = "Group", ylab = "PSS index difference")

## Fit with a model only for the mean (mode = 1)
fit <- sdlrm(difference ~ group, data = pss, xi = 1)

## Randomized quantile residuals
rq <- residuals(fit)

## Pearson residuals
rp <- residuals(fit, type = "pearson")

## Raw response residuals
rr <- residuals(fit, type = "response")

cbind(quantile = rq, pearson = rp, raw = rr)

Relative Renal Function by Scintigraphy

Description

Data from a study conducted by Domingues et al. (2006) to compare the renal function measurements of 111 patients with either 99mTc-DTPA or 99mTc-EC dynamic scintigraphies with that measured using 99mTc-DMSA static scintigraphy. The measurements reflect the percentage of total renal function in the left kidney and were obtained on a discrete scale.

Usage

data(scint)

Format

A data frame with 111 observations on the following 4 variables.

Details

Renal scintigraphy is a diagnostic imaging method of nuclear medicine used to measure kidney function. It is divided between static and dynamic, which differ in the procedure and the technical evaluation of the results. There are different radiopharmaceuticals used in the exam. For instance, static renal scintigraphies can use the technetium-99m dimercaptosuccinic acid (99mTc-DMSA), while dynamic scintigraphies can use the technetium-99m diethylenetriamine pentaacetic acid (99mTc-DTPA) or the technetium-99m ethylenedicysteine (99mTc-EC). The static renal agent 99mTc-DMSA is considered the most reliable method for measuring relative renal function (Kawashima et al., 1998; Martínez et al., 2002). However, this agent has drawbacks, such as relatively higher radiation dose (Kibar et al., 2003). Its comparison with different radiopharmaceuticals used in dynamic scintigraphy is of interest in the medical literature.

References

Domingues, F., Fujikawa, G., Decker, H., Alonso, G., Pereira, J., and Duarte, P. (2006). Comparison of relative renal function measured with either 99mTc-DTPA or 99mTc-EC dynamic scintigraphies with that measured with 99mTc-DMSA static scintigraphy. International Brazilian Journal of Urology, 32, 405—409.

Kibar, M., Yapar, Z., Noyan, A., and Anarat, A. (2003). Technetium-99m-N, N-ethylenedicysteine and Tc-99m DMSA scintigraphy in the evaluation of renal parenchymal abnormalities in children. Annals of Nuclear Medicine, 17, 219—225.

Kawashima, A., Sandler, C. M., and Goldman, S. M. (1998). Current roles and controversies in the imaging evaluation of acute renal infection. World Journal of Urology, 16, 9—17.

Martínez, M., JM, G. D., FJ, D. V., et al. (2002). Comparative study of differential renal function by DMSA and MAG-3 in congenital unilateral uropathies. Cirugía Pediátrica, 15, 118—121.


The Modified Skew Discrete Laplace Distribution

Description

Probability mass function, distribution function, quantile function, and a random generation for the modified skew discrete Laplace (SDL) distribution with mean mu, dispersion parameter phi, and mode xi.

Usage

dsdl(x, mu, phi, xi = 0, log = FALSE)

psdl(q, mu, phi, xi = 0, lower.tail = TRUE)

qsdl(p, mu, phi, xi = 0, lower.tail = TRUE)

rsdl(n, mu, phi, xi = 0)

Arguments

x, q

vector of integer quantiles.

mu

vector of means.

phi

vector of dispersion parameters (greater than abs(mu - xi)).

xi

the mode of the distribution, an integer value.

log

logical; if TRUE, probabilities p are given as log(p).

lower.tail

logical; if TRUE (default), probabilities are P(X <= x), otherwise, P(X > x).

p

vector of probabilities.

n

number of random values to return.

Details

The SDL distribution was introduced by Kozubowski and Inusah (2006) as the discrete part of the continuous skew Laplace distribution centered at zero (Kotz et al., 2001, Ch. 3). Although the SDL distribution has attractive properties, the discrete version of the zero-centered skew Laplace distribution induces that the mode of the resulting model is always equal to zero.

To overcome this limitation, Medeiros and Bourguignon (2025) proposed to obtain the discrete version of the Laplace skew distribution without setting its location parameter to zero, defining a new probability model that generalizes the SDL distribution.

This set of functions represents the probability mass function, the cumulative distribution function, the quantile function, and a random number generator for the modified SDL distribution parameterized in terms of mu (mean), phi (a dispersion parameter), and xi (the mode of the distribution).

Let X be a discrete random variable following a SDL distribution with mean \mu, dispersion parameter \phi, and mode \xi. The probability mass function of X is

\textrm{P}(X = x) = \left\{\begin{array}{ll} \dfrac{1}{1 + \phi}\left(\dfrac{\phi - \mu + \xi}{2+ \phi - \mu + \xi}\right)^{-(x - \xi)}, & x \in \{\xi - 1, \xi - 2, \ldots\}, \\ \\ \dfrac{1}{1 + \phi}\left(\dfrac{\phi + \mu - \xi}{2+ \phi + \mu - \xi}\right)^{x - \xi}, & x \in \{\xi, \xi + 1, \xi + 2, \ldots\}. \end{array}\right.

The parametric space of this parameterization satisfies the constraint \mu \in \mathbb{R}, \phi > |\mu - \xi| , and \xi \in \mathbb{Z}. Additionally, the expected value and the variance of X are given, respectively, by

\textrm{E}(Y) = \mu \quad \mbox{ and } \quad \textrm{Var}(Y) = \dfrac{\phi(\phi + 2) + (\mu - \xi)^2}{2}.

Value

dsdl returns the probability mass function, psdl gives the distribution function, qsdl gives the quantile function, and rsdl generates random observations.

Author(s)

Rodrigo M. R. de Medeiros <rodrigo.matheus@ufrn.br>

References

Kotz, S., Kozubowski, T. J., and Podgórski, K. (2001). The Laplace Distribution and Generalizations: A Revisit with Applications to Communications, Economics, Engineering, and Finance. Birkhauser, Boston.

Kozubowski, T. J., and Inusah, S. (2006). A skew Laplace distribution on integers. Annals of the Institute of Statistical Mathematics, 58, 555—571.

Medeiros, R. M. R., and Bourguignon, M. (2025). Modified skew discrete Laplace regression models for integer valued data with applications to paired samples. Manuscript submitted for publication.

Examples

### Probability function ###

# Parameters
mu <- c(-4, 2, 4)
phi <- 6.5
xi <- 2

xvals <- -30:30

# Skewed-left distribution (mu < xi)
plot(xvals, dsdl(xvals, mu[1], phi, xi),
     type = "h", xlab = "x", ylab = "Pmf")

# Symmetric distribution (mu = xi)
plot(xvals, dsdl(xvals, mu[2], phi, xi),
     type = "h", xlab = "x", ylab = "Pmf")

# Skewed-right distribution (mu > 0)
plot(xvals, dsdl(xvals, mu[3], phi, xi),
     type = "h", xlab = "x", ylab = "Pmf")

### Difference between paired samples of non-negative observations  ###

# Parameters
mu <- 3
phi <- 4
xi <- 0

# Paired samples of a pre-post treatment experimental study
before <- rgeom(1000, 2 / (2 + phi - mu))
after <- rgeom(1000, 2 / (2 + phi + mu))

# Response variable
y <- after - before

# Barplot
obj <- barplot(prop.table(table(y)),
               xlab = "Response",
               ylab = "Proportion",
               col = "white",
               ylim = c(0, mean(y == 0) + 0.01))

# Sdl model for the differences
points(obj, dsdl(sort(unique(y)), mu, phi, xi), col = "red", pch = 16)

Optimization Control Parameters Passed to optim

Description

Optimization parameters passed to optim for the fit of an modified skew discrete Laplace (SDL) regression model via sdlrm. This function acts in the same spirit as betareg.control from the betareg package. Its primary purpose is to gather all the optimization control arguments in a single function.

Usage

sdl_control(
  method = "BFGS",
  maxit = 8000,
  hessian = FALSE,
  start = NULL,
  reltol = 1e-10,
  ...
)

Arguments

method

the method to be used. See "Details" in optim. The default method ("BFGS") is a quasi-Newton method (also known as a variable metric algorithm), specifically that published simultaneously in 1970 by Broyden, Fletcher, Goldfarb and Shanno.

maxit

the maximum number of iterations of the algorithm. Defaults to 2000.

hessian

logical. Should a numerically differentiated Hessian matrix be returned?

start

an optional vector with starting values for all parameters for fitting an SDL regression model. It must be passed in the order: (beta, gamma), where beta and gamma are regression coefficients associated with the mean and dispersion regression submodels, respectively.

reltol

relative convergence tolerance. The algorithm stops if it is unable to reduce the value by a factor of reltol * (abs(val) + reltol) at a step. Defaults to 1e-10.

...

further arguments to be passed to optim.

Value

A list with the arguments specified.

Author(s)

Rodrigo M. R. de Medeiros <rodrigo.matheus@ufrn.br>

References

Cribari-Neto, F., and Zeileis, A. (2010). Beta regression in R. Journal of statistical software, 34, 1-24.

Examples

# Data set: pss (for description run ?pss)
barplot(table(pss$difference), xlab = "PSS index difference", ylab = "Frequency")
boxplot(pss$difference ~ pss$group, xlab = "Group", ylab = "PSS index difference")

## Fit of the model using the Fisher information matrix to obtain the covariance
## matrix of the coefficients
fit1 <- sdlrm(difference ~ group, data = pss, xi = 1)

## Fit of the model using the numerical Hessian matrix provided by optim
fit2 <- sdlrm(difference ~ group, data = pss, xi = 1, hessian = TRUE)

## Compare the reported standard errors
summary(fit1)
summary(fit2)

Modified Skew Discrete Laplace Regression for Integer-Valued Data

Description

Fit of the modified skew discrete Laplace (SDL) regression model via maximum likelihood for a parameterization of this distribution that is indexed by the mean, a dispersion parameter, and the mode (xi).

Usage

sdlrm(
  formula,
  data,
  subset,
  na.action,
  phi.link = "log",
  xi = 0,
  control = sdl_control(...),
  ...
)

## S3 method for class 'sdlrm'
print(x, digits = max(3, getOption("digits") - 3), ...)

Arguments

formula

a symbolic description of the model, of type y ~ x for covariates in mean only, or y ~ x | z to enter covariates in the dispersion parameter.

data

an optional data frame containing the variables in the formula. By default the variables are taken from environment(formula).

subset

an optional vector specifying a subset of observations to be used in the fitting process. (See additional details about how this argument interacts with data-dependent bases in the ‘Details’ section of the model.frame documentation.)

na.action

a function which indicates what should happen when the data contain NAs. The default is set by the na.action setting of options, and is na.fail if that is unset. The ‘factory-fresh’ default is na.omit. Another possible value is NULL, no action. Value na.exclude can be useful.

phi.link

character specification of the link function for the dispersion parameter. The links "log" (default) "sqrt" and "identity" can be used.

xi

the mode of the distribution, an integer value.

control

a list of control arguments specified via sdl_control.

...

arguments passed to optim via sdl_control.

x

a fitted model object of class "sdlrm".

digits

a non-null value for digits specifies the minimum number of significant digits to be printed in values.

Value

The sdlrm function returns an object of class "sdlrm", which consists of a list with the following components:

coefficients

a list containing the elements "mean" and "dispersion" that consist of the estimates of the coefficients associated with the mean and the dispersion parameter, respectively.

fitted.values

a vector with the fitted means.

phi

a vector with the fitted dispersion parameters.

phi.link

the link function used for the dispersion parameter model.

xi

the specified mode for the model.

logLik

log-likelihood value of the fitted model.

vcov

asymptotic covariance matrix of the maximum likelihood estimator of the model parameters vector.

nobs

Sample size.

y

the response vector.

x

a list with elements "mean" and "dispersion" containing the model matrices from the respective models.

optim.pars

object returned by optim function in the sdlrm function.

call

the function call.

formula

the formula used to specify the model in sdlrm.

terms

a list with elements "mean", "dispersion" and "full" containing the terms objects for the respective models.

The print() function returns a basic summary of the model fit with the estimated coefficients, the log-likelihood value, the mode specified in the fit, and the Akaike (AIC) and Bayesian (BIC) information criteria.

Author(s)

Rodrigo M. R. de Medeiros <rodrigo.matheus@ufrn.br>

References

Medeiros, R. M. R., and Bourguignon, M. (2025). Modified skew discrete Laplace regression models for integer valued data with applications to paired samples. Manuscript submitted for publication.

See Also

summary.sdlrm for more detailed summaries, residuals.sdlrm to extract residuals from the fitted model, predict.sdlrm for predictions, including mean and dispersion fitted values, fitted variances, and fitted quantiles, plot.sdlrm for diagnostic plots. choose_mode for mode estimation via profile likelihood. envelope to create normal probability graphs with simulated envelope. disp_test to test the hypothesis of constant dispersion. Information on additional methods for "sdlrm" objects can be found at sdlrm-methods.

Examples

# Data set: pss (for description run ?pss)
barplot(table(pss$difference), xlab = "PSS index difference", ylab = "Frequency")
boxplot(pss$difference ~ pss$group, xlab = "Group", ylab = "PSS index difference")

# Fit with a model only for the mean (mode = 1)
fit0 <- sdlrm(difference ~ group, data = pss, xi = 1)
fit0
summary(fit0)

# Fit a double model (mean and dispersion)
fit <- sdlrm(difference ~ group | group, data = pss, xi = 1)
fit
summary(fit)

Extract Information From a Modified Skew Discrete Laplace Regression Fit

Description

Additional methods for "sdlrm" objects.

Usage

## S3 method for class 'sdlrm'
model.frame(formula, ...)

## S3 method for class 'sdlrm'
model.matrix(object, parm = c("mean", "dispersion"), ...)

## S3 method for class 'sdlrm'
coef(object, parm = c("mean", "dispersion", "full"), ...)

## S3 method for class 'sdlrm'
vcov(object, parm = c("mean", "dispersion", "full"), ...)

## S3 method for class 'sdlrm'
logLik(object, ...)

## S3 method for class 'sdlrm'
AIC(object, ..., k = 2)

Arguments

formula

a model formula or terms object or an "sdlrm" object.

...

further arguments passed to or from other methods.

object

an object of class "sdlrm", a result of a call to sdlrm.

parm

a character indicating which group of parameters is to be considered in the function. The options are "mean" (default) to obtain the output in relation to the coefficients associated with the mean, "dispersion" to obtain the output in relation to the coefficients associated with the dispersion, or "full" (when applicable) to consider all the parameters,

k

numeric, the penalty per parameter to be used; the default k = 2 is the classical AIC.

Value

Author(s)

Rodrigo M. R. de Medeiros <rodrigo.matheus@ufrn.br>

Examples

# Data set: pss (for description run ?pss)
barplot(table(pss$difference), xlab = "PSS index difference", ylab = "Frequency")
boxplot(pss$difference ~ pss$group, xlab = "Group", ylab = "PSS index difference")

# Fit a double model (mode = 1)
fit <- sdlrm(difference ~ group | group, data = pss, xi = 1)

# Coef
coef(fit)
coef(fit, parm = "dispersion")
coef(fit, parm = "full")

# vcov
vcov(fit)
vcov(fit, parm = "dispersion")
vcov(fit, parm = "full")

# Log-likelihood value
logLik(fit)

# AIC and BIC
AIC(fit)
AIC(fit, k = log(fit$nobs))

# Model matrices
model.matrix(fit)
model.matrix(fit, "dispersion")

Summarizing a Modified Skew Discrete Laplace Regression Fit

Description

summary method for class "sdlrm".

Usage

## S3 method for class 'sdlrm'
summary(object, ...)

## S3 method for class 'summary.sdlrm'
print(x, digits = getOption("digits"), ...)

Arguments

object

an object of class "sdlrm", a result of a call to sdlrm.

...

further arguments passed to or from other methods.

x

an object of class "summary.sdlrm", a result of a call to summary.sdlrm.

digits

a non-null value for digits specifies the minimum number of significant digits to be printed in values.

Value

The function summary.sdlrm returns an object of class "summary.sdlrm", which consists of a list with the following components:

call

the original function call, given in object.

mean

summary statistics for the mean regression structure.

dispersion

summary statistics for the dispersion regression structure.

xi

the specified mode for the model.

phi.link

the link function used for the dispersion parameter model.

residuals

the randomized quantile residuals.

pR2

the pseudo-R2 for integer-valued regression models, as introduced by Medeiros and Bourguignon (2025).

logLik

log-likelihood value of the fitted model.

AIC, BIC

Akaike and Bayesian information criteria.

Author(s)

Francisco F. de Queiroz <felipeq@ime.usp.br>

Rodrigo M. R. de Medeiros <rodrigo.matheus@ufrn.br>

References

Medeiros, R. M. R., and Bourguignon, M. (2025). Modified skew discrete Laplace regression models for integer valued data with applications to paired samples. Manuscript submitted for publication.

Examples

# Data set: pss (for description run ?pss)
barplot(table(pss$difference), xlab = "PSS index difference", ylab = "Frequency")
boxplot(pss$difference ~ pss$group, xlab = "Group", ylab = "PSS index difference")

# Fit with a model only for the mean (mode = 1)
fit0 <- sdlrm(difference ~ group, data = pss, xi = 1)
summary(fit0)

# Fit a double model (mean and dispersion)
fit <- sdlrm(difference ~ group | group, data = pss, xi = 1)
summary(fit)

mirror server hosted at Truenetwork, Russian Federation.