Re: [R] ks.test help

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu, 14 Feb 2008 18:17:16 +0000 (GMT)

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

______________________________________________
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.
Received on Thu 14 Feb 2008 - 18:24:54 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 14 Feb 2008 - 18:30:13 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive