版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、R Graphics,SCS Short Course March 14, 2008,Archeology,Archeological expedition Basic graphics easy and flexible Lattice (trellis) graphics powerful but less flexible Rgl nice 3d but challenging Tons of new stuff: e.g. install.packages(“heplots”) library(heplots) library(help=heplots) Special purpose
2、: library(car): avp In development: Plot3d.R,Goals for graphics,Two purposes for graphics: Exploratory need something quick that can produce graphs as fast as your mind can grasp them Presentation need flexibility to meet publication requirements,Why Lattice=Trellis graphics,Lattice (trellis) graphi
3、cs: developed at Bell Labs in early 80s Marginality vs Conditional association Motivation was problem of seeing relevant structures in higher dimensional data, the nub of the problem captured by Simpsons Paradox: two dimensional views of data show marginal association But conditional association can
4、 be entirely different Interaction: conditional association can be different for different values of moderator variables,Smoking and Life Expectancy,Source of demographic data (from the CIA): Two variables: - Life Expectancy - Cigarette Consumption Per Capita dl = read.csv(http:/www.math.yorku.ca/ge
5、orges/Data/CigLE.csv) head(dl),Data, head(dl) X Country Continent LE CigCon 1 1 Afghanistan Asia 35.5 98 2 2 Albania Europe 61.4 NA 3 3 Algeria Africa 60.6 1021 4 4 Andorra Europe 72.2 NA 5 5 Angola Africa 33.4 571 6 6 Antigua and Barbuda South America 61.9 NA tail(dl) X Country Continent LE CigCon
6、184 184 Vietnam Asia 61.3 NA 185 185 Yemen Asia 49.3 NA 186 186 Zambia Africa 34.9 408 187 187 Ethiopia Africa NA 87 188 188 Venezuela South America NA 1079 189 189 Zimbabwe Africa NA 399,Regression, table( LE = !is.na( dl$LE) , CigCon = !is.na(dl$CigCon) CigCon LE FALSE TRUE FALSE 0 3 TRUE 83 103 f
7、it = lm( LE CigCon , dl , na.action = na.omit) summary(fit) Call: lm(formula = LE CigCon, data = dl, na.action = na.omit) Residuals: Min 1Q Median 3Q Max -19.4576 -5.8225 0.8188 5.3636 17.8291 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 4.799e+01 1.371e+00 34.995 2e-16 * CigCon 8.5
8、28e-03 9.007e-04 9.468 1.33e-15 * - Signif. codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 1 Residual standard error: 8.158 on 101 degrees of freedom (86 observations deleted due to missingness) Multiple R-Squared: 0.4702, Adjusted R-squared: 0.465 F-statistic: 89.64 on 1 and 101 DF, p-value: 1.333e-15,Interp
9、reting coefficient,Regression coefficient for CigCon is 0.008529 An increase in 1 cigarette per year increases Life Expectancy by 0.008529 years An increase in 1 cigarette per day increases Life Expectancy by 365 x 0.008529 = 3.11 years,All it takes is 3 cigarettes a day to add 10 years to your life
10、.,Why graphics!,Always look at your data The plot function: The Joys of Object-Oriented Programming: plot is a generic function so it does different things to different kinds of objects What does it do to a regression object? plot ( fit ),Basic regression diagnostics,So plot a fitted regression to g
11、et some diagnostic plots But diagnostics not enough to inspire understanding What happens if we plot a data frame? plot( dl ),Basic graphics functions in R,Axis Generic function to add an Axis to a Plot abline Add Straight Lines to a Plot arrows Add Arrows to a Plot assocplot Association Plots axTic
12、ks Compute Axis Tickmark Locations axis Add an Axis to a Plot axis.POSIXct Date and Date-time Plotting Functions barplot Bar Plots box Draw a Box around a Plot boxplot Box Plots bxp Draw Box Plots from Summaries cdplot Conditional Density Plots contour Display Contours coplot Conditioning Plots curv
13、e Draw Function Plots dotchart Cleveland Dot Plots filled.contour Level (Contour) Plots fourfoldplot Fourfold Plots frame Create / Start a New Plot Frame graphics-package The R Graphics Package grid Add Grid to a Plot hist Histograms hist.POSIXt Histogram of a Date or Date-Time Object,Basic graphics
14、 functions in R,identify Identify Points in a Scatter Plot image Display a Color Image layout Specifying Complex Plot Arrangements legend Add Legends to Plots lines Add Connected Line Segments to a Plot locator Graphical Input matplot Plot Columns of Matrices mosaicplot Mosaic Plots mtext Write Text
15、 into the Margins of a Plot pairs Scatterplot Matrices panel.smooth Simple Panel Plot par Set or Query Graphical Parameters persp Perspective Plots pie Pie Charts,Basic graphics functions in R,Generic function plot and its methods: plot Generic X-Y Plotting plot.data.frame Plot Method for Data Frame
16、s plot.default The Default Scatterplot Function plot.design Plot Univariate Effects of a Design or Model plot.factor Plotting Factor Variables plot.formula Formula Notation for Scatterplots plot.histogram Plot Histograms plot.table Plot Methods for table Objects plot.window Set up World Coordinates
17、for Graphics Window plot.xy Basic Internal Plot Function,Basic graphics functions in R,points Add Points to a Plot polygon Polygon Drawing rect Draw One or More Rectangles rug Add a Rug to a Plot screen Creating and Controlling Multiple Screens on a Single Device segments Add Line Segments to a Plot
18、 spineplot Spine Plots and Spinograms stars Star (Spider/Radar) Plots and Segment Diagrams stem Stem-and-Leaf Plots stripchart 1-D Scatter Plots strwidth Plotting Dimensions of Character Strings and Math Expressions sunflowerplot Produce a Sunflower Scatter Plot symbols Draw Symbols (Circles, Squares, Stars, Thermometers
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2026年中國歷史文化知識(shí)競賽考試題庫附答案【模擬題】
- 2026年二級(jí)注冊(cè)建筑師之法律法規(guī)經(jīng)濟(jì)與施工考試題庫500道及答案【基礎(chǔ)+提升】
- 2026年房地產(chǎn)經(jīng)紀(jì)協(xié)理考試題庫及完整答案【奪冠】
- 2026年國家電網(wǎng)招聘之金融類考試題庫300道(b卷)
- 2025年期貨從業(yè)資格考試題庫附完整答案【網(wǎng)校專用】
- 2026年咨詢工程師之宏觀經(jīng)濟(jì)政策與發(fā)展規(guī)劃考試題庫500道及完整答案(必刷)
- 2026年輔警招聘考試試題庫200道【完整版】
- 2026年國家電網(wǎng)招聘之人力資源類考試題庫300道(綜合題)
- 2026年教師資格之中學(xué)綜合素質(zhì)考試題庫500道附參考答案(a卷)
- 2026年投資項(xiàng)目管理師之宏觀經(jīng)濟(jì)政策考試題庫300道有答案
- 2026年哈爾濱職業(yè)技術(shù)學(xué)院單招職業(yè)適應(yīng)性考試題庫參考答案詳解
- 2025云南昆明巫家壩建設(shè)發(fā)展有限責(zé)任公司及下屬公司第四季度社會(huì)招聘31人歷年真題匯編帶答案解析
- 66kV及以下架空電力線路設(shè)計(jì)標(biāo)準(zhǔn)
- 生鮮聯(lián)營合同范本
- 2025重慶川儀自動(dòng)化股份有限公司招聘56人筆試參考題庫附帶答案詳解(3卷合一版)
- 2025年浙江乍浦經(jīng)濟(jì)開發(fā)區(qū)(嘉興港區(qū))區(qū)屬國有公司公開招聘28人筆試考試備考試題及答案解析
- 論文發(fā)表合同協(xié)議
- 《SJT 11319-2005錫焊料動(dòng)態(tài)條件氧化渣量定量試驗(yàn)方法》(2025年)實(shí)施指南
- 2025屆高考寫作:思辨性作文寫作指導(dǎo)
- 2024年安徽管子文化旅游集團(tuán)有限公司招聘筆試沖刺題(帶答案解析)
- 生物化學(xué)實(shí)驗(yàn)智慧樹知到期末考試答案章節(jié)答案2024年浙江大學(xué)
評(píng)論
0/150
提交評(píng)論