[R] weighted m-estimator

From: Daniel Metzler <daniel.metzler_at_gmx.net>
Date: Thu 08 Dec 2005 - 19:50:45 EST

Dear R listers,

I'm trying use Huber's m-estimator on a dataset, which works fine so far.

In the next step I would like to assign a (frequency) weight to the observations.
It seemed straight forward to me to replicate the rows according to their count variable.

Unfortunately, a solution provided by jim holtman on Wed 19 Oct 2005 in this list doesn't work for me:

> y <- unlist(lapply(seq(nrow(x)), function(.row)rep(.row, x$count
# replicate the row numbers
> y
> result <- x[y,] # pick out the rows
> result$count <- 1 # set the count to 1
> result

R keeps crashing. I presume because of 800,000 rows, which should be produced.

Does a smarter solution exist for weighting the observations according to their frequency than manually replicating rows when using the huber function?

Thanks for any help!

Daniel Metzler

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Dec 08 19:59:36 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:34 EST