Free Statistics

of Irreproducible Research!

Author's title

Author*The author of this computation has been verified*
R Software Modulerwasp_multipleregression.wasp
Title produced by softwareMultiple Regression
Date of computationSun, 18 Nov 2012 10:48:16 -0500
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2012/Nov/18/t1353253717m60ee23tawnfjl6.htm/, Retrieved Mon, 29 Apr 2024 19:57:02 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=190221, Retrieved Mon, 29 Apr 2024 19:57:02 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywords
Estimated Impact66
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-       [Multiple Regression] [Simple Lineair re...] [2012-11-18 15:48:16] [cff8eb8c83aab4f7b97680faed5ecb28] [Current]
Feedback Forum

Post a new message
Dataseries X:
1830	67.643	64.033	131.676
1831	69.371	65.679	135.050
1832	66.294	62.776	129.070
1833	70.768	67.024	137.792
1834	71.774	67.988	139.762
1835	73.388	69.529	142.917
1836	74.040	70.158	144.198
1837	73.238	69.410	142.648
1838	78.121	74.049	152.170
1839	69.825	66.197	136.022
1840	71.099	67.043	138.142
1841	70.676	67.459	138.135
1842	69.515	65.512	135.027
1843	68.246	64.665	132.911
1844	68.594	65.382	133.976
1845	70.405	66.607	137.012
1846	61.223	58.387	119.610
1847	60.542	57.564	118.106
1848	61.952	58.431	120.383
1849	68.173	65.012	133.185
1850	67.240	64.176	131.416
1851	68.739	65.509	134.248
1852	69.234	65.163	134.397
1853	65.570	62.158	127.728
1854	67.408	64.429	131.837
1855	64.630	61.325	125.955
1856	68.848	65.339	134.187
1857	73.370	69.921	143.291
1858	74.292	70.782	145.074
1859	76.525	73.287	149.812
1860	74.368	70.300	144.668
1861	75.674	71.579	147.253
1862	74.868	70.700	145.568
1863	79.824	75.740	155.564
1864	80.022	75.850	155.872
1865	79.942	76.381	156.323
1866	80.622	77.388	158.010
1867	80.079	75.519	155.598
1868	79.212	75.573	154.785
1869	80.626	76.668	157.294
1870	83.551	79.387	162.938
1871	80.407	76.876	157.283
1872	85.053	81.021	166.074
1873	86.399	82.883	169.282
1874	88.536	84.016	172.552
1875	89.008	85.047	174.055
1876	89.652	85.757	175.409
1877	88.904	84.792	173.696
1878	87.472	83.811	171.283
1879	88.631	84.691	173.322
1880	87.221	83.496	170.717
1881	88.759	85.470	174.229
1882	90.127	85.212	175.339
1883	88.709	84.802	173.511
1884	90.030	85.809	175.839
1885	88.697	85.119	173.816
1886	88.762	85.228	173.990
1887	89.475	85.302	174.777
1888	88.936	85.883	174.819
1889	90.411	86.315	176.726
1890	90.004	86.195	176.199
1891	92.725	88.227	180.952
1892	90.252	86.411	176.663
1893	93.226	89.120	182.346
1894	92.575	88.030	180.605
1895	93.125	89.372	182.497
1896	95.987	91.869	187.856
1897	97.175	92.845	190.020
1898	97.321	92.787	190.108
1899	98.577	94.711	193.288
1900	99.026	94.204	193.230
1901	101.851	97.217	199.068
1902	99.958	95.118	195.076
1903	97.875	93.688	191.563
1904	97.927	93.140	191.067
1905	95.149	91.516	186.665
1906	94.551	90.957	185.508
1907	93.999	90.372	184.371
1908	93.297	89.749	183.046
1909	89.901	85.813	175.714
1910	89.742	86.026	175.768
1911	87.096	83.933	171.029
1912	86.863	83.602	170.465
1913	86.718	83.384	170.102
1914	80.020	76.369	156.389
1915	63.483	60.808	124.291
1916	51.289	48.071	99.360
1917	44.071	42.604	86.675
1918	43.654	41.402	85.056
1919	66.115	62.121	128.236
1920	84.518	79.739	164.257
1921	83.395	79.006	162.401
1922	78.307	74.472	152.779
1923	80.049	75.956	156.005
1924	78.346	75.041	153.387
1925	78.317	74.873	153.190
1926	75.918	72.922	148.840
1927	73.739	70.472	144.211
1928	74.530	71.423	145.953
1929	74.179	71.363	145.542
1930	76.974	73.297	150.271
1931	75.408	72.081	147.489
1932	73.336	70.488	143.824
1933	69.210	65.544	134.754
1934	67.286	64.450	131.736
1935	64.606	61.698	126.304
1936	64.159	61.352	125.511
1937	64.423	61.072	125.495
1938	66.411	63.722	130.133
1939	64.270	61.987	126.257
1940	56.521	53.802	110.323
1941	50.599	47.818	98.417
1942	54.751	50.998	105.749
1943	62.227	58.438	120.665
1944	63.932	60.143	124.075
1945	65.391	61.854	127.245
1946	75.744	70.987	146.731
1947	74.590	70.389	144.979
1948	76.035	72.175	148.210
1949	74.427	70.243	144.670
1950	73.354	69.616	142.970
1951	73.081	69.443	142.524
1952	75.309	70.833	146.142
1953	75.463	71.059	146.522
1954	75.910	72.218	148.128
1955	76.151	72.647	148.798
1956	76.882	73.299	150.181
1957	78.632	73.756	152.388
1958	80.137	75.557	155.694
1959	82.490	78.172	160.662
1960	79.896	75.624	155.520
1961	81.303	76.959	158.262
1962	79.344	74.994	154.338
1963	81.355	76.841	158.196
1964	82.328	78.043	160.371
1965	79.669	75.187	154.856
1966	77.249	73.387	150.636
1967	75.101	70.798	145.899
1968	72.520	68.722	141.242
1969	72.438	68.396	140.834
1970	72.653	68.466	141.119
1971	71.429	67.675	139.104
1972	69.189	65.248	134.437
1973	66.451	62.974	129.425
1974	63.354	59.801	123.155
1975	61.379	57.894	119.273
1976	61.880	58.592	120.472
1977	62.274	59.249	121.523
1978	62.429	59.554	121.983
1979	63.905	59.753	123.658
1980	63.917	60.877	124.794
1981	64.295	60.532	124.827
1982	61.930	58.452	120.382
1983	60.440	56.955	117.395
1984	59.353	56.437	115.790
1985	58.695	55.588	114.283
1986	60.569	56.702	117.271
1987	60.386	57.062	117.448
1988	60.938	57.826	118.764
1989	61.795	58.755	120.550
1990	63.304	60.250	123.554
1991	64.270	61.142	125.412
1992	63.492	60.690	124.182
1993	61.333	58.495	119.828
1994	59.341	56.020	115.361
1995	58.412	55.814	114.226
1996	58.725	56.489	115.214
1997	59.277	56.587	115.864
1998	58.562	55.714	114.276
1999	57.858	55.611	113.469
2000	58.790	56.093	114.883
2001	58.243	55.929	114.172
2002	57.044	54.181	111.225
2003	57.339	54.810	112.149
2004	59.429	56.189	115.618
2005	60.575	57.427	118.002
2006	61.950	59.432	121.382
2007	61.712	58.951	120.663
2008	65.731	62.318	128.049
2009	65.197	62.100	127.297




Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time3 seconds
R Server'Sir Ronald Aylmer Fisher' @ fisher.wessa.net

