CCRseqk runs regressions with potentially more covariates than observations with k clusters. See c_chmod() for the list of models supported.

CCRseqk(Y, X, k, nC = 1, kap = 0.1, modclass = "lm", tol = 1e-06,
  reltol = TRUE, rndcov = NULL, report = NULL, ...)

Arguments

Y

vector of dependent variable Y

X

design matrix (without intercept)

k

number of clusters

nC

first nC-1 columns in X not to cluster

kap

maximum number of parameters to estimate in each active sequential step, as a fraction of the less of total number of observations n or number of covariates p. i.e. \(min(n,p)\)

modclass

a string denoting the desired the class of model. See c_chmod for details.

tol

level of tolerance for convergence; default tol=1e-6

reltol

a logical for relative tolerance instead of level. Defaults at TRUE

rndcov

seed for randomising assignment of covariates to partitions; default NULL

report

number of iterations after which to report progress; default NULL

...

additional arguments to be passed to the model

Value

a list of objects

  • mobj low dimensional model object of class lm, glm, or rq (depending on modclass)

  • clus cluster assignments of covariates

  • iter number of iterations

  • dev decrease in the function value at convergence

Examples

set.seed(14) #Generate data N = 1000; (bets = rep(-2:2,4)/2); p = length(bets); X = matrix(rnorm(N*p),N,p)
#> [1] -1.0 -0.5 0.0 0.5 1.0 -1.0 -0.5 0.0 0.5 1.0 -1.0 -0.5 0.0 0.5 1.0 #> [16] -1.0 -0.5 0.0 0.5 1.0
Y = cbind(1,X)%*%matrix(c(0.5,bets),ncol = 1); nC=1 zg=CCRseqk(Y,X,k=5,nC=nC,kap=0.1,modclass="lm",tol=1e-6,reltol=TRUE,rndcov=NULL,report=8) (del=zg$mobj$coefficients) # delta
#> (Intercept) X1 X2 X3 X4 #> 5.000000e-01 -1.000000e+00 -5.000000e-01 1.944761e-16 5.000000e-01 #> X5 #> 1.000000e+00
(bets = c(del[1:nC],(del[-c(1:nC)])[zg$clus])) #construct beta
#> (Intercept) X1 X2 X3 X4 #> 5.000000e-01 -1.000000e+00 -5.000000e-01 1.944761e-16 5.000000e-01 #> X5 X1 X2 X3 X4 #> 1.000000e+00 -1.000000e+00 -5.000000e-01 1.944761e-16 5.000000e-01 #> X5 X1 X2 X3 X4 #> 1.000000e+00 -1.000000e+00 -5.000000e-01 1.944761e-16 5.000000e-01 #> X5 X1 X2 X3 X4 #> 1.000000e+00 -1.000000e+00 -5.000000e-01 1.944761e-16 5.000000e-01 #> X5 #> 1.000000e+00