methods-coef: Extract Model Coefficients

Description Usage Arguments Value Author(s) Examples

Description

Extracts model coefficients from an object of class modelObjFit created by a call to modelObj::fit().

Usage

1
2
 ## S4 method for signature 'modelObjFit'
coef(object, ...) 

Arguments

object

an object of class modelObjFit.

...

passed through to coef() of the modelObj regression method.

Value

Coefficients extracted from the modelObjFit object 'object'. For standard model fitting classes the value returned is a named vector. If no coef() method is defined for the regression method specified in the governing modelObj, NULL is returned.

Author(s)

Shannon T. Holloway <sthollow@ncsu.edu>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
    #----------------------------------------------------#
    # Generate data
    #----------------------------------------------------#
    X <- matrix(rnorm(1000,0,1),
                ncol=4,
                dimnames=list(NULL,c("X1","X2","X3","X4")))

    Y <- X %*% c(0.1, 0.2, 0.3, 0.4) + rnorm(250)

    X <- data.frame(X)

    #----------------------------------------------------#
    # Create modeling object using a formula
    #----------------------------------------------------#
    mo <- buildModelObj(model = Y ~ X1 + X2 + X3 + X4,
                        solver.method = 'lm')

    #----------------------------------------------------#
    # Fit model
    #----------------------------------------------------#
    fit.obj <- fit(object=mo, data=X, response=Y)

    coef(fit.obj)

modelObj documentation built on May 2, 2019, 5:20 p.m.