chngptm: Estimate change point logistic model

Description Usage Arguments Details Value References Examples

View source: R/chngptm.R

Description

Estimate change point logistic model

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
chngptm (formula.1, formula.2, family, data, 
  type=c("step","hinge","segmented","segmented2","stegmented"),
  est.method=c("default","smoothapprox","grid"),
  var.type=c("none","robust","model","smooth","robusttruth","bootstrap","all"), 
  aux.fit=NULL, test.inv.ci=TRUE, boot.test.inv.ci=FALSE, 
  lb.quantile=.1, ub.quantile=.9, grid.search.max=5000, ci.bootstrap.size=500, 
  alpha=0.05, save.boot=FALSE, m.out.of.n=FALSE,
  b.transition=Inf,
  tol=1e-4, maxit=1e2, chngpt.init=NULL, search.bound=10,
  weights=NULL, verbose=FALSE, 
  useC=TRUE, fast=TRUE,
  ...) 



## S3 method for class 'chngptm'
 coef(object, ...)
## S3 method for class 'chngptm'
 vcov(object, ...)
## S3 method for class 'chngptm'
 print(x, ...)
## S3 method for class 'chngptm'
 summary(object, var.type=NULL, verbose=FALSE, ...)

Arguments

formula.1

The part of formula that is free of terms involving thresholded variables

formula.2

The part of formula that is only composed of thresholded variables

family

string. coxph or any valid argument that can be passed to glm. But variance estimate is only available for binomial and gaussian (only model-based for latter)

data

data frame.

type

types of threshold effects. segmented2 differs from segmented in parameterization.

b.transition

Numeric. Controls whether threshold model or smooth transition model. Default to Inf, which correponds to threshold model

est.method

string. Better leave it at NULL. grid: grid search; smoothapprox: smooth approximation

var.type

string. Different methods for estimating covariance matrix and constructing confidence intervals

aux.fit

a model fit object that is needed for model-robust estimation of covariance matrix

grid.search.max

integer.

test.inv.ci

Boolean, whether or not to find test-inversion confidence interval for threshold

ci.bootstrap.size

integer, number of bootstrap

alpha

double, norminal type I error rate

save.boot

Boolean, whether to save bootstrap samples

lb.quantile

lower bound of the search range for change point estimate

ub.quantile

upper bound of the search range for change point estimate

tol

Numeric. Stopping criterion on the coefficient estimate.

maxit

integer. Maximum number of iterations in the outer loop of optimization.

chngpt.init

numeric. Initial value for the change point.

weights

passed to glm

verbose

Boolean.

useC

Boolean.

fast

Whether to use the fast bootstrap confidence interval methods.

x

chngptm fit object.

object

chngptm fit object.

...

arguments passed to glm or coxph

m.out.of.n

whether to perform m out of n bootstrap

boot.test.inv.ci

whether to get test inversion CI under bootstrap

search.bound

bounds for search for sloping parameters

Details

Without lb.quantile and ub.quantile, finite sample performance of estimator drops considerably! When est.method is smoothapprox, Newton-Raphson is done with initial values chosen by change point hypothesis testing. The testing procedure may be less subjective to finite sample volatility.

Value

A an object of type chngptm with the following components

converged

Boolean

coefficients

vector. Estimated coefficients. The last element, named ".chngpt", is the estimated change point

test

htest. Max score test results

iter

integer. Number of iterations

References

Fong, Y., Huang, Y., Gilbert, P. (2017) chngpt: threshold regression model estimation and hypothesis testing, BMC Bioinformatics, in press.

Fong, Y., Di, C., Huang, Y., Gilbert, P. (2017) Model-robust inference for continuous threshold regression models, Biometrics, 73(2):452-462.

Pastor-Barriuso, R. and Guallar, E. and Coresh, J. (2003) Transition models for change-point estimation in logistic regression. Statistics in Medicine. 22:13141

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
dat=sim.chngpt("sigmoid4", type="step", n=200, seed=1, beta=1, alpha=-1, x.distr="norm", e.=4)

fit.1=chngptm(formula.1=y~z, formula.2=~x, family="binomial", dat, type="step", est.method="grid")
print(fit.1)
summary(fit.1)

## Not run: 
# not run because otherwise the examples take >5s and that is a problem for R CMD check

# a survival example
library(survival)
test1 <- data.frame(time=c(4,3,1,1,2,2,3), 
              status=c(1,1,1,0,1,1,0), 
              x=c(0,2,1,1,1,0,0), 
              sex=c(0,0,0,0,1,1,1)) 
fit=chngptm(formula.1=Surv(time, status)~1, formula.2=~x, data=test1, family="coxph", type="step")

# an interaction example
fit=chngptm(formula.1=mpg~cyl + disp + hp, formula.2=~hp*drat, mtcars, type="segmented", 
    family="gaussian", est.method="grid", var.type="bootstrap", ci.bootstrap.size=10)
summary(fit)



## End(Not run)

chngpt documentation built on Oct. 10, 2017, 1:09 a.m.

Related to chngptm in chngpt...