Title: Relationship between temperature and humidity

Data Description. The data comprise 24 observations from 2023 12/25 in the Taipei station observation data. The dependent variable is the temperature(in °C) and the independent variable is the humidity(RH)(in %). The source is from the link: https://codis.cwa.gov.tw/StationData

###老師您在打開連結後,需要請您點選其中一個測站,再點選觀看時序圖報表,才能下載檔案 ###

Discussion. Unlike the parametric linear regression line (OLS), the non-parametric regression line (LOESS) suggests that at relatively small and large temperatures, we can see the humidity decrease.

## Warning: 套件 'tidyverse' 是用 R 版本 4.3.2 來建造的
## Warning: 套件 'ggplot2' 是用 R 版本 4.3.2 來建造的
## Warning: 套件 'tibble' 是用 R 版本 4.3.2 來建造的
## Warning: 套件 'tidyr' 是用 R 版本 4.3.2 來建造的
## Warning: 套件 'readr' 是用 R 版本 4.3.2 來建造的
## Warning: 套件 'purrr' 是用 R 版本 4.3.2 來建造的
## Warning: 套件 'dplyr' 是用 R 版本 4.3.2 來建造的
## Warning: 套件 'stringr' 是用 R 版本 4.3.2 來建造的
## Warning: 套件 'forcats' 是用 R 版本 4.3.2 來建造的
## Warning: 套件 'lubridate' 是用 R 版本 4.3.2 來建造的

R Code. The code to create the above figure is shown below for reference.

# Install the rmarkdown and knitr packages
# Create a new R Markdown document with File in New File

# Install the tinytex package and run tinytex::install_tinytex() in Console to knit to pdf

library(tidyverse)

Your.Data <- read.csv(file = "D:/eagle/下載/466920-2023-12-25.csv", skip = 1)

ggplot(Your.Data, aes(x = Temperature, y = RH)) +
  
  geom_point(alpha = 0.25) +
  
  geom_smooth(method = "loess", aes(color = "blue"), linetype = 1) +
  
  geom_smooth(method = "lm", aes(color = "red"), linetype = 2) +
  
  labs(x = "temperature", y = "Relative humidity") +
  
  theme(legend.position = "bottom") +
  
  scale_color_identity(guide = "legend",
                       
                       name = " ",
                       
                       labels = c("Locally Estimated Scatterplot Smoothing (LOESS)",
                                  
                                  "Ordinary Least Squares (OLS)")) +
  
  guides(color = guide_legend(override.aes = list(linetype = c(1, 2))))