[R] ks.test help

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Feb 14 19:17:16 CET 2008


On Thu, 14 Feb 2008, Uwe Ligges wrote:

>
>
> Brian Flynn wrote:
>> I am trying to do a ks.test in R 2.6.2 (running on Mac OS X 10.4.11).
>> In the help guides it specifies that the y variable can be a
>> character string for the type of distribution I want. I am doing this
>> on the residuals of a regression model, but I continue to get an
>> error. This is some of the code I have tried:
>>
>> > ks.test(res,"Norm")
>> Error in get(y, mode = "function") :
>>    variable "Norm" of mode "function" was not found
>> > ks.test(res,"norm")
>> Error in get(y, mode = "function") :
>>    variable "norm" of mode "function" was not found
>> > ks.test(res,"normal")
>> Error in get(y, mode = "function") :
>>    variable "normal" of mode "function" was not found
>
> You probably want:
>
> ks.test(res, pnorm)

Or to follow the documentation and its examples,

ks.test(res, "pnorm")

Of course, the KS test is invalid when applied to dependent data such as 
residuals, and you won't know they have variance one (and it would be 
unusual for them to have the same variance).

>
> Uwe Ligges
>
>
>> In this example, res is an object for the residuals of the
>> regression. I have seen the following work on another system: ks.test
>> (res,"norm"), but for some reason it won't work on mine. Any ideas on
>> what I need to fix to get this to work?
>>
>> Thanks,
>>
>> Brian Flynn
>> cbflynn at auburn.edu
>>
>>
>>
>> 	[[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.
>
> ______________________________________________
> 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list