Easy web publishing from R
Write
R Markdown
documents in RStudio.
Share them here on RPubs.
(It’s free, and couldn’t be simpler!)
Get Started
Recently Published
Clasificación de Estrellas Púlsares mediante Machine Learning en R
Documentación técnica y análisis comparativo de modelos predictivos (Árboles de Decisión CART, Poda por Complejidad, Random Forest y Naive Bayes) aplicados al dataset de estrellas púlsares.
Crossed Random Effects in a Penicillin Assay
Group 5: Penicillin assay, crossed random effects
Data: lme4::Penicillin. Inhibition zone diameter for 24 plates, each tested with 6 penicillin
samples.
data(Penicillin, package = "lme4"); str(Penicillin)
To do in R
1. Show that plate and sample are fully crossed (xtabs).
2. Fit diameter ~ 1 + (1 | plate) + (1 | sample).
3. Compare with models that omit one random effect.
4. Plot ranef with lattice::dotplot(ranef(m, condVar = TRUE)).
5. Fit the same data with sample as fixed effect and compare conclusions.
Questions
1. Why are plate and sample crossed rather than nested? Write the model equation.
2. Which variance is larger, between-plate or between-sample? What does that mean for
the assay?
3. When is it more reasonable to treat sample as fixed? What changes in the inference?
4. What assumptions about the random effects are required (independence, normality)?
Describe the design. Identify the response, fixed factors/covariates, grouping factors.
Are the grouping factors nested or crossed? Balanced or not? Use str(), summary(),
xtabs(), table().
2. Explore graphically. Plot the response per group (e.g. xyplot from lattice or ggplot2
with facet_wrap). Comment on between-group vs within-group variability.
3. Fit a naive model (lm, ignoring grouping) and show why it is inappropriate
(independence assumption).
4. Fit a sequence of mixed models from simple to complex (null model with random
intercept, then add fixed effects, then random slopes if relevant).
5. Compare models. Use REML for variance components comparison, ML for fixed-effects
comparison (anova(m1, m2), AIC/BIC). State which method you used and why.
6. Inspect the final model. summary(), VarCorr(), fixef(), ranef(), confint(m, method =
"profile"), ICC with performance::icc(), R² with performance::r2().
7. Diagnostics. Residuals vs fitted, QQ-plot of residuals, QQ-plot of random effects,
check for outliers/influential groups, singular fit warnings.
8. Interpret and conclude in plain language for a non-statistician.
General questions to answer in every report:
• (a) Which effects are fixed and which random, and why?
• (b) What does each variance component represent in this experiment?
• (c) How would the conclusions change if the grouping structure were ignored?
• (d) What are the limitations of your model?
Concentração produtiva: dependência e vulnerabilidade brasileira em relação à região Sudeste
No seu primeiro relatório do semestre, Laura Borelli, discute a influência da região sudeste sobre as demais.
A análise destaca os pontos positivos e negativos dessa dependência, apresentando as possíveis ações sobre a desigualdade regional.