Example: dental hygienist

rpart: Recursive Partitioning and Regression Trees

Package rpart October 21, Partitioning for classification, Regression and survival Trees . An implementation of most of thefunctionality of the 1984 book by Breiman, Friedman, Olshen and Partitioning and Regression TreesDependsR (>= ), graphics, stats, grDevicesSuggestssurvivalLicenseGPL-2 | GPL-3 LazyDatayesByteCompileyesNeedsCompilatio nyesAuthorTerry Therneau [aut],Beth Atkinson [aut, cre],Brian Ripley [trl] (producer of the initial R port, maintainer1999-2017)MaintainerBeth 18:42:41 UTCR topics ..2car90 .. 10plotcp.

Package ‘rpart’ January 24, 2022 Priority recommended Version 4.1.16 Date 2022-01-24 Description Recursive partitioning for classification, regression and survival trees.

Tags:

  Rpart

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of rpart: Recursive Partitioning and Regression Trees

1 Package rpart October 21, Partitioning for classification, Regression and survival Trees . An implementation of most of thefunctionality of the 1984 book by Breiman, Friedman, Olshen and Partitioning and Regression TreesDependsR (>= ), graphics, stats, grDevicesSuggestssurvivalLicenseGPL-2 | GPL-3 LazyDatayesByteCompileyesNeedsCompilatio nyesAuthorTerry Therneau [aut],Beth Atkinson [aut, cre],Brian Ripley [trl] (producer of the initial R port, maintainer1999-2017)MaintainerBeth 18:42:41 UTCR topics ..2car90 .. 10plotcp.

2 16printcp .. 19rpart .. 27stagec .. Data from Consumer Reports frame has 60 rows and 8 columns, giving data on makes of cars takenfrom the April, 1990 issue ofConsumer Reports. This is part of a larger dataset, some columns ofwhich are given data frame contains the following columns:Pricea numeric vector giving the list price in US dollars of a standard modelCountryof origin, a factor with levels France , Germany , Japan , Japan/USA , Korea , Mexico , Sweden and USA Reliabilitya numeric vector consumption miles per US gallon, as factor with levelsCompact Large Medium Small Sporty VanWeightkerb weight in engine capacity (displacement) in net horsepower of the Reports, April, 1990, pp.

3 235 288 quoted inJohn M. Chambers and Trevor J. Hastie eds. (1992)Statistical Models in S, Wadsworth andBrooks/Cole, Pacific Grove, CA, pp. 46 Alsocar90, <- rpart (Mileage ~ Weight, )summary( )car90 Automobile Data from Consumer Reports 1990 DescriptionData on 111 cars, taken from pages 235 255, 281 285 and 287 288 of the April (car90)FormatThe data frame contains the following columnsCountrya factor giving the country in which the car was manufacturedDispengine displacement in cubic inchesDisp2engine displacement in revolutions per mile, or engine speed at 60 between the car s head-liner and the head of a 5 ft.

4 9 in. front seat passenger,in inches, as measured by front leg room, in inches, as measured by shoulder room, in inches, as measured by overall gear ratio, high gear, for manual transmissionGear2the overall gear ratio, high gear, for automatic transmissionHPnet red line the maximum safe engine speed in rpmHeightheight of car, in inches, as supplied by manufacturerLengthoverall length, in inches, as supplied by manufacturerLuggageluggage spaceMileagea numeric vector of gas mileage in miles/gallon as tested by CU; contains name, if the car was sold under two labelsPricelist price with standard equipment, in between the car s head-liner and the head of a 5 ft 9 in.

5 Rear seat passenger, ininches, as measured by fore-and-aft seating room, in inches, as measured by CURearShldrear shoulder room, in inches, as measured by CUReliabilityan ordered factor with levels Much worse < worse < average < better < Muchbetter : giving the rim of turns of the steering wheel required for a turn of 30 foot radius, of turns of the steering wheel required for a turn of 30 foot radius, power steeringSteeringsteering type offered: manual, power, or bothTankfuel refill capacity in gallonsTiresfactor giving tire sizeTrans1manual transmission, a factor with levels , , and Trans2automatic transmission, a factor with levels , , , and.

