SlideShare una empresa de Scribd logo
1 de 26
Datenanalyse mit R
Dmitrij Petrov, Rahman Gökbulut, Mesut Sahin, Jeanne Falonne Magne Signe
Agenda
1. Einführung in das Projekt
2. Einführung in R
3. Explorative Datenanalyse
1. Korrelation & Histogramme
2. Test auf Normalverteilung und QQ-Plot
3. Potenz Transformation (Box-Cox)
4. Lineares Modell
4. Interaktive Aplikation mit Shiny Framework
5. Zusammenfassung
1.Einführung in das Projekt
● Datensatz: Facebook Statistiken über 576 Fan Page-Beiträgen
○ Fan Pages wurden unterschieden auf:
■ Service & Produkt Community
● Ziel: Wie wird User Engagement von Acquaintance beeinflusst?
● Methoden: Statistische Analyse mit R
2. R
● Statistik Software
o von Ross Ihaka und Robert Gentleman in 1991 entwickelt [1]
o seit 1995 unter GNU GPL
● Ist eine Implementierung von S (John Chambers et al. @ Bell Labs 1976) [2]
● Erst aber 2000 stabil und aktiv von R Core Group weiter entwickelt
● Heute >2 Implementierungen: S-PLUS (commerziel) und R (GNU GPL)
o mit vielen weiteren Distributionen:
 Revolution R Open (ab 1Q. 2015 Microsoft)
 Oracle R Enterprise
R
● Geschrieben in C (35%) & Fortran (24%) & R (38%)
● Objekte & Daten werden explizit im RAM gespeichert
o 100 Millionen x 5 Matrix 4 GB RAM [3]
● Sehr umfangreich
o Funktionalität in modularen Pakete aufgeteilt (z.B. von CRAN oder GitHub
zum herunterladen)
● Heute populär bei Forschern für Data Mining Zwecke
o statt SPSS, SAS, Stata usw., siehe TIOBE Index [4]
3. Explorative Datenanalyse (EDA)
Korrelation
● Beschreibt eine Beziehung zwischen ein oder mehreren Merkmalen
o muss aber keine Ursache-Wirkung-Beziehung (Kausalität) bestehen
● Korrelationskoeffizient r als Maß der Beziehung
o -1 = "Starker negativer Zusammenhang"
o 0 = "Kein Zusammenhang"
o 1 = "Starker positiver Zusammenhang"
Variable/Datensätze Produkt Service Gemeinsam
User Engagement <-> Acquaintance 0.70 0.63 0.54
Streudiagramm
"Graphische Darstellung von beobachteten Wertepaaren zweier statistischer
Merkmale" [5]
● Wertepaare werden als Punkte dargestellt
● Das Muster gibt Infos über die Abhängigkeit der beiden Merkmale
Diagramm von “Service” Merkmalen
r = 0.63
Schritte zum Linearen Modell
Histogramm von User Engagement
Normalverteilung
● Bezeichnet eine wichtige Form der Wahrscheinlichkeitsverteilung
o Aussehen und Eigenschaften werden von Erwartungswert und Varianz bestimmt [6, 7]
o Benutzt z.B. bei der annäherten Beschreibung von Körpergröße, Einkommen usw.
Histogramm von User Engagement
Überprüfung auf die Normalverteilung
● Verschiedene Möglichkeiten, wie z.B. Chi-Quadrat-Test, QQ-Plot usw.
● QQ-Plot:
o vgl. die Quantile der Normalverteilung Quantile der Daten
o Wenn Punkte annähernd auf einer Geraden liegen normalverteilt
QQ-Plot von User Engagement
Box-Cox (Potenz) Transformation
● Frage: Finde einen Lambda Wert, sodass die Punkte von dem QQ-Plot möglichst
gut auf der Gerade liegen, was auch zu der größten Korrelation führt [8]
Variable/Datensätze Produkt Service Gemeinsam
User Engagement 0.497 0.0005 0.490
Acquaintance 0.895 0.139 0.445
Abschätzung der linearen Parameter
Konfidenzgebiet
● Ellipsengleichung
● Einfluss der Korrelation[10] :
● Gute Korrelation kleine ε Fehler Ellipse ist klein
● Schlechte Korrelation große ε Fehler Ellipse ist
groß
95% - Konfidenzgebiet
Lineares Modell in R
##
## Call:
## lm(formula = yUserEng ~ xAcq)
##
## Residuals:
## Min 1Q Median 3Q Max
## -42.213 -6.108 -1.490 7.728 51.194
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -4.43115 3.20334 -1.383 0.168
## xAcq 1.20806 0.07288 16.576 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 14.12 on 298 degrees of freedom
## Multiple R-squared: 0.4797, Adjusted R-squared: 0.478
## F-statistic: 274.8 on 1 and 298 DF, p-value: < 2.2e-16
Eingabe des Linearen Modells in R
Y-Achsenabschnitt (= -4.4)
Steigung der Gerade x (= 1.2)
Bestimmtheitsmaß R^2 (= 0.48)
4. Shiny Framework
● R framework für die interaktive Web Anwendungen [9]
● Jede Shiny App besteht aus:
o UI.R steuert das Layout und Aussehen
o SERVER.R enthält Befehle z.B. zur Berechnungen oder Grafiken
● Basiert auf Twitter's Bootstrap HTML/CSS/JS framework
● Ziel: Wie arbeitet man mit Shiny ?
● Live DEMO: http://shiny.b40.cz/SemesterProject/shiny
5. Zusammenfassung
Start
Einarbeitung in R
u.a. z.B. Shiny
Ende
Explorative Datenanalyse
Box-Cox (Potenz) Transformation
Test auf Normalverteilung ?
Korrelation
Abschätzung Lineares Modell
Quellen
1. https://github.com/rdpeng/courses/blob/master/02_RProgramming/OverviewHistoryR/index.m
d
2. https://www-conf.slac.stanford.edu/xldb2015/Talks2015/9_Tues_Chambers-
XLDBConference.pdf
3. http://www.stat.yale.edu/~mjk56/temp/bigmemory-vignette.pdf
4. http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
5. http://de.wikipedia.org/wiki/Streudiagramm
6. http://flexikon.doccheck.com/de/Normalverteilung
7. http://matheguru.com/stochastik/31-normalverteilung.html
8. http://onlinestatbook.com/2/transformations/box-cox.html
9. https://github.com/rstudio/webinars/blob/master/2015-05/How-to-start-Shiny-1/01-How-to-
start.pdf
10. http://www.freddiemac.com/finance/smm/july98/pdfs/sol_lekk.pdf
Wir danken für ihre Aufmerksamkeit !
Folgende Werkzeuge wurden benutzt:
● RStudio IDE - http://www.rstudio.com
● Web Applications Framework für R - http://shiny.rstudio.com/
● https://github.com/dmpe/SemesterProject
Haben Sie Fragen ?

