Day: December 10, 2021

Show Only ...
Maps - Photos - Videos

I’ve been brushing up on my statistics lately, and realizing it’s kind of important to include on my graphs with linear models the linear equation, p-value and r^2-value

I’ve been brushing up on my statistics lately, and realizing it’s kind of important to include on my graphs with linear models the linear equation, p-value and r^2-value. I was hoping to find a simple R library to produce this text, but I ended up using a StackOverflow answer, along with some R code I wrote myself

get_equation <- function(model) {
  pValue <- paste('p_value=',  format(summary(model)$coefficients[,4], scientific=T), sep='')  
  r2Value <- paste('r^2_value=', round(summary(model)$r.squared,4), sep='') 
  
  formula <- broom::tidy(model)[, 1:2] %>%
    mutate(sign = ifelse(sign(estimate) == 1, '+', '-')) %>% #coeff signs
    mutate_if(is.numeric, ~ abs(round(., 7))) %>% #for improving formatting
    mutate(a = ifelse(term == '(Intercept)', paste0('y=', estimate), paste0(sign, estimate, 'x'))) %>%
    summarise(formula = paste(a, collapse = '')) %>%
    as.character 
  
  paste(formula, pValue, r2Value, sep='n')
}

To add this code to the upper right-hand side of the graph, you can use this code in ggplot2:

annotate('text', x=Inf,y=Inf, hjust=1, vjust=1, label=get_formula(lm(comb$avg ~ comb$Value))[1] ) 

Here is a rather silly example:

Weather Update – December 10, 2021

Looks to be mild the next few days 🌧️

Rainy Saturday ahead though. But then real nice for the work week next week. I might take off Monday and Tuesday after work it should be nice for walking downtown and getting my COVID-19 and tetanus boosters. Wednesday is the work at home day and I’ll probably be aching and sore. But what’s the alternative?

Today.
Feels like …
December 3rd.

Mostly Cloudy

Mostly cloudy.

South wind 6 to 10 mph.

and

42 degrees , 4:22
sunset.
Tonight.
Feels like …
November 13th.

Partly Cloudy then Chance of Rain

A chance of rain, mainly after 5am. Mostly cloudy.

South wind 3 to 7 mph. Chance of precipitation is 30%. New precipitation amounts of less than a tenth of an inch possible.

and

32 degrees , 7:15
sunrise.
Saturday.
Feels like …
October 24th.

Showers

Rain likely before 8am, then showers, mainly after 8am.

South wind 10 to 16 mph, with gusts as high as 26 mph. Chance of precipitation is 80%. New precipitation amounts between a tenth and quarter of an inch possible.

and

58 degrees , 4:22
sunset.
Saturday Night.
Feels like …
October 28th.

Showers and Breezy

Showers and possibly a thunderstorm before 1am, then a slight chance of showers between 1am and 4am.

Breezy, with a south wind 16 to 22 mph becoming west after midnight. Winds could gust as high as 38 mph. Chance of precipitation is 80%. New precipitation amounts of less than a tenth of an inch, except higher amounts possible in thunderstorms.

and

37 degrees , 7:16
sunrise.
Sunday.
Feels like …
November 23rd.

Mostly Sunny

Mostly sunny.

West wind 8 to 14 mph, with gusts as high as 24 mph.

and

46 degrees , 4:22
sunset.
Sunday Night.
Feels like …
November 20th.

Mostly Clear

Mostly clear.

 

and

30 degrees , 7:17
sunrise.
Monday.
Feels like …
November 18th.

Sunny

Sunny.

 

and

48 degrees , 4:22
sunset.
Monday Night.
Feels like …
November 17th.

Partly Cloudy

Partly cloudy.

 

and

31 degrees , 7:17
sunrise.
Tuesday.
Feels like …
November 28th.

Mostly Sunny

Mostly sunny.

 

and

44 degrees , 4:22
sunset.
Tuesday Night.
Feels like …
November 23rd.

Mostly Cloudy

Mostly cloudy.

 

and

29 degrees , 7:18
sunrise.
Wednesday.
Feels like …
November 28th.

Partly Sunny

Partly sunny.

 

and

44 degrees , 4:22
sunset.
Wednesday Night.
Feels like …
October 28th.

Mostly Cloudy

Mostly cloudy.

 

and

37 degrees , 7:19
sunrise.
Thursday.
Feels like …
November 1st.

Mostly Cloudy

Mostly cloudy.

 

and

55 degrees , 4:23
sunset.

Good Morning – December 10, 2021

Good morning! Today is the 7:15 AM Sunrise βŒ›οΈ.

Cloudy start to the morning, so it’s real dark to boot. The sun should be a bit higher by the time I bring my truck to be inspected but hardly a bright and sunny morning like yesterday.

Cloudy and 31 degrees in Delmar, NY. ☁ There is a south-southeast breeze at 8 mph. πŸƒ. There is a inch of snow on the ground. β˜ƒ ️Things will start to thaw out at around 8 am. 🌑️

Dropping my truck off to get inspected this morning πŸ”and then hopefully I can walk home and then pick it up either before work or during lunch time. It will be nice to have Big Red back on the road.

Going to be kind of a rainy weekend β˜” so I’ll probably stay home, do some reading and continuing to explore the R programming language. πŸ–₯ I have a fair amount of bandwidth to use by next Wednesday when my phone renews. As part of the Holiday Spirit week, I’m working from home that day, so it’s important I don’t use all my bandwidth up before then or I’ll be working from the library or the office although I don’t think it would be a bad day for working from my truck. Gets cold though in November, especially around 4 pm though.

I am going to take off the week before Christmas πŸŽ…. I might also take off Monday next week too as the weather looks nice. I have time to use up before the end of the year and I might go out to the Finger Lakes.