wald test of equality in matlab.

10 visualizaciones (últimos 30 días)
mpho bosupeng
mpho bosupeng el 16 de Feb. de 2022
Respondida: Aditya el 21 de En. de 2024
Hello
I am running a nonlinear impulse response with positive shock and negative shock for each period. Suppose for period one, i have a positive shock value as 3.2 and negative shock value as -4.8. I need a formal test to show that the two shocks are not equal that is (positive ≠ negative). I have values for period 1-12.
Kindly assist.
  1 comentario
Star Strider
Star Strider el 16 de Feb. de 2022
The Wald test is a test on parameters. From the description provided, it does not appear to be appropriate here.
If it is appropriate here, it would appear to be relatively straightforward to code, and the Statistics and Machine Learning Toolbox can calculate the appropriate probabilities.

Iniciar sesión para comentar.

Respuesta aceptada

Aditya
Aditya el 21 de En. de 2024
Hi mpho,
The Wald test is typically used to test the significance of individual coefficients in a model or to test the equality of two parameters in the context of a statistical model. However, from the description provided, it seems you are looking to test whether the effects of positive and negative shocks are significantly different from each other, rather than testing model parameters.
If you have estimated impulse responses for both positive and negative shocks across different periods and you want to test if the responses are statistically different, you might consider using a paired difference test, such as the paired t-test, if the assumptions for this test are met (e.g., the differences are normally distributed).
Here is an example of how you might perform a paired t-test in MATLAB using the Statistics and Machine Learning Toolbox for a simple case where you have estimated impulse responses for positive and negative shocks for 12 periods:
positiveShocks = [3.2, ...]; % replace with your actual values
negativeShocks = [-4.8, ...]; % replace with your actual values
% Calculate the differences between positive and negative shocks
differences = positiveShocks - negativeShocks;
% Perform a paired t-test
[h, p, ci, stats] = ttest(differences);
% Display the results
if h == 1
fprintf('Reject the null hypothesis at the 5% significance level.\n');
fprintf('p-value: %g\n', p);
fprintf('Confidence interval on the mean difference: [%g, %g]\n', ci(1), ci(2));
else
fprintf('Do not reject the null hypothesis at the 5% significance level.\n');
fprintf('p-value: %g\n', p);
end
In this code, 'h' is the hypothesis test result (1 if the test rejects the null hypothesis, 0 otherwise), 'p' is the p-value of the test, 'ci' is the confidence interval of the mean difference, and 'stats' contains the test statistic and degrees of freedom.
Remember to check the assumptions of the paired t-test before applying it. If the assumptions are not met, you may need to consider non-parametric alternatives, such as the Wilcoxon signed-rank test, which can be performed in MATLAB using the signrank function.
For additional details on “ttest” function refer to the below MATLAB documentation:
I hope you find this information useful!

Más respuestas (0)

Categorías

Más información sobre Hypothesis Tests en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by