r - `rms::ols()`: how to fit a model without intercept -
i'd use ols()
(ordinary least squares) function rms
package multivariate linear regression, not calculate intercept. using lm()
syntax like:
model <- lm(formula = z ~ 0 + x + y, data = mydata)
where 0
stops calculating intercept, , 2 coefficients returned, on x
, other y
. how do when using ols()
? trying
model <- ols(formula = z ~ 0 + x + y, data = mydata)
did not work, still returns intercept , coefficient each x
, y
.
it has 5 columns. example, can use first 3 columns:
model <- ols(formula = corren ~ inten_anti_ncp + inten_par_ncp, data = ccd)
thanks!
rms::ols
uses rms:::design
instead of model.frame.default
. design
called default of intercept = 1
, there no (obvious) way specify there no intercept. assume there reason this, can try changing ols
using trace
.
Comments
Post a Comment