lmc: Linear Model Fitting with Constraints

Description Usage Arguments Details Value Examples

View source: R/lmc.R

Description

Linear model fitting with positivity and sum-to-one constraints on the model's coefficients.

Usage

1
2
3
4
5
lmc(y, X)
        
        
        
        

Arguments

y

Response vector.

X

Design matrix.

Details

Linear model fitting with positivity and sum-to-one constraints on the model's coefficients.

Value

The function returns an object of class lmc.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run:  

set.seed(1)

n    <- 1000
beta <- c(0.07, 0.08, 0.21, 0.12, 0.15, 0.17, 0.2)
l    <- length(beta)
X    <- matrix(runif(n*l), n, l)

y    <- X%*%beta + rnorm(n)

out <- lmc(y, X)
conv.check(out)


coef(out)                    # estimated   coefficients
round(out$c.coefficients, 3) # constrained coefficients



## End(Not run)

egeminiani/GJRM documentation built on Sept. 1, 2020, 6:41 p.m.