SlideShare a Scribd company logo
1 of 18
Download to read offline
Introduction to R for Data Science
Lecturers
dipl. ing Branko Kovač
Data Analyst at CUBE/Data Science Mentor
at Springboard
Data Science zajednica Srbije
branko.kovac@gmail.com
dr Goran S. Milovanović
Data Scientist at DiploFoundation
Data Science zajednica Srbije
goran.s.milovanovic@gmail.com
goranm@diplomacy.edu
Linear Regression in R
• Exploratory Data Analysis
• Assumptions of the Linear Model
• Correlation
• Normality Tests
• Linear Regression
• Prediction, Confidence
Intervals, Residuals
• Influential Cases and
the Influence Plot
Intro to R for Data Science
Session 6: Linear Regression in R
# Introduction to R for Data Science
# SESSION 6 :: 02 June, 2016
# clear
rm(list=ls())
#### read data
library(datasets)
data(iris)
### iris data set description:
# https://stat.ethz.ch/R-manual/R-devel/library/iriss/html/iris.html
### ExploratoryData Analysis (EDA)
str(iris)
summary(iris)
Linear Regression in R
• Before modeling: Assumptions and Exploratory Data Analysis (EDA)
Intro to R for Data Science
Session 6: Linear Regression in R
# Introduction to R for Data Science
# SESSION 6 :: 02 June, 2016
### EDA plots
# plot layout:2 x 2
par(mfcol = c(2,2))
# boxplotiris$Sepal.Length
boxplot(iris$Sepal.Length,
horizontal = TRUE,
xlab="Sepal Length")
# histogram:iris$Sepal.Length
hist(iris$Sepal.Length,
main="",
xlab="Sepal.Length",
prob=T)
# overlay iris$Sepal.Length density functionoverthe empiricaldistribution
lines(density(iris$Sepal.Length),
lty="dashed",
lwd=2.5,
col="red")
EDA
Intro to R for Data Science
Session 6: Linear Regression in R
Linear Regression in R
• EDA
Intro to R for Data Science
Session 6: Linear Regression in R
Intro to R for Data Science
Session 6: Linear Regression in R
# Introduction to R for Data Science
# SESSION 6 :: 02 June, 2016
## Pearsoncorrelationin R {base}
cor1 <- cor(iris$Sepal.Length, iris$Petal.Length,
method="pearson")
cor1
par(mfcol = c(1,1))
plot(iris$Sepal.Length, iris$Petal.Length,
main = "Sepal Length vs Petal Length",
xlab = "Sepal Length", ylab = "Petal Length")
## Correlation matrix and treatmentof missing data
dSet <- iris
# Remove one discretevariable
dSet$Species <- NULL
# introduce NA in dSet$Sepal.Length[5]
dSet$Sepal.Length[5] <- NA
# Pairwise and Listwise Deletion:
cor1a <- cor(dSet,use="complete.obs") # listwise deletion
cor1a <- cor(dSet,use="pairwise.complete.obs") # pairwise deletion
cor1a <- cor(dSet,use="all.obs") # all observations -error
Correlation
Intro to R for Data Science
Session 6: Linear Regression in R
# Introduction to R for Data Science
# SESSION 6 :: 02 June, 2016
library(Hmisc)
cor2 <- rcorr(iris$Sepal.Length,
iris$Petal.Length,
type="pearson")
cor2$r # correlations
cor2$r[1,2] # that's whatyou need,right
cor2$P # significantat
cor2$n # num.observations
# NOTE: rcorr uses Pairwise deletion!
# Correlation matrix
cor2a <- rcorr(as.matrix(dSet),
type="pearson") # NOTE:as.matrix
# select significant at alpha == .05
w <- which(!(cor2a$P<.05),arr.ind = T)
cor2a$r[w] <- NA
cor2a$P # comparew.
cor2a$r
Correlation {Hmisc}
Intro to R for Data Science
Session 6: Linear Regression in R
# Introduction to R for Data Science
# SESSION 6 :: 02 June, 2016
# LinearRegression:lm()
# Predicting:PetalLength from SepalLength
reg <- lm(Petal.Length ~ Sepal.Length, data=iris)
class(reg)
summary(reg)
coefsReg <- coefficients(reg)
coefsReg
slopeReg <- coefsReg[2]
interceptReg <- coefsReg[1]
# Prediction from this model
newSLength <- data.frame(Sepal.Length = runif(100,
min(iris$Sepal.Length),
max(iris$Sepal.Length))
) # watch the variable namesin the new data.frame!
predictPLength <- predict(reg, newSLength)
predictPLength
Linear Regression with lm()
Intro to R for Data Science
Session 6: Linear Regression in R
# Introduction to R for Data Science
# SESSION 6 :: 02 June, 2016
# Standardizedregressioncoefficients {QuantPsych}
library(QuantPsyc)
lm.beta(reg)
# Reminder:standardizedregressioncoefficientsare...
# What you would obtain upon performinglinearregressionoverstandardizedvariables
# z-score in R
zSLength <- scale(iris$Sepal.Length, center = T, scale = T) # computes z-score
zPLength <- scale(iris$Petal.Length, center = T, scale = T) # again;?scale
# new dSetw. standardized variables
dSet <- data.frame(Sepal.Length <- zSLength,
Petal.Length <- zPLength)
# LinearRegression w.lm() overstandardized variables
reg1 <- lm(Petal.Length ~ Sepal.Length, data=dSet)
summary(reg1)
# compare
coefficients(reg1)[2] # beta from reg1
lm.beta(reg) # standardizedbeta w. QuantPscy lm.beta from reg
Standardized Regression Coefficients
Intro to R for Data Science
Session 6: Linear Regression in R
# Introduction to R for Data Science
# SESSION 6 :: 02 June, 2016
# plots w. {base}and {ggplot2}
library(ggplot2)
# Predictorvs Criterion {base}
plot(iris$Sepal.Length, iris$Petal.Length,
main = "Petal Length vs Sepal Length",
xlab = "Sepal Length",
ylab = "Petal Length"
)
abline(reg,col="red")
# Predictorvs Criterion {ggplot2}
ggplot(data = iris,
aes(x = Sepal.Length, y = Petal.Length)) +
geom_point(size = 2, colour = "black") +
geom_point(size = 1, colour = "white") +
geom_smooth(aes(colour = "red"),
method='lm') +
ggtitle("Sepal Length vs Petal Length") +
xlab("Sepal Length") + ylab("Petal Length") +
theme(legend.position = "none")
Plots {base} vs {ggplot2}
Intro to R for Data Science
Session 6: Linear Regression in R
Plots {base} vs {ggplot2}
Intro to R for Data Science
Session 6: Linear Regression in R
# Introduction to R for Data Science
# SESSION 6 :: 02 June, 2016
# Predicted vs.residuals {ggplot2}
predReg <- predict(reg) # get predictions from reg
resReg <- residuals(reg) # get residuals from reg
# resStReg <- rstandard(reg)# get residualsfrom reg
plotFrame <- data.frame(predicted = predReg,
residual = resReg);
ggplot(data = plotFrame,
aes(x = predicted, y = residual)) +
geom_point(size = 2, colour = "black") +
geom_point(size = 1, colour = "white") +
geom_smooth(aes(colour = "blue"),
method='lm',
se=F) +
ggtitle("Predicted vs Residual Lengths") +
xlab("Predicted Lengths") + ylab("Residual") +
theme(legend.position = "none")
Predicted vs Residuals
Intro to R for Data Science
Session 6: Linear Regression in R
Predicted vs Residuals
Intro to R for Data Science
Session 6: Linear Regression in R
# Introduction to R for Data Science
# SESSION 6 :: 02 June, 2016
## Detectinfluentialcases
infReg <- as.data.frame(influence.measures(reg)$infmat)
# Cook's Distance:Cook and Weisberg(1982):
# values greaterthan 1 are troublesome
wCook <- which(infReg$cook.d>1) # we're fine here
# Average Leverage = (k+1)/n,k - num. of predictors,n - num. observations
# Also termed:hat values,range:0 - 1
# see: https://en.wikipedia.org/wiki/Leverage_%28statistics%29
# Various criteria (twice the leverage,three times the average...)
wLev <- which(infReg$hat>2*(2/length(iris$price))) # we seem to be fine here too...
## Influenceplot
infReg <- as.data.frame(influence.measures(reg)$infmat)
plotFrame <- data.frame(residual = resStReg,
leverage = infReg$hat,
cookD = infReg$cook.d)
Infulential Cases + Infulence Plot
Intro to R for Data Science
Session 6: Linear Regression in R
# Introduction to R for Data Science
# SESSION 6 :: 02 June, 2016
ggplot(plotFrame,
aes(y = residual,
x = leverage)) +
geom_point(size = plotFrame$cookD*100, shape = 1) +
ggtitle("Influence PlotnSize of the circle corresponds to Cook's distance") +
theme(plot.title = element_text(size=8, face="bold")) +
ylab("Standardized Residual") + xlab("Leverage")
Infulence Plot
Intro to R for Data Science
Session 6: Linear Regression in R
Infulence Plot
Intro to R for Data Science
Session 6: Linear Regression in R
Introduction to R for Data Science :: Session 6 [Linear Regression in R]

