| Title: | Modified Skew Discrete Laplace Regression for Integer-Valued and Paired Discrete Data |
|---|---|
| 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. |
| Authors: | Rodrigo Medeiros [aut, cre] |
| Maintainer: | Rodrigo Medeiros <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.2 |
| Built: | 2026-05-29 09:56:21 UTC |
| Source: | https://github.com/rdmatheus/sdlrm |
Estimation of the mode in a modified skew discrete Laplace (SDL) regression fit via profile log-likelihood.
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, ...)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, ...)
object |
an object of class |
grid |
grid of values that will be used to evaluate the profile log-likelihood function. |
trace |
logical; if |
plot |
logical; if |
control |
a list of control arguments specified via |
... |
further arguments passed to |
x |
an object of class |
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.
Rodrigo M. R. de Medeiros <[email protected]>
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.
# 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]]# 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]]
Hypothesis test on constant dispersion in the modified skew discrete Laplace regression.
disp_test(object)disp_test(object)
object |
an object of class |
the function disp_test returns the values and corresponding asymptotic
p-values of the score, Wald, likelihood ratio, and gradient test statistics
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.
## 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)## 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)
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.
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, ...)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, ...)
object, x
|
an object of class |
nsim |
the number of replicates. The default is |
progressBar |
logical; if |
plot |
logical; if |
... |
further arguments passed to or from other methods. |
type |
character; specifies which residual should be produced in the
envelope plot. The available options are |
level |
level of the sample quantile of the residual used in the construction of confidence bands. |
envelope returns an "sdlrm_envel" object which consists of
a list with the following components:
a list with the quantile and pearson residuals resulting from the fit of the SDL regression model.
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.
Rodrigo M. R. de Medeiros <[email protected]>
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.
## 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")## 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")
This function provides plots for diagnostic analysis of a modified skew discrete Laplace regression fit.
## 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, ... )## 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, ... )
x |
an object of class |
which |
numeric; if a subset of the plots is required, specify a subset
of the numbers |
type |
character; specifies which residual should be produced in the
envelope plot. The available options are |
ask |
logical; if |
pch, lty, ...
|
graphical parameters (see |
The plot method for "sdlrm" objects provides six types
of diagnostic plots in the following order:
a plot of the residuals against fitted values.
an index plot of the residuals against observation indices.
a normal probability plot of the residuals.
a bar plot with comparisons of the observed and fitted frequencies.
sample autocorrelation function plot of the residuals.
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.
plot method for "sdlrm" objects returns six types
of diagnostic plots.
Francisco F. de Queiroz <[email protected]>
Rodrigo M. R. de Medeiros <[email protected]>
## 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)## 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)
Obtains predictions from a fitted modified skew discrete Laplace regression object.
## S3 method for class 'sdlrm' predict( object, newdata = NULL, type = c("response", "dispersion", "variance", "quantile"), at = 0.5, na.action = stats::na.pass, ... )## S3 method for class 'sdlrm' predict( object, newdata = NULL, type = c("response", "dispersion", "variance", "quantile"), at = 0.5, na.action = stats::na.pass, ... )
object |
an object of class |
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 |
at |
the order of the quantile to be predicted if
|
na.action |
function determining what should be done with missing
values in |
... |
arguments passed to or from other methods. |
A vector with the required predictions.
Rodrigo M. R. de Medeiros <[email protected]>
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.
## 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## 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
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.
data(pss)data(pss)
A data frame with 26 observations on the following 4 variables.
group: a factor, which identifies whether the individual belongs to the control or the experimental group.
pss_before: stress measurement before training.
pss_after: stress measurement before training.
difference: the difference between the stress levels obtained
at the end of the experiment and at the beginning, that is, pss_after - pss_before.
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.
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.
Residuals resulting from fitting a modified Laplace discrete skew regression.
## S3 method for class 'sdlrm' residuals(object, type = c("quantile", "pearson", "response"), ...)## S3 method for class 'sdlrm' residuals(object, type = c("quantile", "pearson", "response"), ...)
object |
an object of class |
type |
character; specifies which residual should be extracted.
The available arguments are |
... |
further arguments passed to or from other methods. |
A vector with the required residuals.
## 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)## 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)
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.
data(scint)data(scint)
A data frame with 111 observations on the following 4 variables.
static: measurements obtained by static scintigraphy.
dynamic: measurements obtained by dynamic scintigraphy, which may have been
performed with the radiopharmaceutical 99mTc-DTPA or 99mTc-EC.
difference: the difference between the renal functions measured using dynamic and
static scintigraphies, that is, dynamic - static.
agent: a factor with the radiopharmaceutical used in the dynamic scintigraphy, with
levels "DTPA" and "EC".
age: the patient age, in years.
sex: a factor with the patient gender, with levels "F" and "M".
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.
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.
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.
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)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)
x, q
|
vector of integer quantiles. |
mu |
vector of means. |
phi |
vector of dispersion parameters (greater than |
xi |
the mode of the distribution, an integer value. |
log |
logical; if |
lower.tail |
logical; if |
p |
vector of probabilities. |
n |
number of random values to return. |
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 be a discrete random variable following a SDL distribution with mean ,
dispersion parameter , and mode . The probability mass function of X is
The parametric space of this parameterization satisfies the constraint ,
, and . Additionally, the expected value and
the variance of are given, respectively, by
dsdl returns the probability mass function, psdl
gives the distribution function, qsdl gives the quantile function,
and rsdl generates random observations.
Rodrigo M. R. de Medeiros <[email protected]>
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.
### 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)### 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 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.
sdl_control( method = "BFGS", maxit = 8000, hessian = FALSE, start = NULL, reltol = 1e-10, ... )sdl_control( method = "BFGS", maxit = 8000, hessian = FALSE, start = NULL, reltol = 1e-10, ... )
method |
the method to be used. See "Details" in |
maxit |
the maximum number of iterations of the algorithm. Defaults to |
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: |
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 |
... |
further arguments to be passed to |
A list with the arguments specified.
Rodrigo M. R. de Medeiros <[email protected]>
Cribari-Neto, F., and Zeileis, A. (2010). Beta regression in R. Journal of statistical software, 34, 1-24.
# 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)# 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)
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).
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), ...)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), ...)
formula |
a symbolic description of the model, of type |
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 |
phi.link |
character specification of the link function for the dispersion parameter. The links
|
xi |
the mode of the distribution, an integer value. |
control |
a list of control arguments specified via |
... |
arguments passed to |
x |
a fitted model object of class |
digits |
a non-null value for digits specifies the minimum number of significant digits to be printed in values. |
The sdlrm function returns an object of class "sdlrm", which consists of a
list with the following components:
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.
a vector with the fitted means.
a vector with the fitted dispersion parameters.
the link function used for the dispersion parameter model.
the specified mode for the model.
log-likelihood value of the fitted model.
asymptotic covariance matrix of the maximum likelihood estimator of the model parameters vector.
Sample size.
the response vector.
a list with elements "mean" and "dispersion" containing the
model matrices from the respective models.
object returned by optim function in the sdlrm function.
the function call.
the formula used to specify the model in sdlrm.
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.
Rodrigo M. R. de Medeiros <[email protected]>
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.
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.
# 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)# 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)
Additional methods for "sdlrm" objects.
## 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)## 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)
formula |
|
... |
further arguments passed to or from other methods. |
object |
an object of class |
parm |
a character indicating which group of parameters is to be considered in the function.
The options are |
k |
numeric, the penalty per parameter to be used; the default
|
model.frame returns a data.frame containing the variables required
by formula and any additional arguments provided via ....
model.matrix returns the design matrix used in the regression structure,
as specified by the parm argument.
coef returns a numeric vector of estimated regression coefficients, based
on the parm argument. If parm = "full", it returns a list with the
components "mean" and "dispersion", each containing the corresponding
coefficient estimates.
vcov returns the asymptotic covariance matrix of the regression coefficients,
based on the parm argument.
logLik returns the log-likelihood value of the fitted model.
AIC returns a numeric value representing the Akaike Information Criterion
(AIC), Bayesian Information Criterion, or another criterion, depending on k.
Rodrigo M. R. de Medeiros <[email protected]>
# 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")# 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")
summary method for class "sdlrm".
## S3 method for class 'sdlrm' summary(object, ...) ## S3 method for class 'summary.sdlrm' print(x, digits = getOption("digits"), ...)## S3 method for class 'sdlrm' summary(object, ...) ## S3 method for class 'summary.sdlrm' print(x, digits = getOption("digits"), ...)
object |
an object of class |
... |
further arguments passed to or from other methods. |
x |
an object of class |
digits |
a non-null value for digits specifies the minimum number of significant digits to be printed in values. |
The function summary.sdlrm returns an object of class "summary.sdlrm",
which consists of a list with the following components:
the original function call, given in object.
summary statistics for the mean regression structure.
summary statistics for the dispersion regression structure.
the specified mode for the model.
the link function used for the dispersion parameter model.
the randomized quantile residuals.
the pseudo-R2 for integer-valued regression models, as introduced by Medeiros and Bourguignon (2025).
log-likelihood value of the fitted model.
Akaike and Bayesian information criteria.
Francisco F. de Queiroz <[email protected]>
Rodrigo M. R. de Medeiros <[email protected]>
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.
# 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)# 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)