# Re: [R] Searching for specific functions

Date: Sat 01 Oct 2005 - 02:43:41 EST

1. I am not sure why you want the biased version but here are two ways to do this. Also if you have large enough sample size, it would not matter much.
```	my.var1 <- function(x) mean( (x - mean(x))^2 )
my.var2 <- function(x) mean( x^2 - mean(x)^2 )

```

2) Look at quantiles function. Your equation might correspond to one of the types given there.

On Fri, 2005-09-30 at 10:46 +0200, Fabrizio Ferri Benedetti wrote:
> Hello everybody (I'm new here)
>
> I am looking for 2 specific functions. The first one is a variance
> formula that does not divide by n-1 (I don't want the unbiased formula,
> that's it). In case it does not exist, how do I modify the default
> function code? Yes, a workaround would be to multiply the result by n-1
> and then divide it by n, but I'd like to use a separate function, if
> possible.
>
> The other function I'm looking for it's a median formula like this one:
>
> http://www.faberitius.com/prototipo/gfx/clip_image002_0000.gif
>
> Where "Li" is the exact lower limit of the critical interval, "nb" is
> the number of cases that lie below the critical interval, "nd" the number
> of cases inside the mentioned interval, and "I" is the range of the
> interval itself. As you can see this formula calculates the median in
> categorical structured data.
>
> I couldn't find any functions that match the results done by hand... is
> there a contrib package out there that may help me? Should I program the
> function on my own?
>