I'm new to R and I'm trying to learn It by working on a small project.
My goal is to say whether a new value of blood pressure is "coherent" with the previous ones the patient has inserted or it is just a "random value".
The sample vector I'm working with is the following:
pMax <- c(119,120,121,122, 123,124, 119,120,121,122,123,124, 119,120,121,122,123,124, 119,120,121,122,123,124, 119,120,121,122,123,124, 120,120,120,120,120,120,120,120,120,120,120,120,120' 110, 110, 110, 140, 140, 140, 140)
Let's say that I assumed the "normal pressure values" are within the range 119-124 and the values 110 and 140 has been inserted with the only purpose of distract the script.
I tried many ways to achive so and I'm looking for any statistical/R advise.
With standard deviation
error <<- sd(pMax)*sqrt((length(pMax)-1)/length(pMax)) print(paste( "Interval pMax ", (mean(pMax, trim=0.5)-error ), " - ", ( mean(pMax, trim=0.5)+error) ))
which gives back
"Interval pMax 113.877092194063 - 126.122907805937"
Don't like at all
sort(pMax) print( quantile(pMax, c(0.05, 0.95)) )
which gives back
5% 95% 114.05 140.00
Don't like . I may reduce the percentils according to my needs but it cannot be applied to each patient I'm working with.
print( t.test(pMax, mu=pNewValues, conf.level = 0.98) )
One Sample t-test data: pMax t = -1.2576, df = 49, p-value = 0.2145 alternative hypothesis: true mean is not equal to 123 98 percent confidence interval: 119.7964 124.0036 sample estimates: mean of x 121.9
and this results looks acceptable.
The range it gives back is at 98% confidence is the same I expect (eventually, I'll round both values to 119 and 25).
pNewValue is a random new value I insert into the script to manually check whether it is "coherent" with the previous one or not.
Now a couple of questions:
- I can't get why for values higher than the average got from the t.test() - reaching the upper limit of the range - p-value tends time by time to 0 (0.0004386) whereas going towards the lower limit tends to 1. Shouldn't it that - for values closer to the average - the value is supposed not to be "random" and p-value <0.005?
- t.test() as far as I read is applied to only chisquared distributions and not to normal distribution. am I asked to check first the "skew" both sides before proceeding?
Thank you for any help or any discussion!