clm: Constrained least squares

View source: R/clm.R

clmR Documentation

Constrained least squares

Description

Compute the least squares estimator using linear constrains on the coefficients.

Usage

clm(x, R, q = NULL)

## S3 method for class 'clm'
vcov(object, ...)

## S3 method for class 'clm'
summary(object, ...)

Arguments

x

a linear model fitted by lm,

R

a matrix of constrains (one line for each constrain, one column for each coefficient),

q

an optional vector of rhs values (by default a vector of 0)

object

a clm object for the summary and the vcov methods

...

further arguments

Value

an object of class clm which inherits from class lm

Examples

# Cobb-Douglas production function for the apple data set
# First compute the total production
apples <- apples %>% mutate(prod = apples + otherprod)
# unconstrained linear model
cd <- lm(log(prod) ~ log(capital) + log(labor) +
         log(materials), apples)
# constrained linear model imposing constant
# return to scales
crs <- clm(cd, R = matrix(c(0, 1, 1, 1), nrow = 1),
               q = 1)

micsr documentation built on May 29, 2024, 7:32 a.m.