Learn R Programming

ConsReg (version 0.1.0)

predict.ConsReg: Predict or fitted values of object ConsReg

Description

Predict or fitted values of object ConsReg

Usage

# S3 method for ConsReg
predict(object, newdata = NULL, components = F, ...)

Arguments

object

object of class ConsReg

newdata

New data to predict the objective function. If is NULL (default), then the fitted values will be returned

components

if its TRUE, it will return the predictions for each regression component

...

Additional argument passed to family. In particular, at this moment, if type = 'link', then for binomial family, it will return the link values

Value

predictions

Examples

Run this code
# NOT RUN {
data('fake_data')
data = fake_data
data$y = 1/(1+exp(-data$y))
data$y = ifelse(data$y > .5, 1, 0)
table(data$y)

fit5 = ConsReg(y~x1+x2+x3+x4, data = data,
               family = 'binomial', penalty = 10000,
               LOWER = -.5, UPPER = .2,
               optimizer = 'gosolnp')
pr = predict(fit5, newdata = data[1:3,], type = 'probability')
pr

# }

Run the code above in your browser using DataLab