Hi Ufuk,

Using Michael's data, here is one more way of doing it:

allmodels <- lapply(1:nrow(x), function(row) with(x, lm(y ~ ., data =
x[-row,])))
allmodels

To access the information contained in the model when the first row is
removed, you can do

summary(allmodels[[1]])

And, if you want to have all coefficients, then

do.call(rbind, lapply(allmodels, coefficients))

is what you need.

HTH,
Jorge


On Wed, Dec 22, 2010 at 4:57 PM, ufuk beyaztas <> wrote:

>
> Hi dear all,
>
> suppose that s is a statistic code;
>
> i have a matrix (x) which has 7 columns (1=x1,2=x23=x3,4=x4,5=x5,6=x6
> and7=y)
> and has 20 rows. i want to do linear reggression like
> reg<-lm(x[,7]~1+x[,1]+x[,2]+.......+x[,6])
> but i want to do delete i th row for nrows times and create regression
> model
> like above and compute each models'   "s" statistics and list them. but i
> could not do. i always get only one model and statistic.
> How can i do this
>
> Thanks any idea!
> --
> View this message in context:
> http://r.789695.n4.nabble.com/regression-tp3161328p3161328.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to