alias.lmvar_no_fit: Aliased coefficients in an 'lmvar' object

Description Usage Arguments Details Value Examples

Description

Returns the columns present in the user-specified model-matrices X_μ and X_σ that were removed by lmvar to make the matrices full-rank.

Usage

1
2
## S3 method for class 'lmvar_no_fit'
alias(object, mu = TRUE, sigma = TRUE, ...)

Arguments

object

Object of class 'lmvar_no_fit' (hence it can also be of class 'lmvar')

mu

Boolean, specifies whether the aliased columns from the model matrix X_μ must be returned

sigma

Boolean, specifies whether the aliased columns from the model matrix X_σ must be returned

...

Additional arguments, not used in the current implementation

Details

If mu = TRUE and sigma = TRUE, the function returns the aliased columns of both X_μ and X_σ. The string "_s" is appended to the aliased column names from X_σ if at least one of those names also appears in X_μ

If mu = TRUE and sigma = FALSE, the function returns the aliased columns of X_μ.

If mu = FALSE and sigma = TRUE, the function returns the aliased columns of X_σ.

Value

A character vector containing the names of the aliased columns

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Create matrix columns
my_intercept = rep(1, 20)
v1 = c(rep(1, 10), rep(0, 10))
v2 = c(rep(0, 10), rep(1, 10))

# Create model matrices
X = cbind(my_intercept, v1, v2)
X_s = X

# Rename the last column of the model matrix 'X_s' to make this example more clear.
colnames(X_s)[3] = "v3"

# Create response vector
y = rnorm(20)

# Perform fit
fit = lmvar(y, X, X_s)

# The column 'my_intercept' is identical to '(Intercept)' added by 'lmvar'
# to the model matrix 'X'. Column 'v2' is equal to '(Intercept)' minus 'v1'.
# The same holds for the model matrix 'X_s'.
alias(fit)

# The aliased columns are left out if you extract the coefficients from a summary
coef(summary(fit))

# Only return the aliased colums in the model matrix for the expectation values
alias(fit, sigma = FALSE)

# Only return the aliased colums in the model matrix for the standard deviations
alias(fit, mu = FALSE)

# It also works on an object of class 'lmvar_no_fit'
no_fit = lmvar_no_fit(y, X, X_s)
alias(no_fit, mu = FALSE)

Example output

[1] "my_intercept"   "v2"             "my_intercept_s" "v3_s"          
                 Estimate Std. Error     z value  Pr(>|z|)
(Intercept)    0.04298943  0.2337530  0.18390961 0.8540844
v1             0.03317664  0.3499042  0.09481635 0.9244607
(Intercept_s) -0.30219766  0.2236068 -1.35146901 0.1765452
v1_s           0.10783808  0.3162278  0.34101396 0.7330931
[1] "my_intercept" "v2"          
[1] "my_intercept" "v3"          
[1] "my_intercept" "v3"          

lmvar documentation built on May 16, 2019, 5:06 p.m.