[R] How to adjust the Intercept correctly when using ols() and validate().
Wolfgang_Lederer@mckinsey.com
Wolfgang_Lederer at mckinsey.com
Thu Nov 20 15:26:29 CET 2003
Dear R-Help-List,
i am using the ols() function to fit a model and use the validate()
function to obtain the shrinking constant for the slope. But how can i get
the correct shrinking constant for the Intercept? If i use the provided
constant to adjust the intercept, i get a serious Bias.
the code i use looks like this:
f <- ols(formula , data = data, y=T, x=T)
fv <- validate(f)
ShrinkingGamma <- fv["Slope","index.corrected"]
f$coefficients[2:(length(f$coefficients)-1)] <-
f$coefficients[2:(length(f$coefficients)-1)] * ShrinkingGamma
f$coefficients[1] <- (1-ShrinkingGamma) * mean(data[,1]) +
f$coefficients[1] * (ShrinkingGamma)
predict(f, newdata = data)
Thanks for your help
Wolfgang
+---------------------------------------------------------+
This message may contain confidential and/or privileged
information. If you are not the addressee or authorized to
receive this for the addressee, you must not use, copy,
disclose or take any action based on this message or any
information herein. If you have received this message in
error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation.
+---------------------------------------------------------+
More information about the R-help
mailing list