Más contenido relacionado

Más de F789GH

Smart Factory: ICT Requirements
Smart Factory: ICT RequirementsSmart Factory: ICT Requirements
Smart Factory: ICT RequirementsF789GH
 
Presentations on two case studies
Presentations on two case studiesPresentations on two case studies
Presentations on two case studiesF789GH
 
Introduction to the Corporate Social Responsibility
Introduction to the Corporate Social ResponsibilityIntroduction to the Corporate Social Responsibility
Introduction to the Corporate Social ResponsibilityF789GH
 
Project Management with Microsoft SharePoint and VCSs (Git & SVN)
Project Management with Microsoft SharePoint and VCSs (Git & SVN)Project Management with Microsoft SharePoint and VCSs (Git & SVN)
Project Management with Microsoft SharePoint and VCSs (Git & SVN)F789GH
 
SkyBoard Inc.: Transition to SAP ERP
SkyBoard Inc.: Transition to SAP ERPSkyBoard Inc.: Transition to SAP ERP
SkyBoard Inc.: Transition to SAP ERPF789GH
 
Consuming information: The move from radio to internet
Consuming information: The move from radio to internetConsuming information: The move from radio to internet
Consuming information: The move from radio to internetF789GH
 
Warum mochte ich für FirefoxOS entwickeln
Warum mochte ich für FirefoxOS entwickelnWarum mochte ich für FirefoxOS entwickeln
Warum mochte ich für FirefoxOS entwickelnF789GH
 
Domain name system security extension
Domain name system security extensionDomain name system security extension
Domain name system security extensionF789GH
 
Social CRM in the Banking Environment (in Germany and Swizerland)
Social CRM in the Banking Environment (in Germany and Swizerland)Social CRM in the Banking Environment (in Germany and Swizerland)
Social CRM in the Banking Environment (in Germany and Swizerland)F789GH
 
Data in the 21st century
Data in the 21st centuryData in the 21st century
Data in the 21st centuryF789GH
 
Kernmodelle
KernmodelleKernmodelle
KernmodelleF789GH
 
Moebel
MoebelMoebel
MoebelF789GH
 
Presentace woyzek
Presentace woyzekPresentace woyzek
Presentace woyzekF789GH
 
Warum kann man Pi nicht als einen Bruch aufschreiben ?
 Warum kann man Pi nicht als einen Bruch aufschreiben ? Warum kann man Pi nicht als einen Bruch aufschreiben ?
Warum kann man Pi nicht als einen Bruch aufschreiben ?F789GH
 

