Reputation: 531
i got this data and i need to fit a normal distribution to get another set of data associated with probabilities of ocurrence.
data = c(150,94.1,127.6,77.2,136.1,83.4,75.6,92.7,106.5,95.9,112.1,90.4,143.7,152.7,113.3,143.9,87.9,85.2,117.2,193,153.7,84.7,97.3,140.3,80,103.6,72.6,90.7,52.6,52.8)
and then the probability of occurence:
returntime = c(1.02,1.5,2,3,4,5,6,7,8,9,10,15,20,25,30,50,100,200,500,1000,5000,10000) #years
prob_returntime = 1/returntime #need to get the data associated with this prob.
i have tried to use qnorm(), but i think i'm doing something wrong...
expected output:
Upvotes: 0
Views: 425
Reputation: 1816
If you want to find the quantiles of the normal distribution corresponding to data
but for the values of 1 - prob_returntime
we can do the following.
Code
# Estimate mean and standard deviation from your data
mu <- mean(data)
std <- sd(data)
# then use qnorm to get quantiles of data associated with return prob
data.frame("return_time" = returntime, "probability" = 1/returntime,
"data value" = qnorm(1 - (1 / returntime), mu, std))
# return_time probability data.value
# 1 1.02 0.98039216 38.94683
# 2 1.50 0.66666667 92.69954
# 3 2.00 0.50000000 106.89333
# 4 3.00 0.33333333 121.08712
# 5 4.00 0.25000000 129.11985
# 6 5.00 0.20000000 134.62735
# 7 6.00 0.16666667 138.77285
# 8 7.00 0.14285714 142.07307
# 9 8.00 0.12500000 144.80089
# 10 9.00 0.11111111 147.11719
# 11 10.00 0.10000000 149.12440
# 12 15.00 0.06666667 156.35874
# 13 20.00 0.05000000 161.09633
# 14 25.00 0.04000000 164.58383
# 15 30.00 0.03333333 167.32647
# 16 50.00 0.02000000 174.57069
# 17 100.00 0.01000000 183.55366
# 18 200.00 0.00500000 191.77484
# 19 500.00 0.00200000 201.73763
# 20 1000.00 0.00100000 208.72601
# 21 5000.00 0.00020000 223.55000
# 22 10000.00 0.00010000 229.44638
Upvotes: 2