searchLinesAtGivenSlope {wrMisc} | R Documentation |
Search Points Forming Lines At Given Slope
Description
searchLinesAtGivenSlope
searchs among set of points (2-dim) those forming line(s) with user-defined slope ('coeff'),
ie search optimal (slope-) offset parameter(s) for (regression) line(s) with given slope ('coef').
Note: larger data-sets : segment residuals to 'coeff' & select most homogenous
Usage
searchLinesAtGivenSlope(
dat,
coeff = 1.5,
filtExtr = c(0, 1),
minMaxDistThr = NULL,
lmCompare = TRUE,
indexPoints = TRUE,
displHist = FALSE,
displScat = FALSE,
bestCluByDistRat = TRUE,
neighbDiLim = NULL,
silent = FALSE,
debug = FALSE,
callFrom = NULL
)
Arguments
dat |
matrix or data.frame, main input |
coeff |
(numeric) slope to consider |
filtExtr |
(integer) lower & upper quantile values, remove points with extreme deviation to offset=0, (if single value: everything up to or after will be used) |
minMaxDistThr |
(logical) optional minumum and maximum distance threshold |
lmCompare |
(logical) add'l fitting of linear regression to best results, return offset AND slope based on lm fit |
indexPoints |
(logical) return results as list with element 'index' specifying retained points |
displHist |
(logical) display histogram of residues |
displScat |
(logical) display (simple) scatter plot |
bestCluByDistRat |
(logical) initial selection of decent clusters based on ratio overallDist/averNeighbDist (or by CV & cor) |
neighbDiLim |
(numeric) additional threshold for (trimmed mean) neighbour-distance |
silent |
(logical) suppress messages |
debug |
(logical) for bug-tracking: more/enhanced messages |
callFrom |
(character) allow easier tracking of messages produced |
Details
Note: The package MASS is required when using as lmCompare=TRUE
.
For larger data the function will try using the package NbClust
(available from CRAN) if installed.
Value
This functions returns a matrix of line-characteristics (or if indexPoints is TRUE
then list (line-characteristics & index & lm-results)
See Also
Examples
set.seed(2016); ra1 <- runif(300)
dat1 <- cbind(x=round(c(1:100+ra1[1:100]/5,4*ra1[1:50]),1),
y=round(c(1:100+ra1[101:200]/5, 4*ra1[101:150]), 1))
(li1 <- searchLinesAtGivenSlope(dat1, coeff=1))