Dear Rodrigo,
The model.matrix() function extracts the model matrix from the object
mod.duncan.hub. To see the contents of the model matrix, just print X
(i.e., enter X at the R command prompt). When you do this, you'll see
that the first column of X is the constant regressor, containing 1's.
The -1 in the subsequent model formula suppresses the column of 1s that
would otherwise be (redundantly) included by default.
A suggestion for posting to the r-help list: Use an informative subject
(e.g., "bootstrapping a regression model"): I almost missed your post.
I hope this helps,
John
On Fri, 2 May 2008 11:54:28 -0600
"Rodrigo Brice?o" <rjavierbriceno at gmail.com>
wrote:> Hello R-listers! My first post to the list is a very simple one for
> those
> who use the software continuosly. I am trying to understand the
> fixed-x
> resampling and random-x-resampling method proposed by Fox about
> Bootstrapping. The doubt that I have is on the side of the model run
> in one
> of the functions expressed for fixed-x resampling. What I don't
> understand
> is: X=model.matrix, and the -1 under mod= rlm. Please see below:
> #fixed x-resampling
> fit <- fitted(mod.duncan.hub)
> e <- residuals(mod.duncan.hub)
> X <- model.matrix(mod.duncan.hub)
> boot.huber.fixed <- function(data, indices, maxit=20){
> y <- fit + e[indices]
> mod <- rlm(y ~ X - 1, maxit=maxit)
> coefficients(mod)
> }
> duncan.fix.boot <- boot(Duncan, boot.huber.fixed, 1999, maxit=100)
> duncan.fix.boot
>
> I just need a quick explanation about WHAT the functions mean or do
> in this
> context.
> Thanks
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/