RPubs will retire in June 2027. Your existing documents will stay accessible through December 31, 2031
and Connect Cloud is the recommended home for new publishing. Read the blog post

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

Document
The Crime That Feeds Itself
TALLER ECONOMETRIA
Desarrollo trabajo final econometría
Daily Facebook Political Ad Spending
As of October 19, 2026
Math Problems 10/22/26
Math problems of the day for 10/22/26. Note: No math problems for 10/17/26 to 10/21/26 due to vacation.
module_app
Regresión Logística
Titanic (eksploracyjna analiza danych.)
Titanic, niespełna rok po zwodowaniu, w nocy z 14 na 15 kwietnia 1912 roku, podczas dziewiczego rejsu na trasie Southampton – Cherbourg – Queenstown – Nowy Jork, otarł się o górę lodową i zatonął.
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?
PrakKomstat_Pert5