Learn R Programming

genpathmox (version 0.6)

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 also 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, 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.

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:

MOX

Data frame with the results of the segmentation tree

root

element of contaning in the root node

terminal

element of contaning in the terminal nodes

nodes

element of contaning in all nodes terminal and intermediate

candidates

List of data frames containing the candidate splits of each node partition

Fg.r

Data frame containing the results of the F-global test for each node partition

Fc.r

A list of Data frames containing the results of the F-coefficients test for each node partition

model

Information 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

Aluja, T. Lamberti, G. Sanchez, G. (2013). Modeling with heterogeneity. Meetings of Italian Statistical Society, Advances in Latent Variables - Methods, Models and Applications. Brescia.

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
# NOT RUN {
 
# }
# NOT RUN {
##example of LM in alumni satisfaction
 
data(fibtelereg)

#identify the segmentation variables  
segvar = fibtelereg[,2:11]

#select the variables
data.fib = fibtelereg[,12:18]          

#re-ordering those segmentation variables with ordinal scale
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)

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

# }
# NOT RUN {
 
data(fibtelereg)

#identify the segmentation variables  
segvar= fibtelereg[,3:4]

#select the variables
data.fib=fibtelereg[,12:18]          

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

# }

Run the code above in your browser using DataLab