More Related Content

What's hot

Data Analysis with R (combined slides)
Data Analysis with R (combined slides)Data Analysis with R (combined slides)
Data Analysis with R (combined slides)Guy Lebanon
 
RDataMining slides-text-mining-with-r
RDataMining slides-text-mining-with-rRDataMining slides-text-mining-with-r
RDataMining slides-text-mining-with-rYanchang Zhao
 
Introduction to source{d} Engine and source{d} Lookout
Introduction to source{d} Engine and source{d} Lookout Introduction to source{d} Engine and source{d} Lookout
Introduction to source{d} Engine and source{d} Lookout source{d}
 
Text mining and social network analysis of twitter data part 1
Text mining and social network analysis of twitter data part 1Text mining and social network analysis of twitter data part 1
Text mining and social network analysis of twitter data part 1Johan Blomme
 
Training in Analytics, R and Social Media Analytics
Training in Analytics, R and Social Media AnalyticsTraining in Analytics, R and Social Media Analytics
Training in Analytics, R and Social Media AnalyticsAjay Ohri
 
Hybrid acquisition of temporal scopes for rdf data
Hybrid acquisition of temporal scopes for rdf dataHybrid acquisition of temporal scopes for rdf data
Hybrid acquisition of temporal scopes for rdf dataAnisa Rula
 
Text analytics in Python and R with examples from Tobacco Control
Text analytics in Python and R with examples from Tobacco ControlText analytics in Python and R with examples from Tobacco Control
Text analytics in Python and R with examples from Tobacco ControlBen Healey
 
Detecting paraphrases using recursive autoencoders
Detecting paraphrases using recursive autoencodersDetecting paraphrases using recursive autoencoders
Detecting paraphrases using recursive autoencodersFeynman Liang
 
Recursive Autoencoders for Paraphrase Detection (Socher et al)
Recursive Autoencoders for Paraphrase Detection (Socher et al)Recursive Autoencoders for Paraphrase Detection (Socher et al)
Recursive Autoencoders for Paraphrase Detection (Socher et al)Feynman Liang
 
SPARQL in a nutshell
SPARQL in a nutshellSPARQL in a nutshell
SPARQL in a nutshellFabien Gandon
 
A brief introduction to lisp language
A brief introduction to lisp languageA brief introduction to lisp language
A brief introduction to lisp languageDavid Gu
 
my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;
my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;
my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;dankogai
 
Natural Language Processing in R (rNLP)
Natural Language Processing in R (rNLP)Natural Language Processing in R (rNLP)
Natural Language Processing in R (rNLP)fridolin.wild
 
Federation and Navigation in SPARQL 1.1
Federation and Navigation in SPARQL 1.1Federation and Navigation in SPARQL 1.1
Federation and Navigation in SPARQL 1.1net2-project
 
Reproducible Computational Research in R
Reproducible Computational Research in RReproducible Computational Research in R
Reproducible Computational Research in RSamuel Bosch
 

What's hot (20)

Data Analysis with R (combined slides)
Data Analysis with R (combined slides)Data Analysis with R (combined slides)
Data Analysis with R (combined slides)
 
RDataMining slides-text-mining-with-r
RDataMining slides-text-mining-with-rRDataMining slides-text-mining-with-r
RDataMining slides-text-mining-with-r
 
R language
R languageR language
R language
 