Más de F789GH (14)

Smart Factory: ICT Requirements
Smart Factory: ICT RequirementsSmart Factory: ICT Requirements
Smart Factory: ICT Requirements
 
Presentations on two case studies
Presentations on two case studiesPresentations on two case studies
Presentations on two case studies
 
Introduction to the Corporate Social Responsibility
Introduction to the Corporate Social ResponsibilityIntroduction to the Corporate Social Responsibility
Introduction to the Corporate Social Responsibility
 
Project Management with Microsoft SharePoint and VCSs (Git & SVN)
Project Management with Microsoft SharePoint and VCSs (Git & SVN)Project Management with Microsoft SharePoint and VCSs (Git & SVN)
Project Management with Microsoft SharePoint and VCSs (Git & SVN)
 
SkyBoard Inc.: Transition to SAP ERP
SkyBoard Inc.: Transition to SAP ERPSkyBoard Inc.: Transition to SAP ERP
SkyBoard Inc.: Transition to SAP ERP
 
Consuming information: The move from radio to internet
Consuming information: The move from radio to internetConsuming information: The move from radio to internet
Consuming information: The move from radio to internet
 
Warum mochte ich für FirefoxOS entwickeln
Warum mochte ich für FirefoxOS entwickelnWarum mochte ich für FirefoxOS entwickeln
Warum mochte ich für FirefoxOS entwickeln
 
Domain name system security extension
Domain name system security extensionDomain name system security extension
Domain name system security extension
 
Social CRM in the Banking Environment (in Germany and Swizerland)
Social CRM in the Banking Environment (in Germany and Swizerland)Social CRM in the Banking Environment (in Germany and Swizerland)
Social CRM in the Banking Environment (in Germany and Swizerland)
 
Data in the 21st century
Data in the 21st centuryData in the 21st century
Data in the 21st century
 
Kernmodelle
KernmodelleKernmodelle
Kernmodelle
 
Moebel
MoebelMoebel
Moebel
 
Presentace woyzek
Presentace woyzekPresentace woyzek
Presentace woyzek
 
Warum kann man Pi nicht als einen Bruch aufschreiben ?
 Warum kann man Pi nicht als einen Bruch aufschreiben ? Warum kann man Pi nicht als einen Bruch aufschreiben ?
Warum kann man Pi nicht als einen Bruch aufschreiben ?
 

