Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

What I would like to do is create a tool that takes as an input, a set of samples that are known to behave according to a known probability distribution and predict the next sample. The tool will evaluate n samples and predict the n+1 sample. I want to compare the predicted sample to the actual sample. I would like to be able to change the assumptions about the data by choosing different probability distributions. The purpose of the tool is to identify samples that don't fit the assumption of the chosen probability distribution.

share|improve this question
    
EstimatedDistribution[data,dist] might suit your purposes - see the documentation for EstimatedDistribution. You provide the data, and it finds the maximum likelihood parameter estimates for the distribution you've specified. You can then simulate the n+1th item via RandomVariate. This of course assumes the terms are independent and identically distributed. –  Royce Dec 30 '12 at 22:14
3  
I don't see how this presents as a Mathematica question. Also, you haven;t shown any any attempts in Mathematica code to solve the problem. I'd recommend withdrawing this question and reposting at a statistics site. –  Jagra Dec 31 '12 at 0:47
1  
OK, I can't resist. Given that you have "...a known probability distribution..." what else do you know about the distribution? Does the distribution have i.i.d. properties? –  Jagra Dec 31 '12 at 0:54
2  
This seems to me to be asking: "I have this vague idea and I'd like you (by ESP) to figure out exactly what I want and then do a lot of coding and debugging, all just because I asked nicely." It's Tom Sawyer scamming Huckleberry Finn all over again. –  m_goldberg Dec 31 '12 at 2:11
1  
Bruce, whether the question is migrated or reposted depends on how much it ought to change when it appears on the target site. In your case I would suggest closing it here, because you won't have a specific Mathematica question until you have a solution method, and posting a slightly different question either on stats or the signal processing site to ask about solution methods. Once you have developed a satisfactory method you could return here (if you need to) and ask more specifically about how to implement it in Mathematica. –  whuber Dec 31 '12 at 16:24
show 6 more comments

closed as not a real question by Yves Klett, whuber, rcollyer, rm -rf Dec 31 '12 at 18:53

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

Here is a worked example:

We take as our data 10000 samples from a Normal Distribution with mean 1 and standard deviation 3:

data = RandomVariate[NormalDistribution[1, 3], 10^4];

We then try to work backwards to see what the data says about the distribution - taking as an assumption that it came from a Normal Distribution, we see which paramaters are most consistent with the data:

EstimatedDistribution[data, NormalDistribution[a, b]]

(* Out: NormalDistribution[1.00923, 2.97484] *)

We could of course have tried to fit other distributions to the data:

EstimatedDistribution[data, StudentTDistribution[a]]

(* Out: StudentTDistribution[1.02925] *)

Once we have estimated parameters for our sample distribution we can then simulate further points using RandomVariate[NormalDistribution[1.00923, 2.97484]]

share|improve this answer
1  
Doesn't EstimatedDistribution[] simply complicate the matter? The OP says they have a, "...known probability distribution..." –  Jagra Dec 31 '12 at 0:51
    
@Jagra - it would indeed be nice to have further details from the OP. I may well have misinterpreted. I was working off his comments about "changing assumptions about the data by choosing different probability distributions" and "predicting the n+1 sample" -- neither of which make sense to me if everything is already known about the distribution in question. –  Royce Dec 31 '12 at 1:32
    
Thanks. This should help me get started. I am doing this as a side project, so it may take a little time to produce results, but I will post my results as soon as possible. –  Bruce Zenone Dec 31 '12 at 14:42
    
Specifically the samples are voice (linear PCM data in .wav format). I know voice samples can be assumed to follow a Rayleigh distribution. Just for reference, I am new to Mathematica and am mostly having trouble with the details in how to use some of the higher level constructs. I think this example should be sufficient to get started. I originally tried using wavelet analysis to find anomalies in the data, but was only marginally successful. I thought I should try a statistical approach as an alternative. –  Bruce Zenone Dec 31 '12 at 14:56
    
@jarga I am new to Mathematica. I have already developed Mathematica code using wavelet analysis, but it was marginally helpful so I thought I would try a statistical approach. I'm having trouble with details of some of Mathematica's statistical constructs and functions and need a little help. I have reviewed documentation and some examples. I thought the question I posted would help point me in the right direction. I am certainly not asking anyone to guess what I am attempting and write any code. Some users have posted useful answers which I believe will get me started. Thanks again. –  Bruce Zenone Dec 31 '12 at 15:53
show 3 more comments

Not the answer you're looking for? Browse other questions tagged or ask your own question.