fit: Obtain parameter estimates

fitR Documentation

Obtain parameter estimates

Description

Performs specified regression analysis.

Usage

fit(object, data, response, ...)

## S4 method for signature 'modelObj,data.frame'
fit(object, data, response, ...)

Arguments

object

An object of class modelObj as returned by the buildModelObj function.

data

An object of class data.frame containing the variables in the model.

response

An object of class vector containing the response variable.

...

ignored

Details

If defined by the modeling function, the following methods can be applied to the value object returned: coef, plot, predict, print, residuals, show, and summary.

Value

An object of class modelObjFit, which contains the object returned by the modeling function and the method to be used to obtain predictions.

Examples

   # 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)
   head(residuals(fit.obj))
   plot(fit.obj)
   head(predict(fit.obj,X))
   summary(fit.obj)


modelObj documentation built on June 7, 2022, 9:07 a.m.