[R] substituting own test statistics in a built-in function

Peter Ehlers ehlers at ucalgary.ca
Sun Mar 18 01:10:34 CET 2012


On 2012-03-15 19:43, Aparna Sampath wrote:
> Hi Sarah Goslee
>
> Thanking you for replying to my doubt.
>
> I downloaded the multtest package from CRAN and also went through the
> package specific PDF file, they have given a list of functions which
> includes the mt.transformV, mt.checkothers etc, that I am trying to access
> which they call as the internal functions and say that these set of
> functions cannot be called by the user. and these functions perform the
> permutation part, so I need to somehow access them.
>
> Regards
> Ap
>

Try this:

  myfun <- function(....  # your modified version of mt.sample.rawp
  environment(myfun) <- environment(mt.sample.rawp)

Peter Ehlers

>
>
>
>
> On Thu, Mar 15, 2012 at 6:40 PM, Sarah Goslee<sarah.goslee at gmail.com>wrote:
>
>> Hi,
>> On Mar 15, 2012 4:28 AM, "Aparna Sampath"<aparna.sampath26 at gmail.com>
>> wrote:
>>>
>>> Hi All
>>>
>>> I would like to compute the raw p-value from permutation tests and I
>> found
>>> mt.sample.rawp() from the package multtest almost similar to what I want
>> to
>>> do. But in the function definition:
>>>
>>>
>> mt.sample.rawp(V,classlabel,test="t",side="abs",fixed.seed.sampling="y",B=10000,na=.mt.naNUM,nonpara="n")
>>>
>>> I would like to choose my own t-test which is designed using my model
>>> parameters, so it is like a modification of t-test. I would like to use
>> this
>>> t-test instead of the ones in the list.  I am not sure if this can be
>> done.
>>> Can anyone tell me how to do it, if it is possible.
>>>
>>> the other way I tried is to copy the function and and modify it.
>>
>> Indeed, that's the way to customize functions.
>>
>>> But it uses
>>> internal functions from the package like mt.checkothers() which I do not
>>> know perform what kind of function. I tried to access its function
>>> definition, but I was not able to do so. is there some other way I could
>> see
>>> what these internal functions do, so that I could possibly try to use the
>>> same logic and write the code.
>>
>> If you download the package source from CRAN, you'll have all of it,
>> including any comments that have been stripped out.
>>
>>> Appreciate all help. Thanks a lot :)
>>>
>>> Regards
>>> Ap
>>>
>>
>> Sarah
>>
>
>
>



More information about the R-help mailing list