Filter löschen
Filter löschen

How to calculate 95% confidence interval using regression analysis?

20 Ansichten (letzte 30 Tage)
I have a timeseries dataset of measured lengths of some lines. The dataset consists of dates from oct of one year to march of next year. How do I calculate the 95% confidence interval values using regression analysis for each season (e.g. oct 2003 to March 2004 and so on). Something like this as shown below (CI = 95% confidence interval).
  2 Kommentare
dpb am 24 Feb. 2023
Which toolboxes do you have available? regress in the Statistics TB returns the coefficients and the 95% CI (upper and lower) for each. The table above would use (one presumes) half the difference if the values presented are to be interpreted as "Rate +/- CI".
Alternatively, fit in the Curve Fitting TB has the same statistics and doesn't need the manual insertion of the column of ones to estimate the intercept term if needed.
The easiest way to do this will be to put your data into a timetable and create a grouping variable for the seasons by year; your selection from Oct to March (Is this inclusive or exclusive of March?) isn't a built in grouping so you'll have to create it.
Anwesha Sharma
Anwesha Sharma am 24 Feb. 2023
Thank you so much. This worked perfectly.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Sulaymon Eshkabilov
Sulaymon Eshkabilov am 24 Feb. 2023
If there is a linear fit model for x vs. y(x), then fitlm() can be used, e.g.:
x = (0:.1:13)';
Noise = 35*randn(size(x));
y = @(x)3*x.^2-5*x+3;
Y =y(x)+Noise;
FM =fitlm(YT, 'Y~x^2+x+1')
FM =
Linear regression model: Y ~ 1 + x + x^2 Estimated Coefficients: Estimate SE tStat pValue ________ _______ _______ __________ (Intercept) 5.1654 8.6403 0.59783 0.55101 x -7.3628 3.0713 -2.3973 0.017962 x^2 3.2304 0.22865 14.128 6.7796e-28 Number of observations: 131, Error degrees of freedom: 128 Root Mean Squared Error: 33.5 R-squared: 0.945, Adjusted R-Squared: 0.944 F-statistic vs. constant model: 1.1e+03, p-value = 2.04e-81
  4 Kommentare
Oindrila Nath
Oindrila Nath am 4 Dez. 2023
how did u calculate the confidence bounds?
Sulaymon Eshkabilov
Sulaymon Eshkabilov am 4 Dez. 2023
Ask your question in a separate thread (a separate post) so others can also see it.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by