Hi Tamas,
Please see my response to your posted comments.
Question: which individual regressors, belongs to which entry of mdl.Report.Parameters.ParVector.
Please bear n mind that the mdl.Report.Parameters.ParVectorparameter contains estimates in a column vector. To associate individual regressors with these estimates, you can refer to the sys.RegressorUsage table. Each 'true' entry in sys.RegressorUsage corresponds to a parameter estimate in ParVector. The order of 'true' entries aligns with the order of parameter estimates.
Question: where i can find p-values or standard errors for each of these parameter estimates.
I am not sure if MATLAB's NLARX model implementation directly provide p-values or standard errors. You may need to calculate these values separately using statistical methods or by employing additional toolboxes in MATLAB for statistical analysis. I will provide a code snippet example which will utilize functions in Matlab to calculate p-values and standard errors for parameter estimates. Additionally, generate plots to visualize the data effectively.
% Generate sample data
x = randn(100, 1);
y = 2*x + randn(100, 1);
% Fit a linear regression model
mdl = fitlm(x, y);
% Display parameter estimates, p-values, and standard errors
disp('Parameter Estimates:');
disp(mdl.Coefficients.Estimate);
disp('P-Values:');
disp(mdl.Coefficients.pValue);
disp('Standard Errors:');
disp(mdl.Coefficients.SE);
% Plot the data and regression line
figure;
scatter(x, y);
hold on;
plot(mdl);
xlabel('X');
ylabel('Y');
title('Linear Regression Model');
legend('Data Points', 'Regression Line');
So, I created random data points for x and generate corresponding y values with some noise. Then,use the fitlm function to fit a linear regression model to the data and display the parameter estimates, p-values, and standard errors for the model coefficients and finally, create a scatter plot of the data points and overlay the regression line to visualize the linear relationship between x and y.
Please see attached plot along with test results.
By following this code snippet, you can efficiently calculate p-values, standard errors, and visualize the regression model in Matlab.