A routine that takes starting values and model specifications as in ncd_gen() and returns regression results.

reg_cd(startp, ..., rvcov = FALSE)

Arguments

startp

vector of starting values

...

arguments to be passed to ncd_gen() except argument rval. Argument names must match exactly.

rvcov

Logical. Should the variance-covariance matrix be returned?

Value

A list

  • coefs vector of coefficients

  • stde vector of standard errors

  • tstat vector of t-statistics

  • pval vector of p-values

  • varcov variance-covariance matrix if rvcov is set to TRUE

  • Wstat a Wald chi-square statistic

  • pvwald Prob>Wstat

See also

ncd_gen

Examples

pars=c(1.0,0.5,0.8); N = 5; Tp = 6; fnp<- function(x,y,k){-(0.5*y^4+(x-y)^4)^.25} #dummy k datpois=gdat_cd(pars=pars,N=N,Tp=Tp,seed=2,fun=fnp,eta = 200,modclass="poiscd") #poisson data k=1; lp=k*(k+1)/2; startp = rep(0.2,(lp+2)) # fun() is known zg1=RpacSPD::reg_cd(startp=startp,Y=datpois$Y,X=datpois$X,Xm=NULL,Xi=datpois$X,Tid=datpois$tpID, Pid=datpois$psID,fun=fnp,k=k,nt=lp,utid=c(2:Tp),modclass="poiscd") #return function value BIC(zg1) #compute BIC of fitted model
#> [1] -234.5832
k=4; lp=k*(k+1)/2; startp = rep(0.2,(lp+2)) # fun() is polynomial approximated zg4=RpacSPD::reg_cd(startp=startp,Y=datpois$Y,X=datpois$X,Xm=NULL,Xi=datpois$X,Tid=datpois$tpID, Pid=datpois$psID,fun=polyexp,k=k,nt=lp,utid=c(2:Tp),modclass="poiscd") #return function value BIC(zg4) #compute BIC of fitted model
#> [1] -205.1826