Author: Jorge Cabral

# Two-stage ME estimation

#### Jorge Cabral

## Introduction

As stated in “Generalized Cross Entropy framework”, the common situation is the absence of prior information on \(\mathbf{p} = (\mathbf{p_0}',\mathbf{p_1}',\dots,\mathbf{p_K}')'\). Yet, it is possible to include some pre-sample information in the form of \(\mathbf{q} = (\mathbf{q_0}',\mathbf{q_1}',\dots,\mathbf{q_K}')'\).

## Two-stage

If we assume that generally there is no information on \(\mathbf{p}\) we are defining a uniform distribution for \(\mathbf{p}\) and ME estimation is done in the GME framework (see “Generalized Maximum Entropy framework”). From that estimation we can also obtain \(\mathbf{\hat p}\). If we use \(\mathbf{\hat p}\) as the prior distribution \(\mathbf{q}\) we can perform a ME estimation in the GCE framework (see “Generalized Cross Entropy framework”). This procedures can be repeated as many times as required.

Consider `dataThesis` (see “Generalized Maximum Entropy framework” and “Choosing the supports spaces”).

The two steps GCE estimation can be done by assigning to the argument `twosteps.n` a value different from \(0\). Let us consider \(10\) GCE estimations after a first GME estimation (by default `support.signal.points = c(1/5, 1/5, 1/5, 1/5, 1/5)`).

    res.lmgce.1se.twosteps <-
      GCEstim::lmgce(
        y ~ .,
        data = dataThesis,
        twosteps.n = 10
      )
    #> Warning in GCEstim::lmgce(y ~ ., data = dataThesis, twosteps.n = 10):
    #>
    #> The minimum error was found for the highest upper limit of the
    #>             support. Confirm if higher values should be tested.

The trace of the prediction CV-error can be obtained with `plot` and `which = 6`

    plot(res.lmgce.1se.twosteps, which = 6)$p6

The pre reestimation CV-error is depicted by the red dot, intermediate CV-errors are represented by orange dots and final/reestimated CV-error corresponds to the dark red dot. The horizontal dotted line represents the OLS CV-error. Note that with 1 reestimation the CV-error decreases and the stays stable.
Since we are working with simulated data, the true coefficients are known and the precision error can be determined. The arguments `which = 7` and `coef = coef.dataThesis` of `plot` allows to obtain the trace

    plot(res.lmgce.1se.twosteps, which = 7, coef = coef.dataThesis)$p7

We can see that the precision error remains stable. Generally it is recommended to perform only \(1\) GCE reestimation. That can be done by setting `twosteps.n = 1`, the default of `lmgce`

    res.lmgce.1se.twosteps.1 <-
      GCEstim::lmgce(
        y ~ .,
        data = dataThesis
      )

or use `update`

    res.lmgce.1se.twosteps.1 <- update(res.lmgce.1se.twosteps, twosteps.n = 1)

or, since data is already stored in the `object` we can use the `changestep` function. This last options is the recommended in this case.

    res.lmgce.1se.twosteps.1 <- changestep(res.lmgce.1se.twosteps, 1)

`plot` with `which = 2` gives us the “Prediction Error vs supports” plot

    plot(res.lmgce.1se.twosteps.1, which = 2)$p2

and with `which = 3` we get the “Estimates vs supports” plot.

    plot(res.lmgce.1se.twosteps.1, which = 3)$p3

In the last two plots are depicted the final solutions. That is to say that after choosing the support spaces limits based on the defined error, the number of points of the support spaces and their probability `support.signal.points = c(1/5, 1/5, 1/5, 1/5, 1/5)`, `twosteps.n = 1` extra estimation(s) is(are) performed. This estimation uses the GCE framework even if the previous steps were by default on the GME framework. The distribution of probabilities used is the one estimated for the chosen support spaces and it is stored in `object$p0`.

    res.lmgce.1se.twosteps.1$p0
    #>                   p_1       p_2        p_3        p_4        p_5
    #> (Intercept) 0.7765862 0.1738391 0.03891393 0.00871090 0.00194994
    #> X001        0.1805333 0.1897807 0.19950181 0.20972083 0.22046329
    #> X002        0.5508961 0.2536953 0.11683017 0.05380191 0.02477652
    #> X003        0.3663295 0.2533743 0.17524802 0.12121147 0.08383673
    #> X004        0.2856466 0.2344356 0.19240585 0.15791119 0.12960076

The final estimated vector of probabilities, `object$p`, is

    res.lmgce.1se.twosteps.1$p
    #>                   p_1       p_2        p_3        p_4        p_5
    #> (Intercept) 0.7766072 0.1738273 0.03890761 0.00870866 0.00194925
    #> X001        0.1804988 0.1897617 0.19950000 0.20973803 0.22050147
    #> X002        0.5509065 0.2536937 0.11682650 0.05379887 0.02477450
    #> X003        0.3662867 0.2533674 0.17525898 0.12122992 0.08385701
    #> X004        0.2856185 0.2344269 0.19241041 0.15792455 0.12961962

## Conclusion

Doing a comparison between different methods we can conclude that generally we should use the two steps approach with only \(1\) reestimation and choose the support spaces defined by standardized bounds with the 1se error structure.

| \(OLS\) | \(GME_{(RidGME)}\) | \(GME_{(incRidGME_{1se})}\) | \(GME_{(incRidGME_{min})}\) | \(GME_{(std_{1se})}\) | \(GME_{(std_{min})}\) | \(GCE_{(std_{1se})}\)
--- | --- | --- | --- | --- | --- | --- | ---
Prediction RMSE | 0.947 | 1.054 | 1.132 | 0.948 | 1.064 | 0.948 | 1.064
Prediction CV-RMSE | 0.980 | 1.105 | 1.191 | 0.981 | 1.149 | 0.981 | 1.034
Precision RMSE | 29.191 | 1.659 | 1.850 | 8.939 | 2.027 | 9.464 | 2.027

## References

## Acknowledgements

This work was supported by Fundação para a Ciência e Tecnologia (FCT) through CIDMA and projects https://doi.org/10.54499/UIDB/04106/2020 and https://doi.org/10.54499/UIDP/04106/2020.