The main function of the ‘gfilogisreg’ package is `gfilogisreg`

. It simulates the fiducial distribution of the parameters of a logistic regression model.

To illustrate it, we will consider a logistic dose-response model for inference on the median lethal dose. The median lethal dose (LD50) is the amount of a substance, such as a drug, that is expected to kill half of its users.

The results of LD50 experiments can be modeled using the relation \[ \textrm{logit}(p_i) = \beta_1(x_i - \mu) \] where \(p_i\) is the probability of death at the dose administration \(x_i\), and \(\mu\) is the median lethal dose, i.e. the dosage at which the probability of death is \(0.5\). The \(x_i\) are known while \(\beta_1\) and \(\mu\) are fixed effects that are unknown.

This relation can be written in the form \[ \textrm{logit}(p_i) = \beta_0 + \beta_1 x_i \] with \(\mu = -\beta_0 / \beta_1\).

We will perform the fiducial inference in this model with the following data:

```
<- data.frame(
dat x = c(
-2, -2, -2, -2, -2,
-1, -1, -1, -1, -1,
0, 0, 0, 0, 0,
1, 1, 1, 1, 1,
2, 2, 2, 2, 2
),y = c(
1, 0, 0, 0, 0,
1, 1, 1, 0, 0,
1, 1, 0, 0, 0,
1, 1, 1, 1, 0,
1, 1, 1, 1, 1
) )
```

Let’s go:

```
library(gfilogisreg)
set.seed(666L)
<- gfilogisreg(y ~ x, data = dat, N = 500L) fidsamples
```

Here are the fiducial estimates and \(95\%\)-confidence intervals of the parameters \(\beta_0\) and \(\beta_1\):

```
gfiSummary(fidsamples)
#> mean median lwr upr
#> (Intercept) 0.5510683 0.5099083 -0.4386194 1.662866
#> x 0.9153775 0.8728642 0.2119688 1.944350
#> attr(,"confidence level")
#> [1] 0.95
```

The fiducial estimates are close to the maximum likelihood estimates:

```
glm(y ~ x, data = dat, family = binomial())
#>
#> Call: glm(formula = y ~ x, family = binomial(), data = dat)
#>
#> Coefficients:
#> (Intercept) x
#> 0.5639 0.9192
#>
#> Degrees of Freedom: 24 Total (i.e. Null); 23 Residual
#> Null Deviance: 33.65
#> Residual Deviance: 26.22 AIC: 30.22
```

Now let us draw the fiducial \(95\%\)-confidence interval about our parameter of interest \(\mu\):

```
gfiConfInt(~ -`(Intercept)`/x, fidsamples)
#> 2.5% 97.5%
#> -2.6565460 0.6644137
```