Extended Model Formulas

Infrastructure for extended formulas with multiple parts on the right-hand side and/or multiple responses on the left-hand side (see ).


Formula logo

Extended Formulas in R

Overview

Infrastructure for extended formulas in R with multiple parts on the right-hand side and/or multiple responses on the left-hand side.

Get started

Extended Formula with two right-hand sides for mtcars data:

library("Formula")
f <- Formula(log(mpg) ~ disp | factor(vs))
mf <- model.frame(f, data = head(mtcars, 3))

Extract response and both regressor matrices from model frame:

model.response(mf)
##     Mazda RX4 Mazda RX4 Wag    Datsun 710 
##      3.044522      3.044522      3.126761
model.matrix(f, data = mf, rhs = 1)
##               (Intercept) disp
## Mazda RX4               1  160
## Mazda RX4 Wag           1  160
## Datsun 710              1  108
## attr(,"assign")
## [1] 0 1
model.matrix(f, data = mf, rhs = 2)
##               (Intercept) factor(vs)1
## Mazda RX4               1           0
## Mazda RX4 Wag           1           0
## Datsun 710              1           1
## attr(,"assign")
## [1] 0 1
## attr(,"contrasts")
## attr(,"contrasts")$`factor(vs)`
## [1] "contr.treatment"

Reference

Zeileis A, Croissant Y (2010). "Extended Model Formulas in R: Multiple Parts and Multiple Responses. Journal of Statistical Software, 34(1), 1-13. doi:10.18637/jss.v034.i01

Installation

The stable version of Formula is available from CRAN:

install.packages("Formula")

The latest development version can be installed from R-universe:

install.packages("Formula", repos = "https://zeileis.R-universe.dev")

License

The package is available under the General Public License version 3 or version 2

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("Formula")

1.2-6 by Achim Zeileis, 3 months ago


https://zeileis.codeberg.page/Formula/


Report a bug at https://codeberg.org/zeileis/Formula/issues


Browse source code at https://github.com/cran/Formula


Authors: Achim Zeileis [aut, cre] (ORCID: , Yves Croissant [aut]


Documentation:   PDF Manual  


GPL-2 | GPL-3 license


Depends on stats

Suggests knitr, rmarkdown


Imported by AER, BCSreg, BLPestimatoR, BNSP, BiDimRegression, BinaryEPPM, CDatanet, CLVTools, Countr, CountsEPPM, CureDepCens, DCchoice, DepCens, DirectEffects, EHRmuse, EMGCR, EdSurvey, ExtremeBounds, FENmlm, FastCUB, FlexReg, HZIP, Hmisc, LMMELSM, LMest, LongCART, MBRM, MIRES, MST, NMAR, OPSR, OncoBayes2, OneSampleMR, PLreg, PResiduals, PartialNetwork, QAIG, RBesT, RCBR, RDHonest, REndo, Ravages, Rcope, RprobitB, SCGLR, ShiftShareSE, SimplexRegression, TriDimRegression, Unitary, WALS, YPBP, YPPE, aldvmm, alpaca, augSIMEX, bamlss, bayeslist, bbreg, bellreg, betareg, betaregscale, bife, bizicount, capybara, car, cbq, cdfquantreg, cdnbcr, choicedata, comets, controlfunctionIV, coresynth, crch, csranks, curesurv, dat, ddecompose, dfidx, dpm, dreamerr, esreg, estimatr, estprod, etwfe, ewoc, factiv, fastglm, fdaMixed, fddm, feisr, flexrsurv, fplot, frontier, gcmr, ggquickeda, gkwreg, glmertree, glmtoolbox, glmx, greport, hdm, hspm, ib, iml, inferference, isni, ivmodel, ivmte, ivreg, ivreg2r, jmcm, lagsarlmtree, lfe, marginaleffects, markets, metR, metafrontier, metaselection, mhurdle, micsr, midasr, missDiag, mixpoissonreg, mlogit, model4you, moult, mtarm, mvctm, nardl, networktree, nparMD, npiv, npmv, oaxaca, palmtree, pammtools, panelr, partykit, pboost, pglm, plm, plsRbeta, polywog, pre, psychomix, psychotree, qreport, rbc, rddapp, rddtools, rifreg, rmdcev, robustbetareg, sampleSelection, sarima, sdlrm, sfa, sfaR, sglg, sigInt, snreg, spBayes, spldv, spscsfa, spsur, table1, tram, trtf, tseLCA, ttt, unitquantreg.

Depended on by CUB, DirichletReg, Rchoice, SGB, SemiCompRisks, StratSel, brnn, clusterSEs, cquad, detect, earth, gmnl, npsf, plotmo, quint, sharx, smbinning, spNNGP, ssym, threg, thregI, zoib.

Suggested by HSAUR3, LTRCtrees, binst, clubSandwich, data.tree, domir, easystats, evtree, ivgets, modelbased, psychotools, quantreg, reformulas, report, see, stablelearner.


See at CRAN