kkondo1981 / aglm

A handy tool for actuarial modeling, which is designed to achieve both accuracy and accountability.
GNU General Public License v2.0
16 stars 5 forks source link

Some improvements of plot.AccurateGLM() #40

Closed kkondo1981 closed 4 years ago

kkondo1981 commented 5 years ago

Fixed to use plot.AccurateGLM() with non-Gaussian models.

kkondo1981 commented 5 years ago

todo

kkondo1981 commented 5 years ago

Fixed the last two issues in my comment before this.

kkondo1981 commented 4 years ago

Modify the last issue (partial residual plot for non-Gaussian models) as below.

  1. plot.AccurateGLM(resid=TRUE) uses working residuals for partial residuals as default like residuals.glm(type="partial")
  2. However, in some cases (e.g., Poisson regression with small mu), distributions of working residuals could have large variances and skewness. So it provides several options as below. a. Showing smoothed partial residuals as dotted lines with smooth_resid=TRUE, smooth_resid="both", or smooth_resid="smooth_only". b. Adding options to use other kinds of residuals (Pearson residuals, deviance residuals) with resid="pearson" or resid="deviance". c. Adding an option to use user-calculated residuals with resid=r (here, r is asuumed as a numeric vector).

Moreover, I added an example markdown file as below. https://github.com/kkondo1981/aglm/blob/fix/plot-smallfix-20190706/examples/freMTPL2freq.rmd

kkondo1981 commented 4 years ago

Further improvement to select smoother and to get clearer partial residual plots in the example.

kkondo1981 commented 4 years ago

Further improvement to add rug plots with add_rug=TRUE in plot.AccurateGLM().

kkondo1981 commented 4 years ago

Finished tests and debugs.