April 29, 2019

The Data

Below is the data of a August 23rd, 2017, I want to see a visiual repersentation on whatvaribles effects the tempature of the day.

Time<-c(0100,0200,0300,0400,0500,0600,0700,0800,0900,1000,1100,1200,1300,1400,1500,1600,1700,1800,1900,2000,2100,2200,2300,0000)
Tempature<-c(70,70,70,71,71,71,71,72,74,77,80,85,93,91,90,90,90,87,83,77,74,73,72,70)
wind<-c(12,13,11,14,15,16,13,12,13,16,17,16,12,10,9,11,12,14,13,12,14,15,14,12)
Sun<-c(1,1.25,1.33,3,3.5,5,6,8,9,9.6,10,11,12,11.5,11,9.5,8.4,7,6.1,5.3,4.2,3.2,2.1,1)
Chances<-c(10,20,30,20,20,15,15,14,10,10,10,5,0,0,0,5,5,5,10,10,20,30,20,10)
Humidity<-c(10,10,30,25,30,30,20,20,30,35,40,60,75,65,40,35,30,25,20,10,10,10,10,10)

The Varibles(Codebook) (.build)

Time = The time of the day

Tempature = The tempature in farenhite

Wind = The speed of the wind

Sun = The position of the sun in the sky

chances = The Chances of Rain

Humidity = The amount of moisture in the air

View

I decided to create the data set "Augustday"

AugustDay<-cbind.data.frame(Time,Tempature,wind,Sun,Chances, Humidity)

Slide with Bullets

glm.fit<- glm(Tempature~., data = AugustDay)
summary(glm.fit)
## 
## Call:
## glm(formula = Tempature ~ ., data = AugustDay)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -4.7188  -1.7135  -0.4694   1.7792   5.2027  
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 80.653137   4.446563  18.138 5.17e-13 ***
## Time         0.005167   0.001035   4.993 9.43e-05 ***
## wind        -0.643126   0.334060  -1.925  0.07016 .  
## Sun         -0.132445   0.403297  -0.328  0.74639    
## Chances     -0.432701   0.123525  -3.503  0.00254 ** 
## Humidity     0.211806   0.062196   3.405  0.00315 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for gaussian family taken to be 8.654815)
## 
##     Null deviance: 1568.00  on 23  degrees of freedom
## Residual deviance:  155.79  on 18  degrees of freedom
## AIC: 127
## 
## Number of Fisher Scoring iterations: 2

Results

After running the varible "AugustDay" we see that wind and time are the most important varibles that help predict the tempature of the day.

The lower the wind and the closer the time is to 12 Pm the hotter the tempature of the day is and vice versa with cold

Plotly

We need to install and activate the library of plotly that will allow us to use its syntax.

#install.packages("plotly")
library(plotly)
## Warning: package 'plotly' was built under R version 3.5.3
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 3.5.3
## 
## Attaching package: 'plotly'
## The following object is masked _by_ '.GlobalEnv':
## 
##     wind
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout

Plot

TempPlot<-plot_ly(AugustDay, x = ~Tempature, y = ~wind, z = ~Time,
        marker = list(color = ~Tempature, colorscale = c('#FFE1A1', '#683531'), showscale = TRUE)) %>%
  add_markers() %>%
  layout(scene = list(xaxis = list(title = 'Tempature'),
                     yaxis = list(title = 'wind'),
                     zaxis = list(title = 'Time')),
         annotations = list(
           x = 1.13,
           y = 1.05,
           text = 'Heat grid',
           xref = 'paper',
           yref = 'paper',
           showarrow = FALSE
         ))

3D interactive Plot

TempPlot