negative values kernel density estimation

I have obtained the monthly temperature distribution using kernel density estimate. And using SVD(Singular Value Decomposition) and regression model, I forecast the monthly temperature distribution. But I found that some estimated kernel density values are negative. How to deal with these negative values?

10 件のコメント

Bjorn Gustavsson
Bjorn Gustavsson 2022 年 12 月 20 日
It might be easier to have opinions if you could share a figure illustrating this.
Adam Danz
Adam Danz 2022 年 12 月 20 日
Code snippets are helpful, too, so we can see exactly what you're doing.
ZHIMIN YAN
ZHIMIN YAN 2022 年 12 月 21 日
編集済み: Adam Danz 2022 年 12 月 21 日
[U,S,V] = svd(z);
U1 = U(:,1);
Mdl = arima('Constant',0,'ARLags',1,'SARLags',12,'D',1,...
'Seasonality',12,'MALags',1,'SMALags',12);
EstMdl = estimate(Mdl,U1);
numperiods = 11;
[Forecast,ForecastMSE] = forecast(EstMdl,numperiods,U(:,1));
Tempdiff_forecast = Forecast*S(1,1)*V(:,1)';
z is kernel density value, and Tempdiff_forecast is kernel density forecast value. And some values are negative. How to deal with these negative values?
Adam Danz
Adam Danz 2022 年 12 月 21 日
Could you provide the z values?
ZHIMIN YAN
ZHIMIN YAN 2022 年 12 月 21 日
編集済み: Torsten 2022 年 12 月 21 日
This is z values. Thank you very much!!
zmat = load("z.mat");
z = zmat.z;
[U,S,V] = svd(z);
U1 = U(:,1);
Mdl = arima('Constant',0,'ARLags',1,'SARLags',12,'D',1,...
'Seasonality',12,'MALags',1,'SMALags',12);
EstMdl = estimate(Mdl,U1);
ARIMA(1,1,1) Model Seasonally Integrated with Seasonal AR(12) and MA(12) (Gaussian Distribution): Value StandardError TStatistic PValue ________ _____________ __________ ___________ Constant 0 0 NaN NaN AR{1} 0.04126 0.054551 0.75636 0.44944 SAR{12} -0.1694 0.049563 -3.4179 0.00063099 MA{1} -0.81241 0.036031 -22.548 1.4186e-112 SMA{12} -0.78822 0.035602 -22.14 1.3097e-108 Variance 0.003309 0.00019167 17.264 8.771e-67
numperiods = 11;
[Forecast,ForecastMSE] = forecast(EstMdl,numperiods,U(:,1));
Tempdiff_forecast = Forecast*S(1,1)*V(:,1)';
Adam Danz
Adam Danz 2022 年 12 月 21 日
You start with negative z values.
data = load('z.mat')
data = struct with fields:
z: [372×401 double]
[zmin, zmax] = bounds(data.z, 'all') % show range of z values
zmin = -0.0924
zmax = 0.0993
And you're training your model using negative values,
[U,S,V] = svd(data.z);
U1 = U(:,1)
U1 = 372×1
-0.0222 -0.0145 -0.0579 0.0195 -0.0293 0.0161 -0.0491 -0.1093 -0.0165 -0.0512
Your new model EstMdl contains estimated parameters based on the training data U1. So, when you forecast that fitted model, the forecast also has negative values.
ZHIMIN YAN
ZHIMIN YAN 2022 年 12 月 22 日
So you mean that I should delete the negative values in z, ensure that the predicted results are all positive?
ZHIMIN YAN
ZHIMIN YAN 2022 年 12 月 22 日
Can I delete the negative values from the predicted kernel density values and rescale the kernel density values so that the bandwidth to be 1?
Adam Danz
Adam Danz 2022 年 12 月 22 日
> So you mean that I should delete the negative values in z
No, I would take a step back and investigate. Do you expect there to be negative values in z? If not, then how did they get there? Perhaps something went wrong with your calculations of z or perhaps your expectations of what z should be aren't correct expectations. If you do expect there to be negative values in z or that negative values are possible, then I would re-think whether it is a problem that the forecast produces negative values.
If z isn't meaningful data and you're using z to poke around at the model, then it's completely fine to replace the negative values or use an entirely different set of data. But if z is meaningful data, you can't just delete some values because they are causing problems.
I don't know enough about what the data are or about the forecasting you're using to suggest the next steps.
ZHIMIN YAN
ZHIMIN YAN 2022 年 12 月 23 日
z in my data is the difference between actual temperature kernel density distribution and average temperature kernel density distribution. So negative values in z are also meaningful data. And my purpose is to predict the temperature kernel distribution. Thank you very much!

サインインしてコメントする。

回答 (0 件)

カテゴリ

質問済み:

2022 年 12 月 20 日

コメント済み:

2022 年 12 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by