Datenanalyse mit R

  • 1. Datenanalyse mit R Dmitrij Petrov, Rahman Gökbulut, Mesut Sahin, Jeanne Falonne Magne Signe
  • 2. Agenda 1. Einführung in das Projekt 2. Einführung in R 3. Explorative Datenanalyse 1. Korrelation & Histogramme 2. Test auf Normalverteilung und QQ-Plot 3. Potenz Transformation (Box-Cox) 4. Lineares Modell 4. Interaktive Aplikation mit Shiny Framework 5. Zusammenfassung
  • 3. 1.Einführung in das Projekt ● Datensatz: Facebook Statistiken über 576 Fan Page-Beiträgen ○ Fan Pages wurden unterschieden auf: ■ Service & Produkt Community ● Ziel: Wie wird User Engagement von Acquaintance beeinflusst? ● Methoden: Statistische Analyse mit R
  • 4. 2. R ● Statistik Software o von Ross Ihaka und Robert Gentleman in 1991 entwickelt [1] o seit 1995 unter GNU GPL ● Ist eine Implementierung von S (John Chambers et al. @ Bell Labs 1976) [2] ● Erst aber 2000 stabil und aktiv von R Core Group weiter entwickelt ● Heute >2 Implementierungen: S-PLUS (commerziel) und R (GNU GPL) o mit vielen weiteren Distributionen:  Revolution R Open (ab 1Q. 2015 Microsoft)  Oracle R Enterprise
  • 5. R ● Geschrieben in C (35%) & Fortran (24%) & R (38%) ● Objekte & Daten werden explizit im RAM gespeichert o 100 Millionen x 5 Matrix 4 GB RAM [3] ● Sehr umfangreich o Funktionalität in modularen Pakete aufgeteilt (z.B. von CRAN oder GitHub zum herunterladen) ● Heute populär bei Forschern für Data Mining Zwecke o statt SPSS, SAS, Stata usw., siehe TIOBE Index [4]
  • 7. Korrelation ● Beschreibt eine Beziehung zwischen ein oder mehreren Merkmalen o muss aber keine Ursache-Wirkung-Beziehung (Kausalität) bestehen ● Korrelationskoeffizient r als Maß der Beziehung o -1 = "Starker negativer Zusammenhang" o 0 = "Kein Zusammenhang" o 1 = "Starker positiver Zusammenhang" Variable/Datensätze Produkt Service Gemeinsam User Engagement <-> Acquaintance 0.70 0.63 0.54
  • 8. Streudiagramm "Graphische Darstellung von beobachteten Wertepaaren zweier statistischer Merkmale" [5] ● Wertepaare werden als Punkte dargestellt ● Das Muster gibt Infos über die Abhängigkeit der beiden Merkmale
  • 9. Diagramm von “Service” Merkmalen r = 0.63
  • 11. Histogramm von User Engagement
  • 12. Normalverteilung ● Bezeichnet eine wichtige Form der Wahrscheinlichkeitsverteilung o Aussehen und Eigenschaften werden von Erwartungswert und Varianz bestimmt [6, 7] o Benutzt z.B. bei der annäherten Beschreibung von Körpergröße, Einkommen usw.
  • 13. Histogramm von User Engagement
  • 14. Überprüfung auf die Normalverteilung ● Verschiedene Möglichkeiten, wie z.B. Chi-Quadrat-Test, QQ-Plot usw. ● QQ-Plot: o vgl. die Quantile der Normalverteilung Quantile der Daten o Wenn Punkte annähernd auf einer Geraden liegen normalverteilt
  • 15. QQ-Plot von User Engagement
  • 16. Box-Cox (Potenz) Transformation ● Frage: Finde einen Lambda Wert, sodass die Punkte von dem QQ-Plot möglichst gut auf der Gerade liegen, was auch zu der größten Korrelation führt [8] Variable/Datensätze Produkt Service Gemeinsam User Engagement 0.497 0.0005 0.490 Acquaintance 0.895 0.139 0.445
  • 17.
  • 19. Konfidenzgebiet ● Ellipsengleichung ● Einfluss der Korrelation[10] : ● Gute Korrelation kleine ε Fehler Ellipse ist klein ● Schlechte Korrelation große ε Fehler Ellipse ist groß
  • 21.
  • 22. Lineares Modell in R ## ## Call: ## lm(formula = yUserEng ~ xAcq) ## ## Residuals: ## Min 1Q Median 3Q Max ## -42.213 -6.108 -1.490 7.728 51.194 ## ## Coefficients: ## Estimate Std. Error t value Pr(>|t|) ## (Intercept) -4.43115 3.20334 -1.383 0.168 ## xAcq 1.20806 0.07288 16.576 <2e-16 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## Residual standard error: 14.12 on 298 degrees of freedom ## Multiple R-squared: 0.4797, Adjusted R-squared: 0.478 ## F-statistic: 274.8 on 1 and 298 DF, p-value: < 2.2e-16 Eingabe des Linearen Modells in R Y-Achsenabschnitt (= -4.4) Steigung der Gerade x (= 1.2) Bestimmtheitsmaß R^2 (= 0.48)
  • 23. 4. Shiny Framework ● R framework für die interaktive Web Anwendungen [9] ● Jede Shiny App besteht aus: o UI.R steuert das Layout und Aussehen o SERVER.R enthält Befehle z.B. zur Berechnungen oder Grafiken ● Basiert auf Twitter's Bootstrap HTML/CSS/JS framework ● Ziel: Wie arbeitet man mit Shiny ? ● Live DEMO: http://shiny.b40.cz/SemesterProject/shiny
  • 24. 5. Zusammenfassung Start Einarbeitung in R u.a. z.B. Shiny Ende Explorative Datenanalyse Box-Cox (Potenz) Transformation Test auf Normalverteilung ? Korrelation Abschätzung Lineares Modell
  • 25. Quellen 1. https://github.com/rdpeng/courses/blob/master/02_RProgramming/OverviewHistoryR/index.m d 2. https://www-conf.slac.stanford.edu/xldb2015/Talks2015/9_Tues_Chambers- XLDBConference.pdf 3. http://www.stat.yale.edu/~mjk56/temp/bigmemory-vignette.pdf 4. http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html 5. http://de.wikipedia.org/wiki/Streudiagramm 6. http://flexikon.doccheck.com/de/Normalverteilung 7. http://matheguru.com/stochastik/31-normalverteilung.html 8. http://onlinestatbook.com/2/transformations/box-cox.html 9. https://github.com/rstudio/webinars/blob/master/2015-05/How-to-start-Shiny-1/01-How-to- start.pdf 10. http://www.freddiemac.com/finance/smm/july98/pdfs/sol_lekk.pdf
  • 26. Wir danken für ihre Aufmerksamkeit ! Folgende Werkzeuge wurden benutzt: ● RStudio IDE - http://www.rstudio.com ● Web Applications Framework für R - http://shiny.rstudio.com/ ● https://github.com/dmpe/SemesterProject Haben Sie Fragen ?