• No se han encontrado resultados

Actividades y recursos del Moodle a utilizar en el Currículo Optativo electivo

CAPÍTULO 2. Actividades del Moodle para implementar el Currículo Optativo-Electivo

2.2 Actividades y recursos del Moodle a utilizar en el Currículo Optativo electivo

Table 3.6 presents regression results for the mixed effect logistic model con- taining all the covariates described in section 3.4. The first step in interpret- ing this model is to establish that the random effect component improves the fit of the model. With reference to Bolker et al. (2009), the preferred method is to use a LRT comparing the model with the corresponding GLM i.e. the same model without random effects. This produces a test statistic of 985.82, which is highly significant (p-value 0.001) compared to the refer- ence distribution under the null of no significant difference, which is a 50:50 mixture of the χ2

0 and χ21 distributions. The estimate for the random effect

standard deviation is 0.781, with a 95% profile likelihood confidence interval given by (0.723, 0.841). These results provide strong evidence that a model including investor-level random effects is supported by the data.

3.5.2

Residuals

As is standard in regression analysis, the adequacy of the estimated model can be assessed using a residual quantity. For GLMs where the response can only take on a small number of values, the residual produced by subtracting the fitted value from the response is also restricted to the same small number of values. This limits the amount of variation that is visible in standard diagnostic plots of the residuals and hence makes it difficult to identify model inadequacies. As an alternative, the randomized quantile residuals (RQRs), introduced by Dunn and Smyth (1996), will be used to assess the model. The idea of these residuals is to add random noise to the value of the theoretical cumulative distribution function (CDF) of each observation,

which produces a set of residuals that can be treated as continuous. If the model is true then these residuals should constitute an i.i.d. sample from the standard uniform distribution, a property that can be easily tested.

Let F(yij;µij) be the CDF of the i-th purchase made by the j-th investor,

whereµij =E(yij). µij is a function of the covariatesXij, the parametersβ

and the random effect Zj. Let aij = supy<yijF(y,µˆij) and bij =F(yij,µˆij),

then the RQR for purchase ij is defined by

rij =U(aij, bij)

which denotes a uniform random variable on the interval (aij, bij]. If the

model is true, meaning each observed yij was in fact generated by the dis-

tribution defined by F(yij;µij), then these residuals will constitute a sample

from the standard uniform distribution,U(0,1).9 For a logistic model this simplifies to

rij =    U(0,1−pˆij) if yij = 0 U(1−pˆij,1) if yij = 1

where ˆpij is the fitted value for purchase ij. A QQ plot can be used as a

first check of whether the residuals have the expected distribution. For this purpose, Dunn and Smyth recommend converting the residuals to quantiles of the standard normal distribution by applying the inverse CDF of the stan- dard normal distribution, as QQ plots for the standard normal distribution are more familiar. A normal QQ plot for one realization of the RQRs is shown in figure 3.3. On the evidence of this plot, the residuals adhere very closely to the expected distribution.

To further check the integrity of the model, the residuals can be plotted 9See Feng et al. (2017) for a proof of this.

Figure 3.3: QQ plot comparing a realization of the RQRs for the mixed- effects logistic model with the standard normal distribution. The RQRs have been converted into quantiles of the standard normal distribution by applying the inverse CDF of this distribution to them.

against the fitted values. The original RQRs, which should be uniformly distributed, are recommended for this plot since it is easy to assess whether the mean is close to the expected value of 0.5 at all magnitudes of the fitted values. Due to the random element inherent to the process, Dunn and Smyth recommend generating four realizations of the residuals and discounting any apparent patterns that are not common to all of them. Figure 3.4 contains plots against the fitted values for four such realizations. The first, in the top left of the plot, is the same realization as was used for the QQ plot in figure 3.3. A smoothing spline has been added to each plot, which can be compared to the horizontal line indicating the expected value of 0.5. These plots reveal a clear tendency for the residuals to be larger than expected for purchases with large fitted values. This means that, amongst this group of purchases, there are more lottery purchases than would be expected if the model was true. This suggests the model is missing a factor that could explain the very strong preference for lottery stocks of some investors.

For comparison, figure 3.5 contains four realizations of the RQRs for the corresponding model without random effects. The same pattern is visible in these plots, and to a much greater extent. This provides reassurance that the model is significantly improved by the inclusion of random effects, and hence also that the deviation from uniformity in the scatter plots for the mixed-effects model is small compared to what results from a major misspecification of the model. So whilst these plots suggest the current model could be improved, the pattern in the residuals is not severe enough to invalidate the conclusions drawn from the model results. The analysis can therefore proceed to a detailed interpretation of these results, which is the focus of the next section.

Figure 3.4: Four realizations of the RQRs for the mixed-effects logistic model, plotted against the fitted values of the model. A smoothing spline has been added to each plot to help identify deviations from the expected value of 0.5.

Figure 3.5: Four realizations of the RQRs for the logistic model without random effects, plotted against the fitted values of the model. A smoothing spline has been added to each plot to help identify deviations from the expected value of 0.5.

Documento similar