Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Same Intercepts #60

Closed
galalxyliu opened this issue Aug 26, 2022 · 1 comment
Closed

Same Intercepts #60

galalxyliu opened this issue Aug 26, 2022 · 1 comment

Comments

@galalxyliu
Copy link

Describe the bug

Hi Merlise, nice to see you!

I find that all models' intercepts are the same. This confuses me. In my naive view, the intercepts should be significantly different because of the different model specifications.

By the way, because of the need for presentation, in the frequentist view, what's the estimator used in the Bas package (Ols or Gls)?

Thanks!

To Reproduce

rm(list=ls())
library(MASS)
options(digits=22)
set.seed(100)
data(UScrime)
crime.bic <- bas.lm(log(y) ~ log(M) + So + log(Ed) +
log(Po1) + log(Po2) +
log(LF) + log(M.F) + log(Pop) + log(NW) +
log(U1) + log(U2) + log(GDP) + log(Ineq) +
log(Prob) + log(Time),
data = UScrime, n.models = 2^15, prior = "BIC",
modelprior = beta.binomial(1, 1),
initprobs = "eplogp", pivot = FALSE
)

cog <- coef(crime.bic)
means <- matrix(cog$conditionalmeans,2**15,16)
intercept <- means[,1]
intercept <- as.data.frame(intercept)
intercept

########## we can find the all models' intercept are almost same################

Expected behavior

Could you tell me the reason why all the intercepts are same?

@merliseclyde
Copy link
Owner

merliseclyde commented Oct 18, 2022

The intercepts are all equal in this model formulation as the explanatory variables have all been centered about their respective means. When the X's are equal to their mean, then the centered predictors are all 0 and the fitted value is just the intercept, which is $\bar{y}$. See the help file for bas.lm.

The estimates are MLEs/OLS if there are no weights, and GLS/MLEs if there are weights used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants