# Title : ExploreLM.R
# Objective : Oats & Linear Models
# Created by: greyhypotheses
# Created on: 31/03/2022
#' Linear Regression
#'
#'
# modelling
linearmodel <- lm(formula = Y ~ N + B + V, data = oats)
# graphing
# https://www.rdocumentation.org/packages/graphics/versions/3.6.2/topics/plot.default
# type p: points
original <- xyplot(x = Y ~ N | B, data = oats, groups = V,
type = 'p',
ylab = 'yield', xlab = 'nitrogen',
par.settings = list(strip.background = list(col = 'white'),
strip.border = list(col = 'black'))
)
models <- xyplot(x = linearmodel$fitted.values ~ N | B, data = oats, groups = V,
type = 'l')
original + latticeExtra::as.layer(models)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.