Use a common intercept and laboratory-specific slopes in the normal linear model. With denoting days and the indicator variables for laboratories B and C, the design matrix has row , and
The interaction terms change slopes, without introducing laboratory-specific intercepts. Thus the estimated daily growth rates are
in millimetres per day, with fitted common intercept mm. The residual degrees of freedom are . The usual unbiased error variance estimate is the square of the residual standard error:
The small difference from arises from rounding the standard error to two decimal places; the latter uses the more precise residual sum of squares supplied later. A maximum-likelihood estimate would instead divide that residual sum of squares by .
Let , , , and . The horizontal axis of the residual-versus-fitted plot is , the fitted values, and the vertical axis is , the regression residual, in millimetres. Under the normal linear model, , where is the regression leverage.
In the quantile-quantile plot, the vertical values are the ordered standardized regression residuals
and the horizontal values are corresponding theoretical quantiles of the standard normal distribution, with plotting positions such as . The exact plotting-position convention has little practical effect here. Under Gaussian errors these points should approximately follow a straight line; they are not independent because fitting induces residual correlations.
The main visible concern is curvature in the conditional mean. The red smooth in the residual-versus-fitted plot descends from positive residuals at low fitted values, becomes negative in the middle, and rises again at high fitted values. This suggests the strictly linear time effects may be inadequate. There is no clear monotone widening of the residual scatter, so strong heteroscedasticity is not apparent. The quantile-quantile plot has modest tail deviations and a few labelled observations, but does not show a dramatic departure from normality. These plots cannot establish independence across days or laboratories; check residuals against day, laboratory, and sampling order as well. A large coefficient of determination does not remove the visible mean-model concern.
For a new independent tumour grown for ten days in B, use . Its fitted mean is
Write . The prediction interval in a normal linear model is
where and is the indicated Student's t-distribution quantile. The design information needed to evaluate is not supplied, so a fully numerical interval cannot be recovered from the coefficient standard errors alone: the coefficient covariances are also needed.
To prove coverage, write , with independent of the original sample. The error has a normal distribution with mean zero and variance . By the joint distribution of least-squares and variance estimators, and is independent of ; it is also independent of . Hence the pivotal quantity
Consequently , which is exactly the claimed prediction interval coverage. This is repeated-sampling coverage conditional on the design, assuming the model; it need not hold conditional on the particular observed training responses. The extra represents new-observation noise and must not be omitted as in a mean confidence interval.
In the larger normal linear model, add laboratory intercept offsets to the mean in part (a). The nested-model F-test compares
The smaller and larger models fit four and six mean coefficients respectively. Under , independent Gaussian errors with common variance give independent quantities and . Thus the test statistic is
The p-value is the upper-tail probability . At the conventional 5% significance level, do not reject the common-intercept restriction. Prefer the simpler model tumour1 on this comparison. This does not prove the intercepts coincide, nor address the curvature identified in part (b); the exact F-test calibration assumes the underlying error and mean assumptions. The one-decimal RSS values give when subtracted, whereas the table's difference uses unrounded values.
The fitted formula and coefficient table describe a random-slope linear mixed model:
with random effects independent of the errors. There is a common fixed intercept, a population slope , and a laboratory random slope deviation . In tumour1, the three laboratory slopes are unrelated unknown fixed coefficients. Here they are modelled as draws from a common normal distribution; estimated laboratory deviations are shrunk toward zero. After integrating out , observations in laboratory have covariance , so they are marginally dependent even when their conditional errors are independent.
The displayed command contains a source inconsistency: size ~ 1 + (0 + days | lab) would impose zero population slope and could not produce the displayed fixed days coefficient. The output corresponds to size ~ days + (0 + days | lab). Its estimates are , and . The estimated daily increase averaged over the laboratory population is
because .
A random slope is appropriate if these laboratories can reasonably be viewed as exchangeable representatives of a larger population and the goal includes population inference or predictions for other laboratories. If these particular three laboratories are the whole set of interest, or have systematic differences incompatible with exchangeability, laboratory-specific fixed slopes are preferable. Only three groups give weak information about between-laboratory variance; the mixed model does not itself resolve possible nonlinear growth. Its population mean is distinct from a realized finite-group average .
Retain the random-slope linear mixed model of part (e), but replace the within-laboratory independent error covariance by continuous-time autoregressive residual correlation:
Errors from different laboratories remain independent and are independent of the random slopes. The resulting marginal covariance within laboratory is
The exponential decay applies to the conditional errors, not the entire marginal correlation, which also contains the shared random slope.
Use nlme, since lme4::lmer does not fit this general residual correlation structure. With a data frame containing the observed variables, suitable code is
library(nlme)
dat <- data.frame(size = size, days = days, lab = lab)
dat <- dat[order(dat$lab, dat$days), ]
tumour_cor <- lme(size ~ days,
random = ~ 0 + days | lab,
correlation = corCAR1(form = ~ days | lab),
data = dat, method = "REML")
Here corCAR1 estimates , the error correlation one day apart; correlation at separation is . This works for noninteger or unequally spaced days. At equally spaced integer days, corAR1(form = ~ days | lab) gives the corresponding discrete-time construction when its parameter is positive. Distinct times within each error series are required: separate tumours with repeated day values should have separate series identifiers or an additional independent-error component, rather than being assigned perfectly correlated errors. The continuous-time autoregressive residual correlation documentation describes the grouping and continuous-time conventions: stat.ethz.ch/R-manual/R-patched/library/nlme/html/corCAR1.html. The fixed days term here follows the fitted output rather than the inconsistent command in part (e).
The Gaussian likelihood has log-likelihood, apart from no omitted parameter-dependent terms,
For fixed , maximizing it is ordinary least squares. Differentiating with respect to gives the normal equation . Full column rank makes the quadratic strictly convex, so
At this value, differentiating with respect to gives , so
For positive RSS this is the global likelihood maximum in . RSS is positive almost surely under the model since ; an exactly zero observed RSS instead gives a boundary supremum as .
As a linear image of a multivariate normal vector, the coefficient estimate satisfies
Indeed, , and direct matrix multiplication gives its covariance matrix.
The fitted values are , so the hat matrix is
It is symmetric, and
It fixes every vector in the column space of , and annihilates its orthogonal complement. Thus is the orthogonal projection onto that column space, has matrix rank and trace , and is the complementary orthogonal projection. Consequently
Since , the covariance matrix between the regression residual vector and the coefficient estimate is
These quantities have a joint normal distribution, so they are also independent, a stronger conclusion than zero covariance.
Now has mean zero. Using the expectation of a quadratic form,
Thus the maximum-likelihood estimator has
The unbiased alternative is
The orthogonal projection of a Gaussian vector also yields , explaining the residual degrees of freedom.
Let be sunny days and latitude. The R linear-model formula expands to a normal linear model with both main effects and their interaction term:
The fitted conditional mean is
The residual standard error is , giving the usual variance estimate , and .
The estimated interaction term is tiny relative to its standard error: and the two-sided p-value is . A sensible initial simplification is to remove the interaction and refit an additive linear model, lm(energy ~ sunny + latitude). Both main effects are significant in the supplied fit, and should initially be retained. Do not simply copy their old coefficient estimates into the new fit: removing a design column generally changes all estimates. Centering predictors makes intercepts and main-effect interpretations more useful, but does not change the fitted surface. The Box–Cox transformation in part (d) suggests a further response-scale improvement; after changing the response scale, reassess the interaction and diagnostics.
The Box–Cox transformation searches over transformations of the positive response,
The plotted horizontal coordinate is and the vertical coordinate is its maximized profile likelihood on the log scale. The likelihood includes the transformation Jacobian determinant; omitting it would compare response scales incorrectly. For the Gaussian regression it is, up to constants,
The maximum occurs around . The horizontal 95% line is approximately , and its intersections give an approximate interval roughly to , read visually. In particular, is below the line, and is far below it.
Square the response: a convenient transformation is , equivalent up to affine rescaling to . Transform energy, not the sunny-days or latitude predictors. Refit and check the normal linear model on the transformed scale; the plot is evidence for a transformation, not proof that the transformed residual assumptions hold. Inference on transformed means cannot be inverted naively to obtain original-scale conditional means.
Check that the chosen mean structure adequately describes the transformed response. Examine the residual-versus-fitted plot and residuals versus each predictor: systematic curvature suggests omitted nonlinear effects or an interaction term. Plot residual spread against fitted values, for example using a scale-location plot, to assess homoscedasticity. Compare standardized residuals with a normal distribution using a quantile-quantile plot, especially for finite-sample Student's t-distribution and F-test inference.
Also check independence using the sampling design and residuals versus time, collection site, or other groups; spatially related photovoltaic systems may have correlated errors that are invisible in a residual-versus-fitted plot. Investigate large standardized regression residuals, high regression leverage, and influential observations using Cook's distance. Check that the design matrix has full rank and that severe multicollinearity is not making estimates unstable. Reassess whether the response transformation and retained predictors improve these diagnostics and prediction; a coefficient p-value alone cannot establish model adequacy. If observations are independent only conditional on site effects, use an appropriate dependence model rather than treating correlated systems as independent replicates.
Assume the known covariance matrix is positive definite. The Gaussian likelihood, up to constants, is
Its gradient is . The negative Hessian matrix is positive definite because has full column rank. Thus the unique maximum-likelihood estimator is the generalized least squares estimator
It is unbiased, and multiplication of its linear coefficient matrix by gives
In fact . Equivalently, a whitening transformation premultiplies and by , after which ordinary least squares applies. There is no extra factor when is the complete known covariance; such a factor appears if only a shape matrix is known and .
The initial Poisson regression contains altitude, temperature, and their interaction term, with a logarithmic link function. Its interaction Wald test has , suggesting removal of that term while initially preserving both main effects. The resulting additive model has a negligible temperature effect (), suggesting a second simplification to altitude alone. The nested analysis of deviance for nested generalized linear models gives the same provisional decisions: deviance increases are and , each for one removed coefficient, with approximate upper-tail probabilities and . The Akaike information criterion also decreases at each step.
For independent island counts the final proposed model is
with fitted relation
This is an exponential mean relation on the count scale, not a linear relation between count and altitude. One additional metre multiplies the fitted expected count by . The null model's insignificance of individual main effects in the interaction fit does not require discarding every predictor: correlated design columns can make those conditional tests imprecise. These reductions concern relative mean complexity under the working Poisson regression; the large residual deviance in all three models warns that their variance or mean assumptions still need investigation.
For independent Poisson distributions, ignoring the factorial term only when taking likelihood differences,
The saturated likelihood maximizes each mean separately at , including its limiting value at zero. Therefore the Poisson deviance is
where is defined to be zero and . The expression is twice a saturated-model likelihood ratio difference, not twice a likelihood ratio itself.
With sufficiently large fitted counts and regularity, is approximately under a correctly specified Poisson regression. Here on 28 residual degrees of freedom, with upper-tail probability . The Poisson model fits poorly on this diagnostic. Its deviance is nearly three times its degrees of freedom, consistent with overdispersion, although a wrong mean function, dependence, or influential islands could also cause the discrepancy. The smaller Akaike information criterion than its competitors does not make this an adequate absolute fit.
The Pearson dispersion estimator is , well above the Poisson value one. A Quasi-Poisson regression retains the logarithmic mean model but uses
This is a quasi-likelihood specification; it does not by itself identify a count probability distribution. For a common , the quasi-score equation is the Poisson score divided by , so its roots and fitted means are unchanged. Thus
Coefficient standard errors are multiplied by . The altitude standard error becomes , giving the requested approximate normal confidence interval
It excludes zero, so retain altitude on this approximate 5% test. Its test statistic is about after allowing for overdispersion, rather than the Poisson value . Rescaling uncertainty cannot repair a systematically misspecified mean; the diagnostics in part (e) motivate reconsidering that mean as well.
Use negative binomial regression with a logarithmic mean link, for example
library(MASS)
species_nb <- glm.nb(nspecies ~ altitude, link = log)
In the mean-size parametrization,
The extra parameter allows overdispersion that grows quadratically with the mean, unlike the proportional variance of Quasi-Poisson regression.
The printed assertion needs qualification: a negative-binomial model with fixed size is a generalized linear model. For known , its probability mass function is
With natural parameter , it has exponential family form
with dispersion one. A logarithmic link is permitted even though it is not the canonical link function. This is the fixed-size negative binomial generalized linear model.
What prevents a single ordinary fixed-family GLM fit in glm.nb is joint estimation of the unknown size : it changes the cumulant, carrier, and variance function, rather than merely multiplying a fixed variance function by a scalar dispersion. The routine alternates a GLM fit at fixed with size-parameter likelihood updates. Thus the intended distinction is between that enlarged fitting problem and a single fixed-family GLM, not a claim that negative-binomial regression can never be a GLM. The package documentation explicitly supports both conventions: stat.ethz.ch/R-manual/R-patched/library/MASS/html/glm.nb.html and stat.ethz.ch/R-manual/R-patched/library/MASS/html/negative.binomial.html.
The residual smooth rises from negative values, arches above zero, then falls at high fitted values. This suggests a nonlinear altitude effect on the log mean. Since the fitted log mean in the linear model increases with altitude, the horizontal fitted-value axis is also an increasing rescaling of altitude. A generalized additive model with Quasi-Poisson regression is therefore a reasonable candidate:
The centering constraint identifies the intercept. Here bs="cr" uses a penalized cubic regression spline. The plotted count residuals are deviance residuals, with the Q-Q panel using leverage-standardized versions. The quantile-quantile plot also shows tail discrepancies, but normality of count residuals is not a distributional assumption of this model: its main requirements are an adequate mean, variance relation, and independence. Investigate the labelled islands and possible excess variation as well.
The estimated smooth in the second plot increases fairly rapidly at low altitude, flattens around altitude 20 to 25, and is nearly level at the upper end. The pointwise bands widen where there are fewer observations. A penalized spline can describe a rise followed by a plateau without forcing a global parabola. A quadratic log mean has slope , so negative curvature eventually forces a decline and its curvature is constant everywhere. A cubic regression spline allows different curvature over different ranges, with a penalty controlling unnecessary wiggles and natural linear tails outside its boundary knots. The displayed smooth supports this greater flexibility, but it is not by itself a formal rejection of every quadratic model. Select complexity and compare predictive performance using cross-validation, then reassess residuals and the Pearson dispersion estimator.
For , the Bernoulli distribution has mass
In exponential dispersion family notation , take
The support is ; outside it the probability is zero. The natural parameter of an exponential family is the log odds, and the dispersion parameter is fixed rather than freely estimated. Differentiating the cumulant gives
At or the degenerate distributions are limiting boundary cases with natural parameter or .
For independent patients, the Bernoulli logistic-regression model is
where with nonfrail patients as the reference level in a regression factor. The fitted linear predictor is
The null model fits one intercept, so its 99 residual degrees of freedom imply 100 patients; the full model's confirms this. Unit weights correspond to individual binary responses, not grouped binomial counts.
The Akaike information criterion estimates expected relative out-of-sample discrepancy, using the maximized log-likelihood plus a complexity penalty:
Here , since the Bernoulli dispersion is fixed at one. The saturated model puts probability one on each observed binary outcome and has log likelihood zero, so the binomial deviance is . Consequently
There is no estimated error-variance parameter to count. The printed name “Aikake” should be read as Akaike.
This is a sequential analysis of deviance for nested generalized linear models. Adding age to the intercept-only logistic regression reduces deviance by , with approximate p-value . Adding frailty to the age model reduces it by another , with p-value . Thus both variables have evidence of association with surgical success, under the model assumptions, and neither should be dropped solely on these results.
The second test assesses frailty adjusted for age, whereas the first assesses age before frailty is included. Sequential tests depend on term order. Evidence for age adjusted for frailty is additionally provided by its full-model Wald test, . Both fitted coefficients are negative: age and frailty are associated with lower fitted success probabilities. On the odds scale, one extra year at fixed frailty multiplies the odds by , and frailty at fixed age multiplies them by . These are odds ratios, not risk ratios, and an observational statistical association does not by itself establish a causal effect.
The proposed generalized additive model retains the binary response and logit link, but replaces the linear age effect by a smooth function:
A penalized cubic regression spline represents ; frailty remains a parametric coefficient. The plotted age smooth is centered, so its vertical values represent an age contribution to log odds, not probabilities or the entire fitted predictor.
The plot gives no evidence that the nonlinear model improves the mean structure. The fitted curve is essentially a straight descending line, and the label s(age,1) reports effective degrees of freedom close to one, consistent with a linear effect. The widening bands near the ends reflect sparse data and increasing uncertainty, not detected curvature. A linear-age logistic regression is therefore adequate on this evidence and simpler to interpret. A formal comparative claim would need a suitable test or predictive/model-selection criterion, but the figure supplies no reason to retain extra nonlinear flexibility.
At a target , approximate the unknown mean locally by and solve the local linear regression weighted least-squares problem
where is a nonnegative regression kernel and a smoothing bandwidth. A common factor in all weights makes no difference. Estimate by the fitted intercept , and optionally by . Repeat at each target rather than fitting a single global straight line.
For an explicit expression put and . The normal equations yield
The denominator is positive provided there are at least two distinct positively weighted predictor values. The weights sum to one and their first centered moment is zero, so local linear regression exactly reproduces affine functions and reduces boundary bias compared with a local constant fit. Smaller uses more local detail and increases variance; larger smooths more and can increase bias. Choose the bandwidth by cross-validation or another justified criterion. A nearest-neighbour span provides an adaptive bandwidth, as in the local fits used later.
Assume initially that the design points are distinct and ordered on . The cubic smoothing spline minimizes
over functions with an absolutely continuous first derivative and square-integrable second derivative. Dividing the residual term by simply changes the scaling assigned to . The minimum roughness property of the natural cubic spline interpolant reduces the problem to natural cubic splines with knots at the design points: among functions with any prescribed fitted values, that interpolant has the smallest integrated squared curvature. The minimizer is therefore a natural cubic smoothing spline, with natural second-derivative boundary conditions and linear tails when extended.
Choose a full basis for this natural-spline space. Put and . Writing changes the objective to
Differentiation gives . Although the curvature penalty has an affine nullspace, the full basis at distinct design points makes the combined matrix positive definite. Hence
Equivalently, use the cardinal basis that interpolates the observations, making and . These are smoothing matrices, symmetric but generally not idempotent. Their effective degrees of freedom are . As the fit interpolates; as it approaches ordinary least squares on the affine functions. With replicated predictors, use a design matrix for distinct knots and observation weights; the basis form remains valid when identifiable.
Useful choices include Leave-one-out cross-validation, generalized cross-validation, and estimation of smoothness by restricted maximum likelihood through a mixed-model representation. For fixed , the leave-one-out residual identity for a linear smoother gives
Minimize these over a suitable range. Choose smoothing by predictive performance or a variance-component likelihood, not by arbitrarily forcing a visually appealing curve.
Both fits use the Gaussian generalized additive model
where is experience and education. Centering makes the additive decomposition identifiable. No experience-education interaction term is included.
The first fit uses local linear regression for each term. span=1 includes all observations in each nearest-neighbour neighbourhood, but distance weights and a moving target still vary: it does not make the fit exactly a global straight line. The second uses cubic smoothing splines, with separate tuning values spar=0.8 and spar=1.2. Increasing spar increases the curvature penalty and smooths more; spar is a monotone tuning parametrization, not the numerical in part (b). The relation depends on the predictor scaling and design.
The plotted experience effect is increasing in both fits. The local fit gives a broadly smooth, nearly linear rise; the spline fit follows more of the steep low-experience rise and subsequent flattening, especially near the lower boundary. Education has a weaker increasing effect. The local estimate shows some curvature, while the spline fit at spar=1.2 is closer to a straight line. The clearest difference is the amount of smoothing and the experience curvature, rather than opposite effect directions. These are centered partial-effect plots with partial residuals, not scatterplots of wage against each predictor alone.
A smaller local span would allow the first fit to capture more experience curvature. A moderately smaller education spar could reveal nonlinear detail suppressed in the second fit; its small but significant nonparametric component in part (e) supports checking that possibility. Do not tune solely to follow every point, especially at sparse boundaries. Compare candidate spans or separate spline penalties using cross-validation or generalized cross-validation; increase smoothing if flexible fits introduce unsupported wiggles. See the documented monotone spar–penalty convention at stat.ethz.ch/R-manual/R-patched/library/stats/html/smooth.spline.html.
Use the backfitting algorithm to alternate conditional updates of the two additive functions. Initialize and both centered function vectors at zero. With the smoothing matrices for the chosen experience and education spline penalties, one cycle is
followed by
The centering transfers any constant component to the intercept; update to the mean of if necessary, which is under the stated constraints. Repeat until changes in the functions or objective are negligible. Each function is estimated by smoothing its partial residual, namely the response after subtracting all other currently fitted terms.
For fixed penalties these updates are block minimizations of
subject to the centering constraints. Each step cannot increase the objective; with identifiable additive terms and a positive-definite constrained quadratic, backfitting converges to its unique minimizer. Highly dependent predictors can make the decomposition poorly identified or slow convergence. The Gaussian identity-link model needs these least-squares updates directly; non-Gaussian generalized additive models use weighted backfitting inside iteratively reweighted least squares. The package implementation also separates each spline's unpenalized linear component from its nonlinear component, giving the two ANOVA tables displayed in part (e).
The null model's 99 residual degrees of freedom imply . Each predictor has a one-degree-of-freedom linear contribution in the parametric table, plus the reported nonlinear contribution. Consequently the termwise effective degrees of freedom are
Include the intercept once, giving about total effective degrees of freedom. The more precise residual degrees of freedom in the output give
There is no conflict: and are rounded, so they cannot recover the precise total. Individual unrounded termwise values are not provided.
The package's residual mean-square estimate of error variance is
matching the rounded in the table. The nonlinear experience contribution is highly significant, while the smaller nonlinear education contribution has approximate .
This calculation uses the effective residual degrees of freedom reported by this fit. For a general non-idempotent linear smoother , the noise contribution to expected RSS is , and the expectation can additionally contain squared smoothing bias. Thus dividing by is not a universal exact-unbiasedness theorem. The output's separation of linear and nonlinear term degrees of freedom is documented at cran.r-project.org/web/packages/gam/gam.pdf.
Write for stirring rate of observation in furnace . The independent random-intercept and random-slope model is
Errors and random effects are independent. The separate R terms (1 | furnace) and (0 + stir | furnace) impose independent random intercepts and random slopes; (1 + stir | furnace) would instead estimate their covariance as well. The estimates are
The corresponding estimated standard deviations are , , and ; they are not additional parameters.
For a furnace with predictor vector , the marginal formulation, obtained by integrating the Gaussian random effects, is
independently across furnaces. In particular,
In stacked notation , , giving the Gaussian linear mixed model marginal law with .
The residual-versus-fitted plot on page 17 has residuals of both signs over the fitted range, with no convincing smooth curvature or clear fan shape. Its quantile-quantile plot is roughly straight in the central region, with some tail departures and a few large negative residuals. There is no decisive visible violation, but investigate those observations. These plots mainly address conditional observation errors; they do not validate the distribution of furnace random effects or independence within furnaces. With only three furnaces, normality and the variance of the random effects are especially difficult to assess.
For the Gaussian linear mixed model, temporarily regard as known, with here and . The joint multivariate normal distribution is
By the conditional multivariate normal distribution formula,
A nonsingular Gaussian density has its mode at its mean. Thus the conditional mode of Gaussian random effects equals the conditional expectation. Replacing the unknown parameters by fitted values gives
For positive-definite and , an equivalent derivation minimizes the negative conditional log density,
Differentiation yields
The inverse-covariance penalty shrinks furnace intercepts and slopes toward the population effects. For furnace , set and ; the same formula provides its two-component conditional mode from that furnace's observations, conditional on the fitted common parameters. If a variance component is zero, the covariance form remains meaningful and its corresponding random effect is zero, whereas the formula with needs a limiting interpretation. With known covariance parameters these are best linear unbiased predictors; plug-in variance estimates give their empirical version.
The restricted maximum likelihood procedure estimates covariance parameters from error contrasts that remove the unknown fixed effects. Let have rank and choose an full-rank matrix with . Then has a likelihood involving the variance parameters but not . Maximizing that likelihood is restricted maximum likelihood. An equivalent restricted likelihood from orthogonal error contrasts, up to terms independent of , is
where
After estimating , use generalized least squares for and the conditional modes from part (b). In an independent-error normal linear model, this covariance procedure reduces to estimating by instead of .
The two models being compared have different fixed-effect spaces, so their error contrasts, dimensions, and restricted likelihoods differ. Their REML values are not likelihoods of the same transformed data and must not be used directly for this fixed-effect likelihood-ratio test. Refit both with ordinary maximum likelihood, integrating out the random effects but retaining the original response vector, and maximize each model's marginal likelihood.
The null hypothesis is , leaving the random slope variance free; the alternative permits a nonzero population stirring effect. The supplied test has , one extra fixed coefficient, and approximate p-value . Retain the fixed stirring-rate effect at 5%. A mean-zero random slope cannot substitute for an estimated nonzero population slope. The asymptotic calibration assumes regular nuisance covariance parameters and should be interpreted cautiously with only three furnaces; simulation can provide a better finite-sample calibration.
The comparison removes the random slope and tests against , while retaining the same fixed intercept and slope. A variance cannot be negative, so zero is a boundary point of the parameter space. The regular Wilks theorem assumptions behind an ordinary likelihood-ratio test fail. Consequently the default chi-squared p-value from anova is not reliably calibrated for this variance-component likelihood-ratio test at a boundary. This is different from the fixed-slope test in part (c). The reference to strength_model1 means the earlier object strength_model; no separate model 1 object was defined.
A useful alternative is a parametric bootstrap. Fit the null random-intercept model, then simulate data on the actual predictor values and furnace grouping by generating null intercept effects and observation errors from its fitted Gaussian distribution. Refit null and alternative models to each simulated dataset using the same likelihood method and compute the same likelihood-ratio statistic. If is the observed statistic, estimate its upper-tail probability by
This incorporates the zero-variance boundary and the actual small group count. It is a fitted-null simulation approximation because nuisance parameters are estimated, not a universally exact test. Since both models have the same fixed-effect space, a similarly calibrated restricted-likelihood statistic is also possible. Under suitable asymptotics for a single identifiable added variance component the familiar limiting law is , but using the bootstrap avoids relying on that approximation with only three groups. There is no supplied statistic or calibrated bootstrap result here from which to decide whether the slope variance is required.
The generalized additive mixed model fits
where denotes the furnace random intercept and is a centered penalized cubic regression spline. Its wiggly components have a mixed-model representation; there is no explicit furnace-specific random slope in this formula.
The plotted smooth gives no evidence that a nonparametric fixed effect is needed. It is essentially a straight rising line, and s(stir,1) indicates effective degrees of freedom close to one. The wider bands at extreme stirring rates reflect uncertainty, not detected nonlinearity. A linear fixed stirring effect is adequate on this evidence.
If the three supplied Akaike information criterion values are on a common valid likelihood basis, choose strength_model3, the fixed linear slope plus random-intercept model: its AIC is smallest, versus for the additional random slope and for the smooth. The differences are and , respectively, so especially the random-slope comparison represents modest support rather than decisive evidence. Retaining the population slope is consistent with part (c); this choice removes only its random variation.
There is a likelihood-basis caveat in the literal printed commands. lmer fits by REML by default, whereas the Gaussian gamm call defaults to ML; direct AIC on these objects need not compare the same type of likelihood. Moreover the earlier ML ANOVA prints for strength_model, whereas this table prints , so these numbers should not silently be treated as one identical ML fit. To obtain a defensible common comparison, fit all candidates to the same observations by ML:
fit_slope <- update(strength_model, REML = FALSE)
fit_intercept <- update(strength_model3, REML = FALSE)
fit_smooth <- mgcv::gamm(strength ~ s(stir, bs = "cr"),
random = list(furnace = ~ 1), method = "ML")
AIC(fit_slope, fit_intercept, fit_smooth$lme)
The supplied ranking favours the simpler random-intercept model; the displayed original calls alone do not certify that ranking as a consistent ML comparison. This distinction is particularly relevant when the smooth changes the fixed-effect space. The Gaussian gamm ML default and mixed-model representation are documented at stat.ethz.ch/R-manual/R-devel/library/mgcv/html/gamm.html.

Articles by others on the same topic (0)

There are currently no matching articles.