50% off: Unlimited data and AI learning.
State of Data and AI Literacy Report 2025

cluscov (version 1.1.0)

CCRls.coord: Linear regression via coordinate descent with covariate clustering

Description

This function is a wrapper for linrclus. It requires less input.

Usage

CCRls.coord(Y, X, k, nC = 1, ...)

Arguments

Y

vector of outcome variable

X

matrix of covariates. Should not include 1's for the intercept

k

number of clusters

nC

first nC-1 covariates in X not to cluster. Must be at least 1 for the intercept

...

additional parameters to be passed to lm

Value

mobj the low dimension lm regression object

clus cluster assignments of covariates (excluding the first nC covariates - including the intercept 1)

Examples

Run this code
# NOT RUN {
set.seed(14) #Generate data
N = 1000; (bets = rep(-2:2,4)); p = length(bets); X = matrix(rnorm(N*p),N,p)
Y = cbind(1,X)%*%matrix(c(0.5,bets),ncol = 1)
CCRls.coord(Y,X,k=5,nC=1)
# }

Run the code above in your browser using DataLab