Last data update: 2014.03.03

R: univariate model fitting
unifitR Documentation

univariate model fitting

Description

fit univariate log-linear model using Newton-Raphson algorithm.

Usage

unifit(formula, data = list(),
       family = c("gaussian", "binomial"),
       output = 0)

Arguments

formula

a symbolic description of the model to be fit.

data

an optional data frame containing the variables in the model. By default the variables are taken from the environment from which unifit is called.

family

a GLM family, currently support gaussian and binomial.

output

with values 0 or 1, indicating whether the fitting process is muted or not.

Details

The unifit utilize the class structure of the underlying C++ code and fitted the model with Newton-Raphson algorithm.

Value

An object of class mvbfit, for which some methods are available.

See Also

unilps, mvbfit

Examples

n <- 100
p <- 4
x <- matrix(rnorm(n * p, 0, 4), n, p)
eta <- x 
pr <- exp(eta) / (1+ exp(eta))
res <- rbinom(n, 1, pr)
fit <- unifit(res ~ x - 1, family = 'binomial')

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(MVB)
Loading required package: Rcpp
Loading required package: RcppArmadillo
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MVB/unifit.Rd_%03d_medium.png", width=480, height=480)
> ### Name: unifit
> ### Title: univariate model fitting
> ### Aliases: unifit
> 
> ### ** Examples
> 
> n <- 100
> p <- 4
> x <- matrix(rnorm(n * p, 0, 4), n, p)
> eta <- x 
> pr <- exp(eta) / (1+ exp(eta))
> res <- rbinom(n, 1, pr)
> fit <- unifit(res ~ x - 1, family = 'binomial')
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>