[R] Is it ok to apply the z.test this way?

David Winsemius dwinsemius at comcast.net
Fri Apr 16 22:38:47 CEST 2010


On Apr 16, 2010, at 3:39 PM, Atte Tenkanen wrote:

> Hi,
>
> In fact, my original intention is to show that the measurings of the  
> musical data are not random. Here I have a measurement from a  
> composition.
>
> http://www.ag.fimug.fi/~Atte/Comp.pdf
>
> and here one random composition which I have used, among many  
> others, in order to produce that 'Distribution'.
>
> http://www.ag.fimug.fi/~Atte/RandomComp.pdf
>
> All the values are averaged over the bars. That's why the curves are  
> so smooth.
>
> Is there any way to find such boundaries?

You can use density estimation if you are willing to ignore the  
sequence information in your data, as it appears you desire at this  
point. (I suggested offlist that you use a time series framework.)

?density
?denityplot

Also look into the quantile function. After calculating 5% and 95%  
quantiles, you could offer the results to the abline function.

-- 
>
> Atte Tenkanen
>
> ----- Original Message -----
> From: Christos Argyropoulos <argchris at hotmail.com>
>
>> So ..
>>
>> are you trying to figure out whether your data hasa substantial  
>> number
>> of outliers that call into question the adequacy of the normal distro
>> fro your data?
>>
>> If this is the case, note that you cannot individually check the
>> values (as you are doing) without taking into account of the
>> "Bonferoni" fallacy i.e. small p-values will be found with a
>> respectable frequency as the size of the dataset grows (C Robert
>> discusses this in a preprint in arxiv see
>> http://arxiv.org/PS_cache/arxiv/pdf/1002/1002.2080v1.pdf ) So even
>> though you could check each individual point for normality, testing
>> the whole dataset requires that you apply a Bonferoni correction to
>> your z.tests or use outlier.test from package "car" to reduce the
>> amount of code you have to write.
>>
>> Regards,
>>
>> Christos
>>
>>> Date: Fri, 16 Apr 2010 19:11:19 +0300
>>> From: attenka at utu.fi
>>> To: r-help at r-project.org
>>> Subject: [R] Is it ok to apply the z.test this way?
>>>
>>> Dear R-users,
>>>
>>> I want to check if certain values are from random distribution, that
>> includes values between 0-1. So, it is not really normal even though
>> shapiro.test says it is highly normal... Can I do something like this
>> and think that the values given are right. z.test is from package
>> TeachingDemos.
>>> -------------------------------------------------------------------------------
>>> SelectedVals=c()
>>> for(i in seq(0,1,by=0.001))
>>> {
>>> if((z.test(i, mu=mean(Distribution),
>> stdev=sd(Distribution))$p.value)<=0.05)  
>> SelectedVals=c(SelectedVals,i)
>>> }
>>>
>>> -------------------------------------------------------------------------------
>>> I have marked the border values given by this script to the
>> histogram of the original random distribution:
>>>
>>> http://www.ag.fimug.fi/~Atte/62Hist100410.pdf
>>>

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list