I can calculate the motion of heavenly bodies but not the madness of people. -Isaac Newton

## Estimate Regression with (Type-I) Pareto Response

The Type-I Pareto distribution has a probability function shown as below

f(y; a, k) = k * (a ^ k) / (y ^ (k + 1))

In the formulation, the scale parameter 0 < a < y and the shape parameter k > 1 .

The positive lower bound of Type-I Pareto distribution is particularly appealing in modeling the severity measure in that there is usually a reporting threshold for operational loss events. For instance, the reporting threshold of ABA operational risk consortium data is \$10,000 and any loss event below the threshold value would be not reported, which might add the complexity in the severity model estimation.

In practice, instead of modeling the severity measure directly, we might model the shifted response y` = severity – threshold to accommodate the threshold value such that the supporting domain of y` could start from 0 and that the Gamma, Inverse Gaussian, or Lognormal regression can still be applicable. However, under the distributional assumption of Type-I Pareto with a known lower end, we do not need to shift the severity measure anymore but model it directly based on the probability function.

Below is the R code snippet showing how to estimate a regression model for the Pareto response with the lower bound a = 2 by using the VGAM package.

```library(VGAM)
set.seed(2017)
n <- 200
a <- 2
x <- runif(n)
k <- exp(1 + 5 * x)
pdata <- data.frame(y = rpareto(n = n, scale = a, shape = k), x = x)
fit <- vglm(y ~ x, paretoff(scale = a), data = pdata, trace = TRUE)
summary(fit)
# Coefficients:
#             Estimate Std. Error z value Pr(>|z|)
# (Intercept)   1.0322     0.1363   7.574 3.61e-14 ***
# x             4.9815     0.2463  20.229  < 2e-16 ***
AIC(fit)
#  -644.458
BIC(fit)
#  -637.8614
```

The SAS code below estimating the Type-I Pareto regression provides almost identical model estimation.

```proc nlmixed data = pdata;
parms b0 = 0.1 b1 = 0.1;
k = exp(b0 + b1 * x);
a = 2;
lh = k * (a ** k) / (y ** (k + 1));
ll = log(lh);
model y ~ general(ll);
run;
/*
Fit Statistics
-2 Log Likelihood               -648.5
AIC (smaller is better)         -644.5
AICC (smaller is better)        -644.4
BIC (smaller is better)         -637.9

Parameter Estimate   Standard   DF    t Value   Pr > |t|
Error
b0        1.0322     0.1385     200    7.45     <.0001
b1        4.9815     0.2518     200   19.78     <.0001
*/
```

At last, it is worth pointing out that the conditional mean of Type-I Pareto response is not equal to exp(x * beta) but a * k / (k – 1) with k = exp(x * beta) . Therefore, the conditional mean only exists when k > 1 , which might cause numerical issues in the model estimation.

Written by statcompute

December 11, 2016 at 5:12 pm

Tagged with , ,

## Pregibon Test for Goodness of Link in SAS

When estimating generalized linear models for binary outcomes, we often choose the logit link function by default and seldom consider other alternatives such as probit or cloglog. The Pregibon test (Pregibon, 1980) provides a mean to check the goodness of link with a simple logic outlined below.

1. First of all, we can estimate the regression model with the hypothesized link function, e.g. logit;
2. After the model estimation, we calculate yhat and yhat ^ 2 and then estimate a secondary regression with the identical response variable Y and link function but with yhat and yhat ^ 2 as model predictors (with the intercept).
3. If the link function is correctly specified, then the t-value of yaht ^2 should be insignificant.

The SAS macro shown below is the implementation of Pregibon test in the context of logistic regressions. However, the same idea can be generalized to any GLM.

```%macro pregibon(data = , y = , x = );
***********************************************************;
* SAS MACRO PERFORMING PREGIBON TEST FOR GOODNESS OF LINK *;
* ======================================================= *;
* INPUT PAREMETERS:                                       *;
*  DATA : INPUT SAS DATA TABLE                            *;
*  Y    : THE DEPENDENT VARIABLE WITH 0 / 1 VALUES        *;
*  X    : MODEL PREDICTORS                                *;
* ======================================================= *;
* AUTHOR: WENSUI.LIU@53.COM                               *;
***********************************************************;
options mprint mlogic nocenter;

%let links = logit probit cloglog;
%let loop = 1;

proc sql noprint;
select n(&data) - 3 into :df from &data;
quit;

%do %while (%scan(&links, &loop) ne %str());

proc logistic data = &data noprint desc;
score data = &data out = _out1;
run;

data _out2;
set _out1(rename = (p_1 = p1));
p2 = p1 * p1;
run;

ods listing close;
ods output ParameterEstimates = _parm;
proc logistic data = _out2 desc;
run;
ods listing;

%if &loop = 1 %then %do;
data _parm1;
set _parm(where = (variable = "p2"));
run;
%end;
%else %do;
data _parm1;
set _parm1 _parm(where = (variable = "p2") in = new);
run;
%end;

data _parm2(drop = variable);
set _parm1;
_t = estimate / stderr;
_df = &df;
_p = (1 - probt(abs(_t), _df)) * 2;
run;

%let loop = %eval(&loop + 1);

%end;

title;
proc report data = _last_ spacing = 1 headline nowindows split = "*";
column(" * PREGIBON TEST FOR GOODNESS OF LINK
* H0: THE LINK FUNCTION IS SPECIFIED CORRECTLY * "
define link / "LINK FUNCTION" width = 15 order order = data;
define _t   / "T-VALUE"       width = 15 format = 12.4;
define _df  / "DF"            width = 10;
define _p   / "P-VALUE"       width = 15 format = 12.4;
run;

%mend;
```

After applying the macro to the kyphosis data (https://stat.ethz.ch/R-manual/R-devel/library/rpart/html/kyphosis.html), we can see that both logit and probit can be considered appropriate link functions in this specific case and cloglog might not be a good choice.

```             PREGIBON TEST FOR GOODNESS OF LINK
H0: THE LINK FUNCTION IS SPECIFIED CORRECTLY