Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Julia Cookbook

You're reading from   Julia Cookbook Over 40 recipes to get you up and running with programming using Julia

Arrow left icon
Product type Paperback
Published in Sep 2016
Publisher
ISBN-13 9781785882012
Length 172 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Raj R Jalem Raj R Jalem
Author Profile Icon Raj R Jalem
Raj R Jalem
Jalem Raj Rohit Jalem Raj Rohit
Author Profile Icon Jalem Raj Rohit
Jalem Raj Rohit
Arrow right icon
View More author details
Toc

Linear regression


Linear Regression is a linear model that is used to determine and predict numerical values. Linear regression is one of the most basic and important starting points in understanding linear models and predictive analytics. For this recipe, we will use Julia's GLM.jl package.

Getting ready

To get started with this recipe, you have to add the GLM.jl Julia package. It can be added and imported in the REPL using the Pkg.add(" ") command just like we added other packages before. This can be done as follows:

Pkg.add("GLM")

Now, import the package using the using " " command. The DataFrames package is also required to be imported. This can be done as follows:

using GLM
using DataFrames

How to do it...

  1. Here, we will attempt to perform a simple linear regression on two basic arrays, which we have generated on-the-fly. Let's call the two array A and B and then, create a dataframe containing them. This can be done as follows:

    df = DataFrame(A = [3, 6, 9], B = [34, 56, 67])
    

  2. Now the...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime