Exemples instructifs… Représentations graphiques.

Slides:



Advertisements
Similar presentations
Linear regression models in R (session 1) Tom Price 3 March 2009.
Advertisements

R Language. What is R? Variables in R Summary of data Box plot Histogram Using Help in R.
Lecture 10 F-tests in MLR (continued) Coefficients of Determination BMTRY 701 Biostatistical Methods II.
R: A Statistics Program For Teaching & Research Josué Guzmán 11 Nov. 2007
4/14/ lecture 81 STATS 330: Lecture 8. 4/14/ lecture 82 Collinearity Aims of today’s lecture: Explain the idea of collinearity and its connection.
Graphics in R data analysis and visualization Katia Oleinik Scientific Computing and Visualization Boston University
SPH 247 Statistical Analysis of Laboratory Data 1April 2, 2013SPH 247 Statistical Analysis of Laboratory Data.
Multiple Regression Predicting a response with multiple explanatory variables.
Customizing Graphs Base graphics options. plot() The workhorse plotting function plot(x) plots values of x in sequence or a barplot plot(x, y) produces.
Zinc Data SPH 247 Statistical Analysis of Laboratory Data.
Linear Regression Exploring relationships between two metric variables.
x y z The data as seen in R [1,] population city manager compensation [2,] [3,] [4,]
Examining Relationship of Variables  Response (dependent) variable - measures the outcome of a study.  Explanatory (Independent) variable - explains.
Nemours Biomedical Research Statistics April 2, 2009 Tim Bunnell, Ph.D. & Jobayer Hossain, Ph.D. Nemours Bioinformatics Core Facility.
FISH 397C Winter 2009 Evan Girvetz Basic Statistical Analyses and Contributed Packages in R © R Foundation, from
MATH 3359 Introduction to Mathematical Modeling Linear System, Simple Linear Regression.
Crime? FBI records violent crime, z x y z [1,] [2,] [3,] [4,] [5,]
C82MCP Diploma Statistics School of Psychology University of Nottingham 1 Linear Regression and Linear Prediction Predicting the score on one variable.
How to plot x-y data and put statistics analysis on GLEON Fellowship Workshop January 14-18, 2013 Sunapee, NH Ari Santoso.
Baburao Kamble (Ph.D) University of Nebraska-Lincoln Data Analysis Using R Week5: Charts/Plots in R.
Tree-Based Methods (V&R 9.1) Demeke Kasaw, Andreas Nguyen, Mariana Alvaro STAT 6601 Project.
A quick introduction to R prog. 淡江統計 陳景祥 (Steve Chen)
R-Graphics Day 2 Stephen Opiyo. Basic Graphs One of the main reasons data analysts turn to R is for its strong graphic capabilities. R generates publication-ready.
MATH 3359 Introduction to Mathematical Modeling Project Multiple Linear Regression Multiple Logistic Regression.
Lecture 5: SLR Diagnostics (Continued) Correlation Introduction to Multiple Linear Regression BMTRY 701 Biostatistical Methods II.
7.1 - Motivation Motivation Correlation / Simple Linear Regression Correlation / Simple Linear Regression Extensions of Simple.
Lecture 4: Inference in SLR (continued) Diagnostic approaches in SLR BMTRY 701 Biostatistical Methods II.
Lecture 3: Inference in Simple Linear Regression BMTRY 701 Biostatistical Methods II.
Use of Weighted Least Squares. In fitting models of the form y i = f(x i ) +  i i = 1………n, least squares is optimal under the condition  1 ……….  n.
An Introduction to R graphics Cody Chiuzan Division of Biostatistics and Epidemiology Computing for Research I, 2012.
Exercise 8.25 Stat 121 KJ Wang. Votes for Bush and Buchanan in all Florida Counties Palm Beach County (outlier)
 Create a PowerPoint from template using R software R and ReporteRs package Isaac Newton1/4.