\begin{tabular}{lllllllll}
\hline
Summary of computational transaction \tabularnewline
Raw Input & view raw input (R code)  \tabularnewline
Raw Output & view raw output of R engine  \tabularnewline
Computing time & 3 seconds \tabularnewline
R Server & 'Sir Ronald Aylmer Fisher' @ fisher.wessa.net \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=190221&T=0

[TABLE]
[ROW][C]Summary of computational transaction[/C][/ROW]
[ROW][C]Raw Input[/C][C]view raw input (R code) [/C][/ROW]
[ROW][C]Raw Output[/C][C]view raw output of R engine [/C][/ROW]
[ROW][C]Computing time[/C][C]3 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]'Sir Ronald Aylmer Fisher' @ fisher.wessa.net[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=190221&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=190221&T=0

As an alternative you can also use a QR Code:  

The GUIDs for individual cells are displayed in the table below:

Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time3 seconds
R Server'Sir Ronald Aylmer Fisher' @ fisher.wessa.net



Parameters (Session):
par1 = 1 ; par2 = Do not include Seasonal Dummies ; par3 = No Linear Trend ;
Parameters (R input):
par1 = 1 ; par2 = Do not include Seasonal Dummies ; par3 = No Linear Trend ;
R code (references can be found in the software module):
library(lattice)
library(lmtest)
n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
par1 <- as.numeric(par1)
x <- t(y)
k <- length(x[1,])
n <- length(x[,1])
x1 <- cbind(x[,par1], x[,1:k!=par1])
mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
colnames(x1) <- mycolnames #colnames(x)[par1]
x <- x1
if (par3 == 'First Differences'){
x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
for (i in 1:n-1) {
for (j in 1:k) {
x2[i,j] <- x[i+1,j] - x[i,j]
}
}
x <- x2
}
if (par2 == 'Include Monthly Dummies'){
x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
for (i in 1:11){
x2[seq(i,n,12),i] <- 1
}
x <- cbind(x, x2)
}
if (par2 == 'Include Quarterly Dummies'){
x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
for (i in 1:3){
x2[seq(i,n,4),i] <- 1
}
x <- cbind(x, x2)
}
k <- length(x[1,])
if (par3 == 'Linear Trend'){
x <- cbind(x, c(1:n))
colnames(x)[k+1] <- 't'
}
x
k <- length(x[1,])
df <- as.data.frame(x)
(mylm <- lm(df))
(mysum <- summary(mylm))
if (n > n25) {
kp3 <- k + 3
nmkm3 <- n - k - 3
gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
numgqtests <- 0
numsignificant1 <- 0
numsignificant5 <- 0
numsignificant10 <- 0
for (mypoint in kp3:nmkm3) {
j <- 0
numgqtests <- numgqtests + 1
for (myalt in c('greater', 'two.sided', 'less')) {
j <- j + 1
gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
}
if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
}
gqarr
}
bitmap(file='test0.png')
plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
points(x[,1]-mysum$resid)
grid()
dev.off()
bitmap(file='test1.png')
plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
grid()
dev.off()
bitmap(file='test2.png')
hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
grid()
dev.off()
bitmap(file='test3.png')
densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
dev.off()
bitmap(file='test4.png')
qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
qqline(mysum$resid)
grid()
dev.off()
(myerror <- as.ts(mysum$resid))
bitmap(file='test5.png')
dum <- cbind(lag(myerror,k=1),myerror)
dum
dum1 <- dum[2:length(myerror),]
dum1
z <- as.data.frame(dum1)
z
plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals')
lines(lowess(z))
abline(lm(z))
grid()
dev.off()
bitmap(file='test6.png')
acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
grid()
dev.off()
bitmap(file='test7.png')
pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
grid()
dev.off()
bitmap(file='test8.png')
opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
plot(mylm, las = 1, sub='Residual Diagnostics')
par(opar)
dev.off()
if (n > n25) {
bitmap(file='test9.png')
plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
grid()
dev.off()
}
load(file='createtable')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
a<-table.row.end(a)
myeq <- colnames(x)[1]
myeq <- paste(myeq, '[t] = ', sep='')
for (i in 1:k){
if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
if (rownames(mysum$coefficients)[i] != '(Intercept)') {
myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
}
}
myeq <- paste(myeq, ' + e[t]')
a<-table.row.start(a)
a<-table.element(a, myeq)
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file='mytable1.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,hyperlink('ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Variable',header=TRUE)
a<-table.element(a,'Parameter',header=TRUE)
a<-table.element(a,'S.D.',header=TRUE)
a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE)
a<-table.element(a,'2-tail p-value',header=TRUE)
a<-table.element(a,'1-tail p-value',header=TRUE)
a<-table.row.end(a)
for (i in 1:k){
a<-table.row.start(a)
a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE)
a<-table.element(a,mysum$coefficients[i,1])
a<-table.element(a, round(mysum$coefficients[i,2],6))
a<-table.element(a, round(mysum$coefficients[i,3],4))
a<-table.element(a, round(mysum$coefficients[i,4],6))
a<-table.element(a, round(mysum$coefficients[i,4]/2,6))
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable2.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'Multiple R',1,TRUE)
a<-table.element(a, sqrt(mysum$r.squared))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'R-squared',1,TRUE)
a<-table.element(a, mysum$r.squared)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'Adjusted R-squared',1,TRUE)
a<-table.element(a, mysum$adj.r.squared)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'F-TEST (value)',1,TRUE)
a<-table.element(a, mysum$fstatistic[1])
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
a<-table.element(a, mysum$fstatistic[2])
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
a<-table.element(a, mysum$fstatistic[3])
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'p-value',1,TRUE)
a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'Residual Standard Deviation',1,TRUE)
a<-table.element(a, mysum$sigma)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
a<-table.element(a, sum(myerror*myerror))
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file='mytable3.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a, 'Time or Index', 1, TRUE)
a<-table.element(a, 'Actuals', 1, TRUE)
a<-table.element(a, 'Interpolation
Forecast', 1, TRUE)
a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE)
a<-table.row.end(a)
for (i in 1:n) {
a<-table.row.start(a)
a<-table.element(a,i, 1, TRUE)
a<-table.element(a,x[i])
a<-table.element(a,x[i]-mysum$resid[i])
a<-table.element(a,mysum$resid[i])
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable4.tab')
if (n > n25) {
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'p-values',header=TRUE)
a<-table.element(a,'Alternative Hypothesis',3,header=TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'breakpoint index',header=TRUE)
a<-table.element(a,'greater',header=TRUE)
a<-table.element(a,'2-sided',header=TRUE)
a<-table.element(a,'less',header=TRUE)
a<-table.row.end(a)
for (mypoint in kp3:nmkm3) {
a<-table.row.start(a)
a<-table.element(a,mypoint,header=TRUE)
a<-table.element(a,gqarr[mypoint-kp3+1,1])
a<-table.element(a,gqarr[mypoint-kp3+1,2])
a<-table.element(a,gqarr[mypoint-kp3+1,3])
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable5.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Description',header=TRUE)
a<-table.element(a,'# significant tests',header=TRUE)
a<-table.element(a,'% significant tests',header=TRUE)
a<-table.element(a,'OK/NOK',header=TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'1% type I error level',header=TRUE)
a<-table.element(a,numsignificant1)
a<-table.element(a,numsignificant1/numgqtests)
if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK'
a<-table.element(a,dum)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'5% type I error level',header=TRUE)
a<-table.element(a,numsignificant5)
a<-table.element(a,numsignificant5/numgqtests)
if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK'
a<-table.element(a,dum)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'10% type I error level',header=TRUE)
a<-table.element(a,numsignificant10)
a<-table.element(a,numsignificant10/numgqtests)
if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK'
a<-table.element(a,dum)
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file='mytable6.tab')
}