16
$\begingroup$

I've tried running a formula similar to y ~ 1. This gives me just an intercept, but is the value that's shown equal to intercept estimate(without covariates) + 1, or just intercept estimate(without covariates)?

Any help would be appreciated.

$\endgroup$
5
  • 1
    $\begingroup$ Won't the intercept just be mean(y) $\endgroup$ Commented May 5, 2016 at 16:55
  • 2
    $\begingroup$ Since the formula references only y and the constant 1, how could it possibly even know about any covariates? $\endgroup$ Commented May 5, 2016 at 16:57
  • $\begingroup$ @whuber I do not know. In R if you put -1, then lm does a regression without a constant. By putting just a 1, we could activate another option, unknown to me... That's why I'm asking. $\endgroup$ Commented May 5, 2016 at 17:30
  • 1
    $\begingroup$ Option or not, if you don't supply any covariates to a procedure, there isn't any way for it to use them, is there? $\endgroup$ Commented May 5, 2016 at 17:48
  • 1
    $\begingroup$ @whuber you're probably right, even though I could say that lm(formula, data), and in data the lm function could find the covariates... $\endgroup$ Commented May 5, 2016 at 21:56

1 Answer 1

21
$\begingroup$

When you do linear regression on only a constant, you will only get the intercept value, which is really just the mean of the outcome.

In R we have:

y <- rnorm(1000)
lm(y ~ 1)
# intercept = 0.00965
mean(y)
# Equal to 0.00965

The reason for doing it the regression way, rather than just computing the mean, is to get an easy standard error.

If have no idea what you mean with "intercept +1", but what you do get is the mean of the outcome, i.e. the expected value of y when you do not control for anything.

$\endgroup$
1
  • 2
    $\begingroup$ Thanks Repmat. Also, another reason for doing this, is that some packages require the user to define a base model, e.g. 'BayesVarSel'. $\endgroup$ Commented May 5, 2016 at 17:16

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.