Linear Regression Model doesn't pull up a statistic or plot?

library(tidyverse)
library(ggplot2)
library(dplyr)
library(statsr)
yankees <- read_csv("YankeesDataPackage.csv")
yankees
yankees$type <- ifelse(yankees$type == "S", 1, 0)
yankees$type

# Release Speed Plot
mp <-ggplot(yankees, aes(release_speed, type)) + 
  labs (title = "New York Yankees Pitcher Stats from Release Speed",
        x = "Release Speed (mph)",
        y = "Probability of a Strike") +
  geom_point(size = 4, pch = 20, stroke = 0.50, fill = "pink", alpha = 0.8)   + 
  theme(axis.title  = element_text(family="Times New Roman",
                                   size = 10))

mp + geom_smooth(method = "glm", method.args = list(family = "binomial"),
                 color = "red", size = 2.5, se = FALSE)

# Release Spin Rate Plot
mp2 <-ggplot(yankees, aes(release_spin_rate, type)) + 
  labs (title = "New York Yankees Pitcher Stats from Release Spin Rate",
        x = "Release Spin Rate (RPS)",
        y = "Probability of a Strike") +
  geom_point(size = 4, pch = 20, stroke = 0.50, fill = "pink", alpha = 0.8)   + 
  theme(axis.title  = element_text(family="Times New Roman",
                                   size = 10))

mp2 + geom_smooth(method = "glm", method.args = list(family = "binomial"),
                  color = "red", size = 2.5, se = FALSE)

# Linear Regression Plot

freq_strike <- 0 

mutate(bin = ifelse(freq_strike == "Strike", 1, 0))


# this bit !!!!
it <- glm(strikes ~ release_speed + release_spin_rate, data = yankees, family = "binomial", data = df)
 


it + geom_smooth(method = "glm", method.args = list(family = "binomial"),
                  color = "red", size = 2.5, se = FALSE)

Hi, we don't have your dataset, but you could provide a reproducible example. Also, what error do you get?

It might possible because you have saved the results in to the object it, but then don't run or print the results. What happens if you run it?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.