estimating the parameter of an equation

조회 수: 5 (최근 30일)
ektor
ektor 2019년 5월 24일
댓글: John D'Errico 2019년 5월 25일
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

채택된 답변

John D'Errico
John D'Errico 2019년 5월 24일
편집: John D'Errico 2019년 5월 24일
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
ektor
ektor 2019년 5월 24일
any other approaches?
John D'Errico
John D'Errico 2019년 5월 25일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Smoothing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by