estimating the parameter of an equation
1 view (last 30 days)
Show older comments
Dear all,
I have this equation:
kk=randn(1000,1);
u=randn(999,1);
kk(2:end)=kk(1:end-1)+u*d;
and I want to estimate the scalar 'd' in the last equation. So, I try to do some minimization but I am not sure if this is the correct way to move on.
So I have something like this
f = @(x) sum( ( kk(2:end)-kk(1:end-1)-u*sqrt(x) ).^2 );
fun = @(x)f(x);
x=fminsearch(fun, 0.2);
I am looking not only for efficiency but also for speed in this calculation.
Thanks
0 Comments
Accepted Answer
John D'Errico
on 24 May 2019
Edited: John D'Errico
on 24 May 2019
Um, don't use fminsearch? In fact, I'm not sure why you would want to do it that way.
d = 17;
n = 10000;
kk=randn(n,1);
u=randn(n-1,1);
kk(2:end)=kk(1:end-1)+u*d;
Now, estimate d. For this simple problem, diff and std are about all you really need.
dhat = std(diff(kk))/sqrt(2)
dhat =
17.1535533234171
3 Comments
John D'Errico
on 25 May 2019
u is included, in the sense that I used information ABOUT u.
u is a vector of samples from a Gaussian (Normally distributed) random variable. Such a random variable has population mean of zero, variance = 1.
When diff is applied to the vector, kk disappears. The result is n-1 samples of the difference of the random variables. The variance of those differences will be 2*d^2, although the samples will no longer be independent, but the lack of independence is irrelevant, since the variance is all that counts. Likewise, the standard deviation will be sqrt(2)*d.
So if you want to compute d, take the standard deviation of the difference, then divide by sqrt(2).
If you need a reference, then you probably need to take a basic course in statistics.
If you want a different approach than one that takes milliseconds to compute with no iterative estimation needed, then you need to explain why you are trying to compute this, and why that solution is not adequate for you.
More Answers (0)
See Also
Categories
Find more on Dimensionality Reduction and Feature Extraction 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!