R/oats/ExploreLM.R

# 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)
premodelling/mixed documentation built on April 25, 2022, 6:27 a.m.