Introduction to source{d} Engine and source{d} Lookout
Introduction to source{d} Engine and source{d} Lookout Introduction to source{d} Engine and source{d} Lookout
Introduction to source{d} Engine and source{d} Lookout
 
Text mining and social network analysis of twitter data part 1
Text mining and social network analysis of twitter data part 1Text mining and social network analysis of twitter data part 1
Text mining and social network analysis of twitter data part 1
 
Training in Analytics, R and Social Media Analytics
Training in Analytics, R and Social Media AnalyticsTraining in Analytics, R and Social Media Analytics
Training in Analytics, R and Social Media Analytics
 
Machine Learning in R
Machine Learning in RMachine Learning in R
Machine Learning in R
 
Hybrid acquisition of temporal scopes for rdf data
Hybrid acquisition of temporal scopes for rdf dataHybrid acquisition of temporal scopes for rdf data
Hybrid acquisition of temporal scopes for rdf data
 
C programming
C programmingC programming
C programming
 
Text analytics in Python and R with examples from Tobacco Control
Text analytics in Python and R with examples from Tobacco ControlText analytics in Python and R with examples from Tobacco Control
Text analytics in Python and R with examples from Tobacco Control
 
Detecting paraphrases using recursive autoencoders
Detecting paraphrases using recursive autoencodersDetecting paraphrases using recursive autoencoders
Detecting paraphrases using recursive autoencoders
 
Recursive Autoencoders for Paraphrase Detection (Socher et al)
Recursive Autoencoders for Paraphrase Detection (Socher et al)Recursive Autoencoders for Paraphrase Detection (Socher et al)
Recursive Autoencoders for Paraphrase Detection (Socher et al)
 
Stack Algorithm
Stack AlgorithmStack Algorithm
Stack Algorithm
 
SPARQL in a nutshell
SPARQL in a nutshellSPARQL in a nutshell
SPARQL in a nutshell
 
A brief introduction to lisp language
A brief introduction to lisp languageA brief introduction to lisp language
A brief introduction to lisp language
 
Rbootcamp Day 1
Rbootcamp Day 1Rbootcamp Day 1
Rbootcamp Day 1
 
my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;
my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;
my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;
 
Natural Language Processing in R (rNLP)
Natural Language Processing in R (rNLP)Natural Language Processing in R (rNLP)
Natural Language Processing in R (rNLP)
 
Federation and Navigation in SPARQL 1.1
Federation and Navigation in SPARQL 1.1Federation and Navigation in SPARQL 1.1
Federation and Navigation in SPARQL 1.1
 
Reproducible Computational Research in R
Reproducible Computational Research in RReproducible Computational Research in R
Reproducible Computational Research in R
 

Viewers also liked

Latest seo news, tips and tricks website lists
Latest seo news, tips and tricks website listsLatest seo news, tips and tricks website lists
Latest seo news, tips and tricks website listsManickam Srinivasan
 
Electron Configuration
Electron ConfigurationElectron Configuration
Electron Configurationcrumpjason
 
Uvod u R za Data Science :: Sesija 1 [Intro to R for Data Science :: Session 1]
Uvod u R za Data Science :: Sesija 1 [Intro to R for Data Science :: Session 1]Uvod u R za Data Science :: Sesija 1 [Intro to R for Data Science :: Session 1]
Uvod u R za Data Science :: Sesija 1 [Intro to R for Data Science :: Session 1]Goran S. Milovanovic
 
Benefits of Short Term Contract Hire
Benefits of Short Term Contract HireBenefits of Short Term Contract Hire
Benefits of Short Term Contract HireRhys Adams
 
15 03 16_data sciences pour l'actuariat_f. soulie fogelman
15 03 16_data sciences pour l'actuariat_f. soulie fogelman15 03 16_data sciences pour l'actuariat_f. soulie fogelman
15 03 16_data sciences pour l'actuariat_f. soulie fogelmanArthur Charpentier
 
Building a Graph Database in Neo4j with Spark & Spark SQL to gain new insight...
Building a Graph Database in Neo4j with Spark & Spark SQL to gain new insight...Building a Graph Database in Neo4j with Spark & Spark SQL to gain new insight...
Building a Graph Database in Neo4j with Spark & Spark SQL to gain new insight...DataWorks Summit/Hadoop Summit
 
Slides barcelona Machine Learning
Slides barcelona Machine LearningSlides barcelona Machine Learning
Slides barcelona Machine LearningArthur Charpentier
 
12 Hidden Tips of Popular Remote Work Tools
12 Hidden Tips of Popular Remote Work Tools12 Hidden Tips of Popular Remote Work Tools
12 Hidden Tips of Popular Remote Work ToolsRealtimeBoard
 
Spatial Data Science with R
Spatial Data Science with RSpatial Data Science with R
Spatial Data Science with Ramsantac
 

Viewers also liked (18)

Latest seo news, tips and tricks website lists
Latest seo news, tips and tricks website listsLatest seo news, tips and tricks website lists
Latest seo news, tips and tricks website lists
 
Electron Configuration
Electron ConfigurationElectron Configuration
Electron Configuration
 
Uvod u R za Data Science :: Sesija 1 [Intro to R for Data Science :: Session 1]
Uvod u R za Data Science :: Sesija 1 [Intro to R for Data Science :: Session 1]Uvod u R za Data Science :: Sesija 1 [Intro to R for Data Science :: Session 1]
Uvod u R za Data Science :: Sesija 1 [Intro to R for Data Science :: Session 1]
 
Benefits of Short Term Contract Hire
Benefits of Short Term Contract HireBenefits of Short Term Contract Hire
Benefits of Short Term Contract Hire
 
Building a Scalable Data Science Platform with R
Building a Scalable Data Science Platform with RBuilding a Scalable Data Science Platform with R
Building a Scalable Data Science Platform with R
 
Slides erm-cea-ia
Slides erm-cea-iaSlides erm-cea-ia
Slides erm-cea-ia
 
IA-advanced-R
IA-advanced-RIA-advanced-R
IA-advanced-R
 
Slides ads ia
Slides ads iaSlides ads ia
Slides ads ia
 
Classification
ClassificationClassification
Classification
 
Slides lln-risques
Slides lln-risquesSlides lln-risques
Slides lln-risques
 
