2023-03-09

Explaining The Dataset

The WWWusage is a timeset in data() of R. It has been converted 
into a dataframe for use. The timeset shows how many times per week that a 
university's webpage was accessed. The Data is recorded from February 
of 1993 to March of 1995. There are only two variables in it which
are date and usage

Explaining Linear Regression

Simple Linear Regression is a model that displays the 
relationship between `x` and `y` variables through a line.

The Formula for Simple Linear Regression

# Writing the data into the formula via LaTex
simplelinearRegression <- "$$\\mathbf{y} = \\mathbf{X}\\boldsymbol{\\beta} 
+ \\boldsymbol{\\epsilon}$$"

# Printing the formula using knitr
knitr::asis_output(simplelinearRegression)

\[\mathbf{y} = \mathbf{X}\boldsymbol{\beta} + \boldsymbol{\epsilon}\]

Using the linear regression formula on the WWWusage Dataset

# Getting coefficients out via the tidy function
tidyF <- tidy(lmResult)

cat("The linear regression equation is:")
The linear regression equation is:
cat(paste0("\n$$\\hat{y} =", round(tidyF$estimate[2], 2), "x + ", 
           round(tidyF$estimate[1], 2), "$$"))

\[\hat{y} =0.62x + 105.83\]

Plotting the Dataset using ggplot2

Graphing the linear regression model via ggplot2

Plotting a plot of the WWWUsage datset using plotly

3d scatter plot of WWWusage using plotly

plot_ly(dataframeVer, x = ~date, y = ~usage, z = ~1, 
        type = "scatter3d", mode = "markers", height = 400, width = 400)