prim S3 methods {prim} | R Documentation |
S3 methods for PRIM for multivariate data
Description
S3 methods PRIM for multivariate data.
Usage
## S3 method for class 'prim'
predict(object, newdata, y.fun.flag=FALSE, ...)
## S3 method for class 'prim'
summary(object, ..., print.box=FALSE)
Arguments
object |
object of class |
newdata |
data matrix |
y.fun.flag |
flag to return y value of PRIM box rather than box label. Default is FALSE. |
print.box |
flag to print out limits of all PRIM boxes. Default is FALSE. |
... |
other parameters |
Details
–The predict
method returns the value of PRIM box number in
which newdata
are located.
–The summary
method displays a table with three columns:
box-fun
is the y value, box-mass
is the mass of the
box, threshold.type
is the threshold direction indicator: 1
= ">= threshold", -1 = "<=threshold". Each box corresponds to a
row. The second last row marked with an asterisk is the box
which collates the remaining data points not belonging to a specific
PRIM box. The final row is an overall summary, i.e. box-fun
is the
overall mean of y and box-mass
is 1.
Examples
data(quasiflow)
qf <- quasiflow[1:1000,1:2]
qf.label <- quasiflow[1:1000,3]*quasiflow[1:1000,4]
qf.prim <- prim.box(x=qf, y=qf.label, threshold=c(0.3, -0.1), threshold.type=0,
verbose=TRUE)
## verbose=TRUE prints out extra informaton about peeling and pasting
summary(qf.prim)
predict(qf.prim, newdata=c(0.6,0.2))
## using median insted of mean for the response y
qf.prim2 <- prim.box(x=qf, y=qf.label, threshold=c(0.5, -0.2),
threshold.type=0, y.fun=median)
summary(qf.prim2)
predict(qf.prim2, newdata=c(0.6,0.2))