15 03 16_data sciences pour l'actuariat_f. soulie fogelman
15 03 16_data sciences pour l'actuariat_f. soulie fogelman15 03 16_data sciences pour l'actuariat_f. soulie fogelman
15 03 16_data sciences pour l'actuariat_f. soulie fogelman
 
Building a Graph Database in Neo4j with Spark & Spark SQL to gain new insight...
Building a Graph Database in Neo4j with Spark & Spark SQL to gain new insight...Building a Graph Database in Neo4j with Spark & Spark SQL to gain new insight...
Building a Graph Database in Neo4j with Spark & Spark SQL to gain new insight...
 
Slides barcelona Machine Learning
Slides barcelona Machine LearningSlides barcelona Machine Learning
Slides barcelona Machine Learning
 
12 Hidden Tips of Popular Remote Work Tools
12 Hidden Tips of Popular Remote Work Tools12 Hidden Tips of Popular Remote Work Tools
12 Hidden Tips of Popular Remote Work Tools
 
Freelance@toptal
Freelance@toptalFreelance@toptal
Freelance@toptal
 
Spatial Data Science with R
Spatial Data Science with RSpatial Data Science with R
Spatial Data Science with R
 
Actuarial Analytics in R
Actuarial Analytics in RActuarial Analytics in R
Actuarial Analytics in R
 
TextMining with R
TextMining with RTextMining with R
TextMining with R
 

Similar to Introduction to R for Data Science :: Session 6 [Linear Regression in R]

Rattle Graphical Interface for R Language
Rattle Graphical Interface for R LanguageRattle Graphical Interface for R Language
Rattle Graphical Interface for R LanguageMajid Abdollahi
 
Introduction to R for data science
Introduction to R for data scienceIntroduction to R for data science
Introduction to R for data scienceLong Nguyen
 
Extending lifespan with Hadoop and R
Extending lifespan with Hadoop and RExtending lifespan with Hadoop and R
Extending lifespan with Hadoop and RRadek Maciaszek
 
DATA MINING USING R (1).pptx
DATA MINING USING R (1).pptxDATA MINING USING R (1).pptx
DATA MINING USING R (1).pptxmyworld93
 
Language Technology Enhanced Learning
Language Technology Enhanced LearningLanguage Technology Enhanced Learning
Language Technology Enhanced Learningtelss09
 
3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB
3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB
3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DBAthens Big Data
 
Compiling openCypher graph queries with Spark Catalyst
Compiling openCypher graph queries with Spark CatalystCompiling openCypher graph queries with Spark Catalyst
Compiling openCypher graph queries with Spark CatalystGábor Szárnyas
 
An Introduction to Data Mining with R
An Introduction to Data Mining with RAn Introduction to Data Mining with R
An Introduction to Data Mining with RYanchang Zhao
 
R programming & Machine Learning
R programming & Machine LearningR programming & Machine Learning
R programming & Machine LearningAmanBhalla14
 
Data analysis with R
Data analysis with RData analysis with R
Data analysis with RShareThis
 
Introduction to R
Introduction to RIntroduction to R
Introduction to Ragnonchik
 
introtorandrstudio.ppt
introtorandrstudio.pptintrotorandrstudio.ppt
introtorandrstudio.pptMalkaParveen3
 
Hands on data science with r.pptx
Hands  on data science with r.pptxHands  on data science with r.pptx
Hands on data science with r.pptxNimrita Koul
 
R Programming - part 1.pdf
R Programming - part 1.pdfR Programming - part 1.pdf
R Programming - part 1.pdfRohanBorgalli
 
R and Visualization: A match made in Heaven
R and Visualization: A match made in HeavenR and Visualization: A match made in Heaven
R and Visualization: A match made in HeavenEdureka!
 

Similar to Introduction to R for Data Science :: Session 6 [Linear Regression in R] (20)

Rattle Graphical Interface for R Language
Rattle Graphical Interface for R LanguageRattle Graphical Interface for R Language
Rattle Graphical Interface for R Language
 
Introduction to R for data science
Introduction to R for data scienceIntroduction to R for data science
Introduction to R for data science
 
Extending lifespan with Hadoop and R
Extending lifespan with Hadoop and RExtending lifespan with Hadoop and R
Extending lifespan with Hadoop and R
 
Rtutorial
RtutorialRtutorial
Rtutorial
 
R seminar dplyr package
R seminar dplyr packageR seminar dplyr package
R seminar dplyr package
 
Gsas intro rvd (1)
Gsas intro rvd (1)Gsas intro rvd (1)
Gsas intro rvd (1)
 
DATA MINING USING R (1).pptx
DATA MINING USING R (1).pptxDATA MINING USING R (1).pptx
DATA MINING USING R (1).pptx
 
Language Technology Enhanced Learning
Language Technology Enhanced LearningLanguage Technology Enhanced Learning
Language Technology Enhanced Learning
 
3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB
3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB
3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB
 
User biglm
User biglmUser biglm
User biglm
 
Compiling openCypher graph queries with Spark Catalyst
Compiling openCypher graph queries with Spark CatalystCompiling openCypher graph queries with Spark Catalyst
Compiling openCypher graph queries with Spark Catalyst
 
R Language Introduction
R Language IntroductionR Language Introduction
R Language Introduction
 
An Introduction to Data Mining with R
An Introduction to Data Mining with RAn Introduction to Data Mining with R
An Introduction to Data Mining with R
 
R programming & Machine Learning
R programming & Machine LearningR programming & Machine Learning
R programming & Machine Learning
 
Data analysis with R
Data analysis with RData analysis with R
Data analysis with R
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
 
introtorandrstudio.ppt
introtorandrstudio.pptintrotorandrstudio.ppt
introtorandrstudio.ppt
 
Hands on data science with r.pptx
Hands  on data science with r.pptxHands  on data science with r.pptx
Hands on data science with r.pptx
 
R Programming - part 1.pdf
R Programming - part 1.pdfR Programming - part 1.pdf
R Programming - part 1.pdf
 
R and Visualization: A match made in Heaven
R and Visualization: A match made in HeavenR and Visualization: A match made in Heaven
R and Visualization: A match made in Heaven
 

More from Goran S. Milovanovic

Geneva Social Media Index - Report 2015 full report
Geneva Social Media Index - Report 2015 full reportGeneva Social Media Index - Report 2015 full report
Geneva Social Media Index - Report 2015 full reportGoran S. Milovanovic
 
