setwd('/users/daf/Current/courses/Probcourse/HigherDimensions/RCode'); library('lattice') fires<-read.csv('forestfiresnoheader.csv', header=FALSE) head(fires) # shows some info # For more information, read [Cortez and Morais, 2007]. #1. X - x-axis spatial coordinate within the Montesinho park map: 1 to 9 #2. Y - y-axis spatial coordinate within the Montesinho park map: 2 to 9 #3. month - month of the year: 'jan' to 'dec' #4. day - day of the week: 'mon' to 'sun' #5. FFMC - FFMC index from the FWI system: 18.7 to 96.20 #6. DMC - DMC index from the FWI system: 1.1 to 291.3 #7. DC - DC index from the FWI system: 7.9 to 860.6 #8. ISI - ISI index from the FWI system: 0.0 to 56.10 #9. temp - temperature in Celsius degrees: 2.2 to 33.30 #10. RH - relative humidity in %: 15.0 to 100 #11. wind - wind speed in km/h: 0.40 to 9.40 #12. rain - outside rain in mm/m2 : 0.0 to 6.4 #13. area - the burned area of the forest (in ha): 0.00 to 1090.84 #(this output variable is very skewed towards 0.0, thus it may make #sense to model with the logarithm transform). # X,Y,month,day,FFMC,DMC,DC,ISI,temp,RH,wind,rain,area # # the issue here is understanding what affects the area fires$logarea<-log(fires$V13+1e-7) hist(fires$logarea) # and you can see that the range is (about) between -5 and 7 # let's have several types of fire fires$types<-cut(fires$logarea, c(-Inf, -5, -3, -1, 1, 3, 5, Inf)) pchr<-c(3, 4, 0, 8, 2, 10, 1) ss<-expand.grid(type=1:7) parset<-with(ss, simpleTheme(pch=pchr[type])) typenames<-c('T1', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7') setEPS() postscript("firescatterplot1.eps") splom(fires[, c(5:8)], groups=fires$types, par.settings=parset, varnames=c('FFMC', 'DMC', 'DC', 'ISI'), key=list(text=list(typenames), points=list(pch=pchr), columns=3)) dev.off() setEPS() postscript("firescatterplot2.eps") splom(fires[, c(9:12)], groups=fires$types, par.settings=parset, varnames=c('temp', 'RH', 'wind', 'rain'), key=list(text=list(typenames), points=list(pch=pchr), columns=3)) dev.off() setEPS() postscript("firescloud.eps") cloud(V9~V10+V11, data=fires, pch=pchr, groups=types, par.settings=simpleTheme(pch=c(3, 4, 0, 8, 2, 10, 1)), auto.key=list(space='top', columns=3, between=1, text=typenames, between.columns=2)) dev.off() # looks hard