title: "R Notebook" output: pdfdocument: default htmlnotebook: default ---

This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.

Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter.

```{r}

mod1peerreviewMarkRecio.html

library(tidyverse)

library(jtools)

library(corrplot)

loading data

day<- read_csv("day.csv")

Preparing data - extracting the month names from the dteday column

using lubridate package and saving them in a new column month_name

day$month_name <- as.character(month(day$dteday, label=TRUE))

Running regression models - simple linear regression model

Model1 <- lm(cnt ~ month_name, data = day) summary(Model1)

From the summary of Model1, the reference month is April.

The predicted count for April is 4484.9.

Observations <- data.frame(Name = c('1', '2') , month_name = c('Jan','Jun'))

Observations$predictedcnt = predict(Model1, Observations)

Observations

Jan_cnt <- 4484.9 + (-2308.6 * 1) # 1 is categorical variables

Jun_cnt <- 4484.9 + (1287.5 * 1)

multiple linear regression model

Model2 <- lm(cnt ~ temp + month_name, data = day) summary(Model2)

Model: R-squared: 0.3906, Adjusted R-squared: 0.381

Mode12: R-squared: 0.4469, Adjusted R-squared: 0.4377

Model2 shows to have a higher R-squared than Model1,

which means to have moderate influence

Model2 has two vairables with more correlations than Model 1

Both Models indicate to have moderate influence,

R Squared indicating the extent of influence a specific

independent variable exerts on the dependent variable.

Model2 show variable temperature played a major factor

and have statistically significant,

p-value: < 2.2e-16 is less than 0.05, which means that

there is no difference and unlikely due to chance

Values close to 0 indicate that the observed difference

is unlikely to be due to chance

Regression is the workhorse for answering many business questions.

Regression are used:

1) Explaining relationships 2) Making inference 3) Makining predictions

Is temp affecting bicycle rider's behavior?

Anwer: Yes, temperature played a major factor to rider's behavior.

As the temperature increase, count on Riders will increase.

ggplot(Model2, aes(x = temp, y = cnt))+ geompoint() + statsmooth(method = 'lm')

Obs <- data.frame(Name = c('1') ,temp = 0.25 ,month_name = c('Jan'))

Obs$predictedcnt = predict(Model2, Obs)

Obs

predictedcnt <- 1554.39 + (6235.14 * 0.25) + (-852.31*1) predictedcnt

[1] 2260.865

```

Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Ctrl+Alt+I.

When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Ctrl+Shift+K to preview the HTML file).

The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.