Milovanović, G.S., Krstić, M. & Filipović, O. (2015). Kršenje homogenosti pre...
Milovanović, G.S., Krstić, M. & Filipović, O. (2015). Kršenje homogenosti pre...Milovanović, G.S., Krstić, M. & Filipović, O. (2015). Kršenje homogenosti pre...
Milovanović, G.S., Krstić, M. & Filipović, O. (2015). Kršenje homogenosti pre...Goran S. Milovanovic
 
247113920-Cognitive-technologies-mapping-the-Internet-governance-debate
247113920-Cognitive-technologies-mapping-the-Internet-governance-debate247113920-Cognitive-technologies-mapping-the-Internet-governance-debate
247113920-Cognitive-technologies-mapping-the-Internet-governance-debateGoran S. Milovanovic
 
Učenje i viši kognitivni procesi 10. Simboličke funkcije, VI Deo: Rešavanje p...
Učenje i viši kognitivni procesi 10. Simboličke funkcije, VI Deo: Rešavanje p...Učenje i viši kognitivni procesi 10. Simboličke funkcije, VI Deo: Rešavanje p...
Učenje i viši kognitivni procesi 10. Simboličke funkcije, VI Deo: Rešavanje p...Goran S. Milovanovic
 
Učenje i viši kognitivni procesi 9. Simboličke funkcije, V Deo: Rezonovanje u...
Učenje i viši kognitivni procesi 9. Simboličke funkcije, V Deo: Rezonovanje u...Učenje i viši kognitivni procesi 9. Simboličke funkcije, V Deo: Rezonovanje u...
Učenje i viši kognitivni procesi 9. Simboličke funkcije, V Deo: Rezonovanje u...Goran S. Milovanovic
 
Učenje i viši kognitivni procesi 9. Simboličke funkcije, V Deo: Suđenje, heur...
Učenje i viši kognitivni procesi 9. Simboličke funkcije, V Deo: Suđenje, heur...Učenje i viši kognitivni procesi 9. Simboličke funkcije, V Deo: Suđenje, heur...
Učenje i viši kognitivni procesi 9. Simboličke funkcije, V Deo: Suđenje, heur...Goran S. Milovanovic
 
Učenje i viši kognitivni procesi 8. Simboličke funkcije, IV Deo: Analogija i ...
Učenje i viši kognitivni procesi 8. Simboličke funkcije, IV Deo: Analogija i ...Učenje i viši kognitivni procesi 8. Simboličke funkcije, IV Deo: Analogija i ...
Učenje i viši kognitivni procesi 8. Simboličke funkcije, IV Deo: Analogija i ...Goran S. Milovanovic
 
Učenje i viši kognitivni procesi 9. Simboličke funkcije, III Deo: Kauzalnost,...
Učenje i viši kognitivni procesi 9. Simboličke funkcije, III Deo: Kauzalnost,...Učenje i viši kognitivni procesi 9. Simboličke funkcije, III Deo: Kauzalnost,...
Učenje i viši kognitivni procesi 9. Simboličke funkcije, III Deo: Kauzalnost,...Goran S. Milovanovic
 
Učenje i viši kognitivni procesi 8. Simboličke funkcije, II Deo: Distribuiran...
Učenje i viši kognitivni procesi 8. Simboličke funkcije, II Deo: Distribuiran...Učenje i viši kognitivni procesi 8. Simboličke funkcije, II Deo: Distribuiran...
Učenje i viši kognitivni procesi 8. Simboličke funkcije, II Deo: Distribuiran...Goran S. Milovanovic
 
Učenje i viši kognitivni procesi 8. Simboličke funkcije, II Deo: Konekcioniza...
Učenje i viši kognitivni procesi 8. Simboličke funkcije, II Deo: Konekcioniza...Učenje i viši kognitivni procesi 8. Simboličke funkcije, II Deo: Konekcioniza...
Učenje i viši kognitivni procesi 8. Simboličke funkcije, II Deo: Konekcioniza...Goran S. Milovanovic
 
Učenje i viši kognitivni procesi 7a. Simboličke funkcije, I Deo: Učenje kateg...
Učenje i viši kognitivni procesi 7a. Simboličke funkcije, I Deo: Učenje kateg...Učenje i viši kognitivni procesi 7a. Simboličke funkcije, I Deo: Učenje kateg...
Učenje i viši kognitivni procesi 7a. Simboličke funkcije, I Deo: Učenje kateg...Goran S. Milovanovic
 
Učenje i viši kognitivni procesi 7. Simboličke funkcije, I Deo: Koncepti, kat...
Učenje i viši kognitivni procesi 7. Simboličke funkcije, I Deo: Koncepti, kat...Učenje i viši kognitivni procesi 7. Simboličke funkcije, I Deo: Koncepti, kat...
Učenje i viši kognitivni procesi 7. Simboličke funkcije, I Deo: Koncepti, kat...Goran S. Milovanovic
 
Učenje i viši kognitivni procesi 7. Učenje, IV Deo: Neasocijativno učenje, ef...
Učenje i viši kognitivni procesi 7. Učenje, IV Deo: Neasocijativno učenje, ef...Učenje i viši kognitivni procesi 7. Učenje, IV Deo: Neasocijativno učenje, ef...
Učenje i viši kognitivni procesi 7. Učenje, IV Deo: Neasocijativno učenje, ef...Goran S. Milovanovic
 
Učenje i viši kognitivni procesi 6. Učenje, III Deo: Hernstejnov zakon slagan...
Učenje i viši kognitivni procesi 6. Učenje, III Deo: Hernstejnov zakon slagan...Učenje i viši kognitivni procesi 6. Učenje, III Deo: Hernstejnov zakon slagan...
Učenje i viši kognitivni procesi 6. Učenje, III Deo: Hernstejnov zakon slagan...Goran S. Milovanovic
 
Učenje i viši kognitivni procesi 6. Učenje, III Deo: Instrumentalno učenje
Učenje i viši kognitivni procesi 6. Učenje, III Deo: Instrumentalno učenjeUčenje i viši kognitivni procesi 6. Učenje, III Deo: Instrumentalno učenje
Učenje i viši kognitivni procesi 6. Učenje, III Deo: Instrumentalno učenjeGoran S. Milovanovic
 