Using R for Marketing Research Dan Toomey 2/23/2015
FACTORS AFFECTING HOUSING PRICES IN SYRACUSE Sample collected from Zillow in January, 2015 Urban Policy Class Exercise - Lecy.
Learn R Toolkit D Kelly O'DayBox, Dot, Histogram, Strip Charts Mod 5 –Box Charts: 1 Module 5 Box, Dot, Histogram, Strip Charts Do See & HearRead Learn.
Robust Regression V & R: Section 6.5 Denise Hum. Leila Saberi. Mi Lam.
Tutorial 4 MBP 1010 Kevin Brown. Correlation Review Pearson’s correlation coefficient – Varies between – 1 (perfect negative linear correlation) and 1.
Lecture 7: Multiple Linear Regression Interpretation with different types of predictors BMTRY 701 Biostatistical Methods II.
R-Graphics Stephen Opiyo. Basic Graphs One of the main reasons data analysts turn to R is for its strong graphic capabilities. R generates publication-ready.
An Introduction to R Statistical Computing AMS 597 Stony Brook University Spring 2009 By Tianyi Zhang.
Environmental Modeling Basic Testing Methods - Statistics III.
Lecture 6: Multiple Linear Regression Adjusted Variable Plots BMTRY 701 Biostatistical Methods II.
R (3) Introduction to Graphics. The main guide R in Action Data Analysis and Graphics with R Robert I. Kabacoff
[1] Simple Linear Regression. The general equation of a line is Y = c + mX or Y =  +  X.  > 0  > 0  > 0  = 0  = 0  < 0  > 0  < 0.
Lecture 6: Multiple Linear Regression Adjusted Variable Plots BMTRY 701 Biostatistical Methods II.
Plotting Complex Figures Using R
Linear Models Alan Lee Sample presentation for STATS 760.
1 Stat 6601 Presentation Presented by: Xiao Li (Winnie) Wenlai Wang Ke Xu Nov. 17, 2004 V & R 6.6.
Tutorial 5 Thursday February 14 MBP 1010 Kevin Brown.
The Effect of Race on Wage by Region. To what extent were black males paid less than nonblack males in the same region with the same levels of education.
Introduction to plotting data Fish 552: Lecture 4.
WSUG M AY 2012 EViews, S-Plus and R Damian Staszek Bristol Water.
Exploring Data: Summary Statistics and Visualizations
Peter Fox and Greg Hughes Data Analytics – ITWS-4600/ITWS-6600
Chapter 12 Simple Linear Regression and Correlation
Résolution de l’ex 1 p40 t=c(2:12);N=c(55,90,135,245,403,665,1100,1810,3000,4450,7350) T=data.frame(t,N,y=log(N));T; > T t N y
Erich Smith Coleman Platt
Correlation and regression
Correlation and Simple Linear Regression
Data Analytics – ITWS-4600/ITWS-6600/MATP-4450
K-Means Lab.
Console Editeur : myProg.R 1
Chapter 12 Simple Linear Regression and Correlation
Regression Transformations for Normality and to Simplify Relationships
Correlation and Simple Linear Regression
Multi Linear Regression Lab
Simple Linear Regression
ITWS-4600/ITWS-6600/MATP-4450/CSCI-4960
Simple Linear Regression and Correlation
Introduction to Linear Modelling Anne Segonds-Pichon v
Presentation transcript:

Exemples instructifs… Représentations graphiques

Fonctions de répartition x=1:6 y=rep(1/6,6) z=cumsum(y) plot(c(0,x),c(0,z),lwd=3,col="blue") segments(0,0,1,0,col="green") segments(x,z, x+1,z)

Utiliser des données de packages existants search() [1] ".GlobalEnv" "package:methods" "package:stats" [4] "package:graphics" "package:grDevices" "package:utils" [7] "package:datasets" "Autoloads" "package:base" library( ) ash David Scott's ASH routines base The R Base Package boot Bootstrap R (S-Plus) Functions (Canty) class Functions for Classification cluster Functions for clustering (by Rousseeuw et al.)…… MASS Main Package of Venables and Ripley's MASS……

