Simple Linear Regression - Problem95

Back to General discussions forum

sam_bandara     2022-08-18 03:45:01

Hi experts, I just tried with the following formula formula for K and got the answer K = 1.52864823681 and B = 108.2096433 for test data wfich is wrong. I just manually calculated in Excel prior to coading. Can someone explain the issue here please?

gardengnome     2022-08-18 07:08:27
User avatar

Hi Sam,

Difficult to say what exactly is wrong without any further details. What values do you get for the numerator and denominator in the first equation?

sam_bandara     2022-08-18 23:11:38

This is the data set I used to calculate. input data: 1925 1947
1925: 89 257
1926: 75 226
1927: 83 235
1928: 52 173
1929: 148 332
1930: 109 268
1931: 129 306
1932: 115 289
1933: 102 265
1934: 99 269
1935: 50 228
1936: 102 265
1937: 91 256
1938: 79 238
1939: 118 298
1940: 134 311
1941: 61 155
1942: 146 340
1943: 108 274
1944: 96 242
1945: 89 232
1946: 143 328
1947: 133 303

answer: 1.54053779316 107.312854273

Thanks mate

gardengnome     2022-08-19 05:18:05
User avatar

Hi Sam,

I understand what the input data set is, and my calculations produce 1.54053779316 and 107.312854273 just as expected. As you get different values, you need to share a bit more detail. More specifically, what values do you get for the following sums: sum(x_i), sum(y_i), sum(x_i*x_i), sum(x_i*y_i)? I suspect that you have somewhere a small calculation mistake, and this partial results will allow us to zoom in.

sam_bandara     2022-08-22 03:38:34

Sorry for the confusion, that was my bad. I have used n = 21 instead 23. Now all good.

Thanks for your time mate.

sum(xi) : 2351
sum(y
i) : 6090
sum(xi*yi) : 14317590
sum(xi*xi) : 258277
sum(xi) * sum(xi): 5527201
1.5405377931602005 107.31285427305951 23

Cheers, Sam

Please login and solve 5 problems to be able to post at forum