A time series is a data that is measured in regular intervals of time.
Complete Machine Learning Course for FREE: https://rb.gy/posrbk
Checkout complete Data Scientist Learning Path here:
https://edu.machinelearningplus.com/s...
🔹 What is Better? | Data Science, ML, AI, Deep Learning or Statistical Modeling |
Time Series is a data that is measured in regular intervals of time. Some very common examples of time series are stock market data where the price of the stock has been monitored on a daily basis, whether data where you capture the temperature, humidity, rainfall, or whatever information on a daily or a monthly basis, sales data sales data of a retail store that is captured on a daily, weekly, monthly, or even yearly basis, it does not matter what interval of time that you're capturing on anything, any data that is captured at regular intervals constitute a time series.
Now, this type of data is very prevalent in industry and of high economic use as well. Now how to make these plots in gg plot can be sometimes a little bit tricky. We will see how to handle that in gg plot because gg plot primarily works with data frames, whereas in R you have a special object called PS object, which is used to hold time series data.
So to do that, you need to first convert the TS object time series to a data frame format and then start making your DT plot. So by the end of this video, you would have created time series plots that look like this where you have one single time series displayed in desired frequency. If you look at the x axis, you have the time series of every years values shown on the x axis. On the right hand side plot you have multiple time series plotted on the same chart itself and legend added to it. We will see how to modify the color and the text of the legend as well.
I'm going to use the our passengers time series it is a classic data it contains the air passengers information at a monthly level starting between 1949 to 1960. So this is the data if you check the class of our passengers, you get to know that this is a TS object TS for time series.
Now some of the packages that I'm going to be using in this video includes GG cookbook Digi fortify HBr themes is a special GitHub based themes package it contains a special nice looking theme for time series. Dev Tools is a package that is used to install packages that are present in GitHub repositories. Zoo is a package to handle time series data so is lubra date which is used to handle dates specifically. Alright, we load all the packages.
Now the first step is to convert our passengers this is the data to our data frame format. The data frame I'm creating going to contain two columns one for date, second column for value. To get the date of the our passengers time series, I'm using the zoo packages as dot DATE function. Now it converts the dates of the purpose of this time series to date vector running this now our TS data contains a data frame of the date and the value itself.
Now, the syntax to create a time series is you first initialize the gg plot as we have always been doing, then add a genome line layer followed by labs layer in the labs I will add the title. So this is the default time series chart that you will get. Now if you look at the x axis, we are not having the x axis displayed for every year it starting from 1950 and then goes to 1955 directly.
Let me know in the comments section if you have any questions!
🤝 Like, Share, Subscribe for more!
Follow us on our social media handles for all updates, events and live sessions-
✅ Instagram: / machinelearningplus
✅ LinkedIn: / machine-learning-plus
✅ YouTube: / numyard
✅ Twitter: / r_programming
✅ Website: https://www.machinelearningplus.com/
If you enjoyed this video, be sure to throw it a like and make sure to subscribe to not miss any future videos!
Thanks for watching!
#machinelearningplus #python #machinelearning #datascience
On this page of the site you can watch the video online Plotting for Data Analysis - Time Series Plot (2022) with a duration of hours minute second in good quality, which was uploaded by the user AiML Mastery Club 09 July 2022, share the link with friends and acquaintances, this video has already been watched 290 times on youtube and it was liked by 5 viewers. Enjoy your viewing!