Učenje i viši kognitivni procesi 5. Učenje, II Deo: Blokiranje, osenčavanje, ...
Učenje i viši kognitivni procesi 5. Učenje, II Deo: Blokiranje, osenčavanje, ...Učenje i viši kognitivni procesi 5. Učenje, II Deo: Blokiranje, osenčavanje, ...
Učenje i viši kognitivni procesi 5. Učenje, II Deo: Blokiranje, osenčavanje, ...Goran S. Milovanovic
 
Učenje i viši kognitivni procesi 5. Učenje, II Deo: klasično uslovljavanje i ...
Učenje i viši kognitivni procesi 5. Učenje, II Deo: klasično uslovljavanje i ...Učenje i viši kognitivni procesi 5. Učenje, II Deo: klasično uslovljavanje i ...
Učenje i viši kognitivni procesi 5. Učenje, II Deo: klasično uslovljavanje i ...Goran S. Milovanovic
 
Učenje i viši kognitivni procesi 5. Učenje, I Deo
Učenje i viši kognitivni procesi 5. Učenje, I DeoUčenje i viši kognitivni procesi 5. Učenje, I Deo
Učenje i viši kognitivni procesi 5. Učenje, I DeoGoran S. Milovanovic
 
Učenje i viši kognitivni procesi 4a. Debata o racionalnosti, nastavak
Učenje i viši kognitivni procesi 4a. Debata o racionalnosti, nastavakUčenje i viši kognitivni procesi 4a. Debata o racionalnosti, nastavak
Učenje i viši kognitivni procesi 4a. Debata o racionalnosti, nastavakGoran S. Milovanovic
 
Učenje i viši kognitivni procesi 4. Debata o racionalnosti
Učenje i viši kognitivni procesi 4. Debata o racionalnostiUčenje i viši kognitivni procesi 4. Debata o racionalnosti
Učenje i viši kognitivni procesi 4. Debata o racionalnostiGoran S. Milovanovic
 

More from Goran S. Milovanovic (20)

Geneva Social Media Index - Report 2015 full report
Geneva Social Media Index - Report 2015 full reportGeneva Social Media Index - Report 2015 full report
Geneva Social Media Index - Report 2015 full report
 
Milovanović, G.S., Krstić, M. & Filipović, O. (2015). Kršenje homogenosti pre...
Milovanović, G.S., Krstić, M. & Filipović, O. (2015). Kršenje homogenosti pre...Milovanović, G.S., Krstić, M. & Filipović, O. (2015). Kršenje homogenosti pre...
Milovanović, G.S., Krstić, M. & Filipović, O. (2015). Kršenje homogenosti pre...
 
247113920-Cognitive-technologies-mapping-the-Internet-governance-debate
247113920-Cognitive-technologies-mapping-the-Internet-governance-debate247113920-Cognitive-technologies-mapping-the-Internet-governance-debate
247113920-Cognitive-technologies-mapping-the-Internet-governance-debate
 
Učenje i viši kognitivni procesi 10. Simboličke funkcije, VI Deo: Rešavanje p...
Učenje i viši kognitivni procesi 10. Simboličke funkcije, VI Deo: Rešavanje p...Učenje i viši kognitivni procesi 10. Simboličke funkcije, VI Deo: Rešavanje p...
Učenje i viši kognitivni procesi 10. Simboličke funkcije, VI Deo: Rešavanje p...
 
Učenje i viši kognitivni procesi 9. Simboličke funkcije, V Deo: Rezonovanje u...
Učenje i viši kognitivni procesi 9. Simboličke funkcije, V Deo: Rezonovanje u...Učenje i viši kognitivni procesi 9. Simboličke funkcije, V Deo: Rezonovanje u...
Učenje i viši kognitivni procesi 9. Simboličke funkcije, V Deo: Rezonovanje u...
 
Učenje i viši kognitivni procesi 9. Simboličke funkcije, V Deo: Suđenje, heur...
Učenje i viši kognitivni procesi 9. Simboličke funkcije, V Deo: Suđenje, heur...Učenje i viši kognitivni procesi 9. Simboličke funkcije, V Deo: Suđenje, heur...
Učenje i viši kognitivni procesi 9. Simboličke funkcije, V Deo: Suđenje, heur...
 
Učenje i viši kognitivni procesi 8. Simboličke funkcije, IV Deo: Analogija i ...
Učenje i viši kognitivni procesi 8. Simboličke funkcije, IV Deo: Analogija i ...Učenje i viši kognitivni procesi 8. Simboličke funkcije, IV Deo: Analogija i ...
Učenje i viši kognitivni procesi 8. Simboličke funkcije, IV Deo: Analogija i ...
 
Učenje i viši kognitivni procesi 9. Simboličke funkcije, III Deo: Kauzalnost,...
Učenje i viši kognitivni procesi 9. Simboličke funkcije, III Deo: Kauzalnost,...Učenje i viši kognitivni procesi 9. Simboličke funkcije, III Deo: Kauzalnost,...
Učenje i viši kognitivni procesi 9. Simboličke funkcije, III Deo: Kauzalnost,...
 
Učenje i viši kognitivni procesi 8. Simboličke funkcije, II Deo: Distribuiran...
Učenje i viši kognitivni procesi 8. Simboličke funkcije, II Deo: Distribuiran...Učenje i viši kognitivni procesi 8. Simboličke funkcije, II Deo: Distribuiran...
Učenje i viši kognitivni procesi 8. Simboličke funkcije, II Deo: Distribuiran...
 
Učenje i viši kognitivni procesi 8. Simboličke funkcije, II Deo: Konekcioniza...
Učenje i viši kognitivni procesi 8. Simboličke funkcije, II Deo: Konekcioniza...Učenje i viši kognitivni procesi 8. Simboličke funkcije, II Deo: Konekcioniza...
Učenje i viši kognitivni procesi 8. Simboličke funkcije, II Deo: Konekcioniza...
 
Učenje i viši kognitivni procesi 7a. Simboličke funkcije, I Deo: Učenje kateg...
Učenje i viši kognitivni procesi 7a. Simboličke funkcije, I Deo: Učenje kateg...Učenje i viši kognitivni procesi 7a. Simboličke funkcije, I Deo: Učenje kateg...
Učenje i viši kognitivni procesi 7a. Simboličke funkcije, I Deo: Učenje kateg...
 
