Estimate change point logistic model

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
chngptm (formula.1, formula.2, family, data,
type=c("step","hinge","segmented","stegmented"),
est.method=c("default","smoothapprox","grid"),
var.type=c("none","robust","model","smooth","robusttruth","bootstrap","all"),
aux.fit=NULL, test.inv.ci=TRUE, lb.quantile=.1, ub.quantile=.9, grid.size=500,
ci.bootstrap.size=500, alpha=0.05, save.boot=FALSE, m.out.of.n=FALSE,
b.=-30, tol=1e-4, maxit=1e2, chngpt.init=NULL,
weights=NULL, verbose=FALSE,
...)
## 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, ...)
``` |

`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 |

`data` |
data frame. |

`type` |
step: flat before and after change point; hinge: flat before and slope after change point; segmented: slope before and after change point |

`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.size` |
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 |

`b.` |
a parameter controlling approximation of step function by logistic function in optimization |

`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. |

`family` |
passed to glm |

`weights` |
passed to glm |

`verbose` |
Boolean. |

`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 |

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.

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 |

Fong, Y., Huang, Y., Gilbert, P. (2015) Estimation and hypothesis testing under four types of change point models using chngpt, submitted.

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ```
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
# has interaction
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")
## End(Not run)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.