How to calculate difference between BMI and Average in this spreadsheet - libreoffice

I have this libreoffice calc spreadsheet: https://imgur.com/a/fOztaWb and i need help to calculate BMI DIFF. So i need to substract Average from BMI if BMI is higher than average and in need to substract BMI from average if average is higher. How to do that? I've been trying with if function but every time it substracts average from bmi even if average is higher. How to do that?

Related

Finding lapse rate (value for dT/dh)

I have a temperature dataset with surface temperatures and a second dataset with the corresponding elevation at which these temperatures are measured. How can I find the aprroximate lapse rate between those 2 datasets? I can use MatLab but I don't know what to do.
So dT/dh = ...?
Thanks!

Estimated lambda exponential distribution

I'm trying to calculate lambda that is the rate of exponential distribution. For example if I have an interval of 5 seconds and I have 4 objects (on average) how is lambda calculated? I need formulas to calculate it. Can anyone help me?
The rate is the number of occurrences per time unit (total number of occurrences / total time). For your case, 4 per 5 time units or a rate of 0.8 per time unit. The mean time between occurrences will be the inverse of this, or 1.25 time units.
You're asking about Exponential_distribution
the exponential distribution is the probability distribution that
describes the time between events in [...] a process in which events
occur continuously and independently at a constant average rate

compute time series weighted average

I have a 8760x1 vector with the 1-hour average ambient temperature time series.
I want to calculate the weighted average temperature weighted by the percentage of operating
hours at each temperature level.
What i thought is divide the temperature range with:
ceil(Tmax-Tmin)
and then use hist.
Are there any other suggestions?
Thank you in advance.
mean(temperatures) should do it.
Since you have hourly measurements, the frequency of a given value will be reflecting the operating hours at that temperature level. A value that occurs frequently will therefore automatically have more weight in the average.
Let's say you have two vectors that are the same length, one is the temperature (temp), and the other is the amount of time at that temperature (time_at_temp). The weighted average formula is this:
wt_avg_temp = sum(temp .* time_at_temp) / sum(time_at_temp);

Finding 15th and 85th percentile in matlab

I have came up with a matlab code to plot a probability density and a cumulative graph. I have used the matlab to compute the standard deviation and the mean as well.
My next task is to find the 15th and 85 percentile of the cumulative graph. I tried to use 'prctile (prob, 15)' to calculate the 15th percentile but it does not seem to be the same value as what I have observed from the graph.
Is there any other ways to find the 15th and 85 percentile?
This should give you the 15% and 85% percentile values as you see in your cumulative graph:
15_percentile = prob(find(prob<prctile(prob,15),1));
85_percentile = prob(find(prob>prctile(prob,85),1,'last'));
There are several ways to calculate a percentile (see http://en.wikipedia.org/wiki/Percentile)
The gotcha here is that MatLab and Excel don't agree (Excel uses the definition empployed by the National Institiute of Standards And Technology in the US...also default for R)...worth considering if you swap data and analysis between MatLab and Excel.
Use the percentile function if you have that statistics toolbox (type help prctile).
http://www.mathworks.com/help/stats/prctile.html
Alternatively write it yourself! A percentile is simply the data sorted, and the value closest to the percentile you want (for example if you have 1000 values, your 15th percentile will be the (15/100)*1000=150th value! Make sure you sort the data from smallest to largest.
There is a special way to deal with values that fall in between samples, but these depend on the definition you use. Some take the nearest, others take the average between two samples, and some others calculate how close they are to the samples and take a value that is linearly proportional to that.

I can't understand something about mat lab coding

generate a scatter-plot of log-normally distributed values of at
least 1000 random numbers in the interval [5;50] derived from a uniform distribution over the interval
[0;1].
I have done this so far
%declaring intervals
a=5;b=50;
%creating 1000 random number within the interval [5,50]
r = a + (b-a).*rand(1000,1);
I can not understand this part "derived from a uniform distribution over the interval
[0;1]."
rand gives you a pseudorandom number between 0 and 1. The probability of selecting any particular number form this interval is the same for any other number from the interval, hence the probability density function used by rand is called "uniformly distributed".
So, you started out fine :)
I would take this to mean that you should map the range of numbers you want as output into the interval [0,1]. That is to say you partition the interval into 46 equally spaced subintervals, such that the intersection of each interval is empty and their union is [0,1]. Then to each subinterval, you associate a value of your output sample range then a sample from [0,1] lets you create a random sample from the set [5:50]
For example, if you wanted to create a sample from [1:10] you would choose generate a sample from uniform distribution on [0,1]. If the sample is in the interval [0,0.1) your output sample value is 1. If it was in the interval [0.2,0.3) your value would be 3 etc.
If your is asking what a uniform distribution actually is, it is simply a distribution where every point in the sample space has an equal probability of being chosen. See this for more details http://en.wikipedia.org/wiki/Uniform_distribution_%28continuous%29