Učenje i viši kognitivni procesi 7. Simboličke funkcije, I Deo: Koncepti, kat...
Učenje i viši kognitivni procesi 7. Simboličke funkcije, I Deo: Koncepti, kat...Učenje i viši kognitivni procesi 7. Simboličke funkcije, I Deo: Koncepti, kat...
Učenje i viši kognitivni procesi 7. Simboličke funkcije, I Deo: Koncepti, kat...
 
Učenje i viši kognitivni procesi 7. Učenje, IV Deo: Neasocijativno učenje, ef...
Učenje i viši kognitivni procesi 7. Učenje, IV Deo: Neasocijativno učenje, ef...Učenje i viši kognitivni procesi 7. Učenje, IV Deo: Neasocijativno učenje, ef...
Učenje i viši kognitivni procesi 7. Učenje, IV Deo: Neasocijativno učenje, ef...
 
Učenje i viši kognitivni procesi 6. Učenje, III Deo: Hernstejnov zakon slagan...
Učenje i viši kognitivni procesi 6. Učenje, III Deo: Hernstejnov zakon slagan...Učenje i viši kognitivni procesi 6. Učenje, III Deo: Hernstejnov zakon slagan...
Učenje i viši kognitivni procesi 6. Učenje, III Deo: Hernstejnov zakon slagan...
 
Učenje i viši kognitivni procesi 6. Učenje, III Deo: Instrumentalno učenje
Učenje i viši kognitivni procesi 6. Učenje, III Deo: Instrumentalno učenjeUčenje i viši kognitivni procesi 6. Učenje, III Deo: Instrumentalno učenje
Učenje i viši kognitivni procesi 6. Učenje, III Deo: Instrumentalno učenje
 
Učenje i viši kognitivni procesi 5. Učenje, II Deo: Blokiranje, osenčavanje, ...
Učenje i viši kognitivni procesi 5. Učenje, II Deo: Blokiranje, osenčavanje, ...Učenje i viši kognitivni procesi 5. Učenje, II Deo: Blokiranje, osenčavanje, ...
Učenje i viši kognitivni procesi 5. Učenje, II Deo: Blokiranje, osenčavanje, ...
 
Učenje i viši kognitivni procesi 5. Učenje, II Deo: klasično uslovljavanje i ...
Učenje i viši kognitivni procesi 5. Učenje, II Deo: klasično uslovljavanje i ...Učenje i viši kognitivni procesi 5. Učenje, II Deo: klasično uslovljavanje i ...
Učenje i viši kognitivni procesi 5. Učenje, II Deo: klasično uslovljavanje i ...
 
Učenje i viši kognitivni procesi 5. Učenje, I Deo
Učenje i viši kognitivni procesi 5. Učenje, I DeoUčenje i viši kognitivni procesi 5. Učenje, I Deo
Učenje i viši kognitivni procesi 5. Učenje, I Deo
 
Učenje i viši kognitivni procesi 4a. Debata o racionalnosti, nastavak
Učenje i viši kognitivni procesi 4a. Debata o racionalnosti, nastavakUčenje i viši kognitivni procesi 4a. Debata o racionalnosti, nastavak
Učenje i viši kognitivni procesi 4a. Debata o racionalnosti, nastavak
 
Učenje i viši kognitivni procesi 4. Debata o racionalnosti
Učenje i viši kognitivni procesi 4. Debata o racionalnostiUčenje i viši kognitivni procesi 4. Debata o racionalnosti
Učenje i viši kognitivni procesi 4. Debata o racionalnosti
 

Recently uploaded

4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptxmary850239
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsPooky Knightsmith
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptxJonalynLegaspi2
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 

Recently uploaded (20)

4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young minds
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptx
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 

