Probability using binomial probability?
3 views (last 30 days)
Show older comments
Suppose I have a field of points, where I want to find the most likely location of a point. If I have 400 points then obviously I have a 1/400 chance of finding that point. However if I assume that the points closer to the centre are more likely, is it coherent to suggest that I should use binomial probability. So I could just choose the closest distance but i want a dynamic way of telling how likely a point is in the correct location with varying distances. I don't have a whole lot of practise with probability so I m not really sure if this is right?
0 Comments
Accepted Answer
the cyclist
on 24 Nov 2015
Edited: the cyclist
on 25 Nov 2015
From the preceding discussion, it sounds like you want a model that predicts price from distance. Here is some code that will do that.
% Data
distance = [0.2 0.4 0.5 0.6]';
price = [500 600 400 300]';
% Fit a linear model
mdl = fitlm(distance,price);
% Get predicted price over a range of distances
dq = (0 : 0.05 : 1)';
pq = predict(mdl,dq);
% Plot the data and the fit
figure
hold on
scatter(distance,price);
plot(dq,pq,'r')
xlabel('Distance')
ylabel('Price')
This code requires the Statistics and Machine Learning Toolbox. If you don't have that, you can use
[coeff] = polyfit(distance,price,1); % EDITED (to correct outputs)
to get the parameters of the linear model, and plot accordingly.
Here is the plot created by the code:
4 Comments
the cyclist
on 25 Nov 2015
The polyfit function is fitting the data to a line, which is the same thing as the fitlm function was doing. The line
pq = coeff(2) + dq*coeff(1);
is taking the coefficients of that fit, and calculating the price for a range of distance values. That is the "prediction" of price, given distance.
Since you don't have the Stats toolbox, you do not have a whole range of other modeling/fitting tools. You could write your own logistic fit (or maybe there is one in core MATLAB). But you would do the same thing. Fit the data to a model, then "predict" price from distance, given the fitted parameters.
More Answers (1)
the cyclist
on 23 Nov 2015
I'm afraid I don't understand the endpoint goal.
Do you mean that you have a field of points, with locations, and you want to know the probability of the location of another point taken from a similar sample?
5 Comments
the cyclist
on 24 Nov 2015
OK, so we're inching toward a complete description of the problem.
It's still not perfectly clear how to use probability -- I actually think you might mean statistics -- to solve this. You somehow need to generate a formula that takes you from these two measures to the one that truly measures quality (worst -- best).
If you actually had a quality measure of these hotels (e.g. star ratings) ...
stars = [4.3 4.4 3.7 3.2]
then you could build a mathematical model for estimating quality, based on the data.
Otherwise, I don't see a good way to solve the problem.
See Also
Categories
Find more on Price and Analyze Financial Instruments in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!