Probability using binomial probability?

2 vues (au cours des 30 derniers jours)
Ronan
Ronan le 23 Nov 2015
Commenté : the cyclist le 25 Nov 2015
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?

Réponse acceptée

the cyclist
the cyclist le 24 Nov 2015
Modifié(e) : the cyclist le 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 commentaires
Ronan
Ronan le 25 Nov 2015
Modifié(e) : Ronan le 25 Nov 2015
Thank you for your help. I don't understand the line pq = coeff(2) + dq*coeff(1); but I assume its some kind of alternative to the prediction function? I was looking at another equation also for probability that uses logistic regression.
F(x) = 1/{1+e^{-(beta_0 + beta_1*x)}}
where beta_0 is the intercept and beta_1 is the regression coefficient.
There is a good example of the probability of students passing exams, where hours of study is proportional to pass rates if you are interested.
https://en.wikipedia.org/wiki/Logistic_regression
the cyclist
the cyclist le 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.

Connectez-vous pour commenter.

Plus de réponses (1)

the cyclist
the cyclist le 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?
You might use ksdensity.
  5 commentaires
the cyclist
the cyclist le 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.
Ronan
Ronan le 24 Nov 2015
yes, so this is effectively what I m trying to do. I was using the cost of the hotels just as an example. So if you had quality of the hotel instead that would be fine.

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by