Introduction to R for Data Science :: Session 6 [Linear Regression in R]

  • 1. Introduction to R for Data Science Lecturers dipl. ing Branko Kovač Data Analyst at CUBE/Data Science Mentor at Springboard Data Science zajednica Srbije branko.kovac@gmail.com dr Goran S. Milovanović Data Scientist at DiploFoundation Data Science zajednica Srbije goran.s.milovanovic@gmail.com goranm@diplomacy.edu
  • 2. Linear Regression in R • Exploratory Data Analysis • Assumptions of the Linear Model • Correlation • Normality Tests • Linear Regression • Prediction, Confidence Intervals, Residuals • Influential Cases and the Influence Plot Intro to R for Data Science Session 6: Linear Regression in R
  • 3. # Introduction to R for Data Science # SESSION 6 :: 02 June, 2016 # clear rm(list=ls()) #### read data library(datasets) data(iris) ### iris data set description: # https://stat.ethz.ch/R-manual/R-devel/library/iriss/html/iris.html ### ExploratoryData Analysis (EDA) str(iris) summary(iris) Linear Regression in R • Before modeling: Assumptions and Exploratory Data Analysis (EDA) Intro to R for Data Science Session 6: Linear Regression in R
  • 4. # Introduction to R for Data Science # SESSION 6 :: 02 June, 2016 ### EDA plots # plot layout:2 x 2 par(mfcol = c(2,2)) # boxplotiris$Sepal.Length boxplot(iris$Sepal.Length, horizontal = TRUE, xlab="Sepal Length") # histogram:iris$Sepal.Length hist(iris$Sepal.Length, main="", xlab="Sepal.Length", prob=T) # overlay iris$Sepal.Length density functionoverthe empiricaldistribution lines(density(iris$Sepal.Length), lty="dashed", lwd=2.5, col="red") EDA Intro to R for Data Science Session 6: Linear Regression in R
  • 5. Linear Regression in R • EDA Intro to R for Data Science Session 6: Linear Regression in R
  • 6. Intro to R for Data Science Session 6: Linear Regression in R
  • 7. # Introduction to R for Data Science # SESSION 6 :: 02 June, 2016 ## Pearsoncorrelationin R {base} cor1 <- cor(iris$Sepal.Length, iris$Petal.Length, method="pearson") cor1 par(mfcol = c(1,1)) plot(iris$Sepal.Length, iris$Petal.Length, main = "Sepal Length vs Petal Length", xlab = "Sepal Length", ylab = "Petal Length") ## Correlation matrix and treatmentof missing data dSet <- iris # Remove one discretevariable dSet$Species <- NULL # introduce NA in dSet$Sepal.Length[5] dSet$Sepal.Length[5] <- NA # Pairwise and Listwise Deletion: cor1a <- cor(dSet,use="complete.obs") # listwise deletion cor1a <- cor(dSet,use="pairwise.complete.obs") # pairwise deletion cor1a <- cor(dSet,use="all.obs") # all observations -error Correlation Intro to R for Data Science Session 6: Linear Regression in R
  • 8. # Introduction to R for Data Science # SESSION 6 :: 02 June, 2016 library(Hmisc) cor2 <- rcorr(iris$Sepal.Length, iris$Petal.Length, type="pearson") cor2$r # correlations cor2$r[1,2] # that's whatyou need,right cor2$P # significantat cor2$n # num.observations # NOTE: rcorr uses Pairwise deletion! # Correlation matrix cor2a <- rcorr(as.matrix(dSet), type="pearson") # NOTE:as.matrix # select significant at alpha == .05 w <- which(!(cor2a$P<.05),arr.ind = T) cor2a$r[w] <- NA cor2a$P # comparew. cor2a$r Correlation {Hmisc} Intro to R for Data Science Session 6: Linear Regression in R
  • 9. # Introduction to R for Data Science # SESSION 6 :: 02 June, 2016 # LinearRegression:lm() # Predicting:PetalLength from SepalLength reg <- lm(Petal.Length ~ Sepal.Length, data=iris) class(reg) summary(reg) coefsReg <- coefficients(reg) coefsReg slopeReg <- coefsReg[2] interceptReg <- coefsReg[1] # Prediction from this model newSLength <- data.frame(Sepal.Length = runif(100, min(iris$Sepal.Length), max(iris$Sepal.Length)) ) # watch the variable namesin the new data.frame! predictPLength <- predict(reg, newSLength) predictPLength Linear Regression with lm() Intro to R for Data Science Session 6: Linear Regression in R
  • 10. # Introduction to R for Data Science # SESSION 6 :: 02 June, 2016 # Standardizedregressioncoefficients {QuantPsych} library(QuantPsyc) lm.beta(reg) # Reminder:standardizedregressioncoefficientsare... # What you would obtain upon performinglinearregressionoverstandardizedvariables # z-score in R zSLength <- scale(iris$Sepal.Length, center = T, scale = T) # computes z-score zPLength <- scale(iris$Petal.Length, center = T, scale = T) # again;?scale # new dSetw. standardized variables dSet <- data.frame(Sepal.Length <- zSLength, Petal.Length <- zPLength) # LinearRegression w.lm() overstandardized variables reg1 <- lm(Petal.Length ~ Sepal.Length, data=dSet) summary(reg1) # compare coefficients(reg1)[2] # beta from reg1 lm.beta(reg) # standardizedbeta w. QuantPscy lm.beta from reg Standardized Regression Coefficients Intro to R for Data Science Session 6: Linear Regression in R
  • 11. # Introduction to R for Data Science # SESSION 6 :: 02 June, 2016 # plots w. {base}and {ggplot2} library(ggplot2) # Predictorvs Criterion {base} plot(iris$Sepal.Length, iris$Petal.Length, main = "Petal Length vs Sepal Length", xlab = "Sepal Length", ylab = "Petal Length" ) abline(reg,col="red") # Predictorvs Criterion {ggplot2} ggplot(data = iris, aes(x = Sepal.Length, y = Petal.Length)) + geom_point(size = 2, colour = "black") + geom_point(size = 1, colour = "white") + geom_smooth(aes(colour = "red"), method='lm') + ggtitle("Sepal Length vs Petal Length") + xlab("Sepal Length") + ylab("Petal Length") + theme(legend.position = "none") Plots {base} vs {ggplot2} Intro to R for Data Science Session 6: Linear Regression in R
  • 12. Plots {base} vs {ggplot2} Intro to R for Data Science Session 6: Linear Regression in R
  • 13. # Introduction to R for Data Science # SESSION 6 :: 02 June, 2016 # Predicted vs.residuals {ggplot2} predReg <- predict(reg) # get predictions from reg resReg <- residuals(reg) # get residuals from reg # resStReg <- rstandard(reg)# get residualsfrom reg plotFrame <- data.frame(predicted = predReg, residual = resReg); ggplot(data = plotFrame, aes(x = predicted, y = residual)) + geom_point(size = 2, colour = "black") + geom_point(size = 1, colour = "white") + geom_smooth(aes(colour = "blue"), method='lm', se=F) + ggtitle("Predicted vs Residual Lengths") + xlab("Predicted Lengths") + ylab("Residual") + theme(legend.position = "none") Predicted vs Residuals Intro to R for Data Science Session 6: Linear Regression in R
  • 14. Predicted vs Residuals Intro to R for Data Science Session 6: Linear Regression in R
  • 15. # Introduction to R for Data Science # SESSION 6 :: 02 June, 2016 ## Detectinfluentialcases infReg <- as.data.frame(influence.measures(reg)$infmat) # Cook's Distance:Cook and Weisberg(1982): # values greaterthan 1 are troublesome wCook <- which(infReg$cook.d>1) # we're fine here # Average Leverage = (k+1)/n,k - num. of predictors,n - num. observations # Also termed:hat values,range:0 - 1 # see: https://en.wikipedia.org/wiki/Leverage_%28statistics%29 # Various criteria (twice the leverage,three times the average...) wLev <- which(infReg$hat>2*(2/length(iris$price))) # we seem to be fine here too... ## Influenceplot infReg <- as.data.frame(influence.measures(reg)$infmat) plotFrame <- data.frame(residual = resStReg, leverage = infReg$hat, cookD = infReg$cook.d) Infulential Cases + Infulence Plot Intro to R for Data Science Session 6: Linear Regression in R
  • 16. # Introduction to R for Data Science # SESSION 6 :: 02 June, 2016 ggplot(plotFrame, aes(y = residual, x = leverage)) + geom_point(size = plotFrame$cookD*100, shape = 1) + ggtitle("Influence PlotnSize of the circle corresponds to Cook's distance") + theme(plot.title = element_text(size=8, face="bold")) + ylab("Standardized Residual") + xlab("Leverage") Infulence Plot Intro to R for Data Science Session 6: Linear Regression in R
  • 17. Infulence Plot Intro to R for Data Science Session 6: Linear Regression in R