6 Nocar is missing both the manual and automatic transmission variables, but several had both asoptionsTurningthe radius of the turning circle in feetTypea factor giving the general type of car. The levels are: Small , Sporty , Compact , Medium , Large , Van Weightan order statistic giving the relative weights of the cars; 1 is the lightest and 111 is of wheelbase, in inches, as supplied by manufacturerWidthwidth of car, in inches, as supplied by manufacturerSourceThis is derived (with permission) from the data S-PLUS, but with some further cleanup of variable names and , extracts from other versions of the (car90)plot(car90$Price/1000, car90$Weight,xlab = "Price (thousands)", ylab = "Weight (lbs)")mlowess <- function(x, y.)

7 {keep <- !( (x) | (y))lowess(x[keep], y[keep], ..)}with(car90, lines(mlowess(Price/1000, Weight, f = ))) Data from Consumer Reports frame has 117 rows and 5 columns, giving data on makes of cars taken fromthe April, 1990 issue ofConsumer data frame contains the following columns:Pricea numeric vector giving the list price in US dollars of a standard modelCountryof origin, a factor with levels Brazil , England , France , Germany , Japan , Japan/USA , Korea , Mexico , Sweden and USA Reliabilityan ordered factor with levels Much worse < worse < average < better < Much better Mileagefuel consumption miles per US gallon, as factor with levelsCompact Large Medium Small Sporty VanSourceConsumer Reports, April, 1990, pp.

8 235 288 quoted inJohn M. Chambers and Trevor J. Hastie eds. (1992)Statistical Models in S, Wadsworth andBrooks/Cole, Pacific Grove, CA, pp. 46 ,car906kyphosisExamplesfit <- rpart (Price ~ Mileage + Type + Country, )par(xpd = TRUE)plot(fit, compress = TRUE)text(fit, = TRUE)kyphosisData on Children who have had Corrective Spinal SurgeryDescriptionThekyphosisdata frame has 81 rows and 4 columns. representing data on children who have hadcorrective spinal surgeryUsagekyphosisFormatThis data frame contains the following columns:Kyphosisa factor with levelsabsent presentindicating if a kyphosis (a type of deformation) waspresent after the monthsNumberthe number of vertebrae involvedStartthe number of the first (topmost) vertebra operated M.

9 Chambers and Trevor J. Hastie eds. (1992)Statistical Models in S, Wadsworth andBrooks/Cole, Pacific Grove, <- rpart (Kyphosis ~ Age + Number + Start, data = kyphosis)fit2 <- rpart (Kyphosis ~ Age + Number + Start, data = kyphosis,parms = list(prior = c( , ), split = "information"))fit3 <- rpart (Kyphosis ~ Age + Number + Start, data=kyphosis,control = (cp = ))par(mfrow = c(1,2), xpd = TRUE)plot(fit)text(fit, = TRUE)plot(fit2)text(fit2, = TRUE) Split Labels For an rpart ObjectDescriptionThis function provides labels for the branches of ## S3 method for class' rpart 'labels(object, digits = 4, minlength = 1L, pretty, collapse = TRUE.)

10 Argumentsobjectfitted model object of class" rpart ". This is assumed to be the result of somefunction that produces an object with the same named components as that re-turned by number of digits to be used for numeric values. All of therpartfunctionsthat call labels explicitly set this value, withoptions("digits")as the minimum length for abbreviation of character or factor variables. If0noabbreviation is done; if1single English letters are used, first lower case thanupper case (with a maximum of 52 levels). If the value is greater than , theabbreviatefunction is used, passed argument included for compatibility with thetreepackage.


Related search queries