Learn R Programming

genpathmox (version 0.2)

reg.pathmox: PATHMOX-REG: Segmentation Trees in linaer and LAD regression model

Description

The function reg.pathmox calculates a binary segmentation tree in the context of linear regression following the PATHMOX algorithm. This function generalizes the Pathmox algorithm introduced by Sanchez in 2009 to the context of linear and LAD regression.

Usage

reg.pathmox(formula, SVAR, signif, deep, method, size, tree = TRUE,
  data = NULL, ...)

Arguments

formula
An object of class "formula".
SVAR
A data frame of factors contaning the segmentation variables.
signif
A numeric value indicating the significance threshold of the F-statistic. Must be a decimal number between 0 and 1.
deep
An integer indicating the depth level of the tree. Must be an integer greater than 1.
method
A string indicating the criterion used to calculate the the test can be equal to "lm" or "lad" node.
size
A numeric value indicating the minimum size of elements inside a node.
tree
A logical value indicating if the tree should be displayed (TRUE by default).
data
an optional data frame.
...
Further arguments passed on to reg.pathmox.

Value

  • An object of class "xtree.reg". Basically a list with the following results:
  • MOXData frame with the results of the segmentation tree
  • rootelement of contaning in the root node
  • terminalelement of contaning in the terminal nodes
  • nodeselement of contaning in all nodes terminal and intermediate
  • candidatesList of data frames containing the candidate splits of each node partition
  • Fg.rData frame containing the results of the F-global test for each node partition
  • Fc.rA list of Data frames containing the results of the F-coefficients test for each node partition
  • modelInformation about the internal paramenters

Details

The argument formula is an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted.

The argument SVAR must be a data frame containing segmentation variables as factors. The number of rows in SVAR must be the same as the number of rows in the data

The argument signif represent the p-value level takes as reference to stop the tree partitions.

The argument deep represent the p-value level takes as reference to stop the tree partitions.

The argument method is a string contaning the criterion used to calculate the the test; if method="lm" the classic least square approach is used to perform the test; if method="lad" the lad (least absolute deviation) is used.

The argument size has defined as a decimal value (i.e. proportion of elements inside a node).

References

Lamberti, G. (2014) Modeling with Heterogeneity. PhD Dissertation.

Sanchez, G. (2009) PATHMOX Approach: Segmentation Trees in Partial Least Squares Path Modeling. PhD Dissertation.

Examples

Run this code
#example of LM in alumni satisfaction

data(fibtelereg)

segvar= fibtelereg[,2:11]

data.fib=fibtelereg[,12:18]

segvar$Age 		= factor(segvar$Age, ordered=T)
segvar$Salary 	= factor(segvar$Salary,
		levels=c("<18k","25k","35k","45k",">45k"), ordered=T)
segvar$Accgrade = factor(segvar$Accgrade,
		levels=c("accnote<7","7-8accnote","accnote>8"), ordered=T)
segvar$Grade 	= factor(segvar$Grade,
		levels=c("<6.5note","6.5-7note","7-7.5note",">7.5note"), ordered=T)

fib.reg.pathmox=reg.pathmox(Satisfact~.,data=data.fib,segvar,
		signif=0.05,deep=2,method="lm",size=0.15)

Run the code above in your browser using DataLab