lrp: Longitudinal Recursive Partitioning

View source: R/lrp.R

lrpR Documentation

Longitudinal Recursive Partitioning

Description

Longitudinal Recursive Partitioning

Usage

lrp(
  method,
  nlme.model = NULL,
  randomFormula,
  fixedFormula = NULL,
  data,
  start,
  group,
  rPartFormula,
  weight = NULL,
  use_parallel = FALSE,
  R = NULL,
  min.dev = NULL,
  control = rpart.control()
)

Arguments

method

Whether to use lme() or nlme(). Use either method="lme" or method="nlme". This changes what additional arguments need to be passed.

nlme.model

Necessary to specify if method="nlme"

randomFormula

Random effects to include for nlme() or lme()

fixedFormula

Fixed effects to include for nlme() or lme()

data

Dataset

start

Starting values for nlme()

group

Grouping for nlme()

rPartFormula

Not sure yet

weight

Sample weights to be passed to rpart

use_parallel

Whether to parallelize the split models

R

Correlation matrix to use for nlme. this is correlation=

min.dev

The minimum decrease in deviance to choose a split. Note that this overrides the default cp criterion in rpart.control()

control

Control function to be passed to rpart()

Examples

library(longRPart2)


data(ex.data.3)
model.0 = nlme(y~b0i+b1i*time,
               data=ex.data.3,
               fixed=b0i+b1i~1,
               random=b0i+b1i~1,
               group=~id,
               start=c(10,5))


lcart.mod1 <- lrp(method="nlme",
                 nlme.model=y~b0i+b1i*time,
                 fixedFormula=b0i+b1i~1,
                 rPartFormula = ~ z,
                 group= ~ id,
                 randomFormula=b0i+b1i~1,
                 data=ex.data.3,
                 start=c(10,5))

data(lcart.mod1)
summary(lcart.mod1)
plot(lcart.mod1)
# for smooth_method, "loess" is recommend but "gam" faster
lrp2Plot(lcart.mod1,smooth_method="gam")


Rjacobucci/longRPart2 documentation built on Nov. 24, 2022, 2:32 a.m.