library(MASS);search() [1] ".GlobalEnv" "package:MASS" "package:methods" [4] "package:stats" "package:graphics" "package:grDevices" [7] "package:utils" "package:datasets" "Autoloads" [10] "package:base" data(iris); iris Sepal.Length Sepal.Width Petal.Length Petal.Width Species setosa setosa setosa setosa… versicolor versicolor versicolor versicolor plot(iris$Petal.Length,iris$Petal.Width)

data(Animals); Animals body brain Mountain beaver Cow Grey wolf Goat Guinea pig Dipliodocus Asian elephant Donkey Horse …….

plot( Animals[,"brain"],Animals[,"body"]) plot(Animals$brain,Animals$body) plot(Animals[,1],Animals[,2]) attach(Animals) plot(body,brain) detach(Animals)

Plusieurs dessins sur la même page par(mfrow=c(2,2)) data(Animals) attach(Animals) plot(body,brain) plot(sqrt(body),sqrt(brain)) plot(body^0.1,brain^0.1) plot(log(body), log(brain)) detach(Animals) par(mfrow=c(1,1))

Les fonctions plot(), points(), lines(), ablines(),pairs()… x = rnorm(50) plot(x, ann = FALSE, type = "n" ) abline(h = 0,col="gray") lines(x, col = "green4", lty = "dotted") points(x, bg = "limegreen", pch = 21) title(main = "Utilisation simple de la couleur dans un dessin",col.main = "blue", cex.main = 1.2, font.main = 4)

par(bg = "white") n = 100 x = c(0, cumsum(rnorm(n))) y = c(0, cumsum(rnorm(n))) xx = c(0:n, n:0) yy = c(x, rev(y)) plot(xx, yy, type = "n", xlab = "Time", ylab = "Distance") polygon(xx, yy, col = "gray") title("Distance entre deux mouvements Browniens")

x = c(0, 0.4, 0.86, 0.85, 0.69, 0.48, 0.54, 1.09, 1.11, 1.73, 2.05, 2.02) par(bg = "lightgray"); plot(x, type = "n", axes = FALSE, ann = FALSE); lines(x, col = "blue"); points(x, pch = 21, bg = "lightcyan", cex = 1.25); axis(2, col.axis = "blue", las = 1); axis(1, at = 1:12, lab = month.abb, col.axis = "blue"); box(); title(main = "The Level of Interest in R", font.main = 4, col.main = "red") title(xlab = "1996", col.lab = "red")

x=c(…) par(bg = "lightgray"); plot(x, type = "n", axes = FALSE, ann = FALSE);

lines(x, col = "blue"); points(x, pch = 21, bg = "lightcyan", cex = 1.25);

axis(2, col.axis = "blue", las = 1); axis(1, at = 1:12, lab = month.abb, col.axis = "blue");

box(); title(main = "The Level of Interest in R", font.main = 4, col.main = "red") title(xlab = "1996", col.lab = "red")

La fonction pairs pairs(iris[1:4], main = « donnees sur les Iris d’Edgar Anderson", font.main = 4, pch = 19)

La fonction pairs() pairs(iris[1:4], main = « Données sur les Iris d’Edgar Anderson", pch = 21, bg = c("red","green3«,"blue") [unclass(iris$Species)])

Résolution de l’ex 1 p40 t=c(2:12);N=c(55,90,135,245,403,66 5,1100,1810,3000,4450,7350) T=data.frame(t,N,y=log(N));T; > T t N y t N y …..

Calcul de moyenne et écart-type apply(T,2,mean); t N y apply(T,2,sd); t N y

plot(T$t,T$N)

plot(T$t,T$y)

droite de regression ll=lm(y~t,data=T);ll; Call: lm(formula = y ~ t, data = T) Coefficients: (Intercept) t

abline(ll);

summary(ll) Call: lm(formula = y ~ t, data = T) Residuals: Min 1Q Median 3Q Max Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) e-14 *** t e-15 *** --- Signif. codes: 0 `***' `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1

summary(ll) suite Residual standard error: on 9 degrees of freedom Multiple R-Squared: , Adjusted R- squared: F-statistic: 1.329e+04 on 1 and 9 DF, p-value: 1.413e-15