# Forecasting Kyle Kuzma’s Field Goal Percentage (FG%)

More and more tools are becoming available for data analysts and data scientists. These tools provide convenience and lower the bar of entry for aspiring data professional.

I’ve been looking for an easy way to get to learning predictive analysis and forecasting. Prophet provides that path. Prophet is released by Facebook’s Core Data Science Team.

“Prophet is a procedure for forecasting time series data based on an additive model where non-linear trends are fit with yearly, weekly, and daily seasonality, plus holiday effects. It works best with time series that have strong seasonal effects and several seasons of historical data. Prophet is robust to missing data and shifts in the trend, and typically handles outliers well.”

Just to dip my toes into the waters, I tried Prophet’s Quick Start Guide in R.

Let’s forecast the Field Goal Percentage (FG%) of Kyle Kuzma of the Los Angeles Lakers for the next 6 Months.

I’m using the FG% data scraped from Kuzma’s Game Log from 10/18/2018  to 12/18/2018.

Prophet uses a “normal model fitting API with its

`prophet`
function that performs fitting and returns a model object.”

```#data source https://www.basketball-reference.com/players/k/kuzmaky01/gamelog/2019/
library(prophet)

#create data frame

#define model
m <- prophet(df=df, growth = "linear", yearly.seasonality = TRUE)

#set horizon (preiods to forecast)
future <- make_future_dataframe(m, periods = 180)```

That pretty much read our csv into a data frame, performs fitting, and define the model.

To run a simple forecast on our data:

```#plot forecast
plot(m,forecast)```

We can also break down that forecast into the trend, weekly, and yearly:

```#Plot forecast breakdown
prophet_plot_components(m, forecast, uncertainty = TRUE, yearly_start = 0, weekly_start = 0, plot_cap = TRUE)```

If you’re looking into doing some forecasting, Prophet might be a good starting point.  By the way, it’s an open source software so it gets a lot of support from the open source community, plus it’s from Facebook. Visit Prophet’s Github page here.

The post Forecasting Kyle Kuzma’s Field Goal Percentage (FG%) appeared first on SQL, Code, Coffee, Etc..

## Marlon Ribunal - SQL, Code, Coffee, etc.

I'm passionate about SQL Server. But I feel like I haven't reached my full potential yet. So, this is my mission: My purpose is to help people in their pursuit of growth and development; and, thereby, help myself realize my full potential as a professional, husband, father, christian, and human being.
My online presences include: Tech Blog: Marlon Ribunal - SQL, Code, Coffee, etc. Productivity & GTD Hack Blog: Productivity Bits Twitter: @MarlonRibunal