Description Usage Arguments Details Value References See Also Examples
View source: R/stepAICmle.fun.r
Performs stepwise model selection by AIC for Poisson proces models estimated by maximum likelihood.
It calls the auxiliary function checkdim
(not intended
for the users).
1 2 | stepAICmle.fun(ImlePP, covariatesAdd = NULL, startAdd = NULL,
direction = "forward", ...)
|
ImlePP |
A |
covariatesAdd |
Matrix of the potential covariates to be added to the model; each column must
contain a covariate. In the 'forward' and the 'both' directions, it is compulsory to assign a matrix to this argument.
It is advisable to give names to the columns of
this matrix (using |
startAdd |
Optional. The vector of initial values for the estimation of the coefficients of each potential covariate. If it is NULL, initial values equal to 0 are used. |
direction |
Label indicating the direction of the algortihm: 'forward' (the default), 'backward' or 'both'. |
... |
Further arguments to pass to |
Three directions, forward, backward and both, are implemented. The initial model is given by
ImlePP
and the algorithm stops
when none of the covariates eliminated from the model
or added from the potential covariates set (argument covariatesAdd
) improves the model
fitted in the previous step, according to the AIC. For the 'both' and 'forward' directions, the argument covariatesADD
is compulsary, and the default NULL leads to an error.
In the 'both' direction, 'forward' and 'backward' steps are carried out alternatively. In the 'forward' direction, the initial model usually contains only the intercept.
A mlePP
-class object, the fit of the final PP model selectecd by the algorithm.
Casella, G. and Berger, R.L., (2002). Statistical inference. Brooks/Cole.
Cebrian, A.C., Abaurrea, J. and Asin, J. (2015). NHPoisson: An R Package for Fitting and Validating Nonhomogeneous Poisson Processes. Journal of Statistical Software, 64(6), 1-24.
Venables, W. N. and Ripley, B. D. (2002). Modern Applied Statistics with S. Fourth edition. Springer.
addAIC.fun
, dropAIC.fun
, testlik.fun
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | data(BarTxTn)
BarEv<-POTevents.fun(T=BarTxTn$Tx,thres=318,
date=cbind(BarTxTn$ano,BarTxTn$mes,BarTxTn$dia))
#The initial model contains only the inercept
mod1Bind<-fitPP.fun(covariates=NULL, posE=BarEv$Px, inddat=BarEv$inddat,
tit='BAR Intercept ', start=list(b0=1))
#the potential covariates
covB<-cbind(cos(2*pi*BarTxTn$dia/365), sin(2*pi*BarTxTn$dia/365),
BarTxTn$TTx,BarTxTn$Txm31,BarTxTn$Txm31**2)
dimnames(covB)<-list(NULL,c('cos','sin','TTx','Txm31', 'Txm31**2'))
bb<-stepAICmle.fun(ImlePP=mod1Bind, covariates=covB, startAdd=c(1,-1,0,0,0),
direction='both')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.