Free Statistics

of Irreproducible Research!

Author's title

Author*Unverified author*
R Software Modulerwasp_multipleregression.wasp
Title produced by softwareMultiple Regression
Date of computationThu, 22 Nov 2007 08:18:23 -0700
Cite this page as followsStatistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?v=date/2007/Nov/22/t11957442719umosfoks13dfyu.htm/, Retrieved Fri, 03 May 2024 01:05:23 +0000
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL https://freestatistics.org/blog/index.php?pk=6046, Retrieved Fri, 03 May 2024 01:05:23 +0000
QR Codes:

Original text written by user:
IsPrivate?No (this computation is public)
User-defined keywordsSeatbelt Law
Estimated Impact195
Family? (F = Feedback message, R = changed R code, M = changed R Module, P = changed Parameters, D = changed Data)
-       [Multiple Regression] [Case III Question...] [2007-11-22 15:18:23] [fd802f308f037a9692de8c23f8b60e49] [Current]
Feedback Forum

Post a new message
Dataseries X:
1687	0			-183,9235445
1508	0			-177,0726091
1507	0			-228,6351091
1385	0			-237,4476091
1632	0			-127,7601091
1511	0			-193,0101091
1559	0			-220,6351091
1630	0			-164,5101091
1579	0			-268,3226091
1653	0			-333,6976091
2152	0			-34,26010911
2148	0			-154,8851091
1752	0			-97,74528053
1765	0			101,1056549
1717	0			2,543154874
1558	0			-43,26934513
1575	0			-163,5818451
1520	0			-162,8318451
1805	0			46,54315487
1800	0			26,66815487
1719	0			-107,1443451
2008	0			42,48065487
2242	0			76,91815487
2478	0			196,2931549
2030	0			201,4329835
1655	0			12,28391886
1693	0			-0,278581137
1623	0			42,90891886
1805	0			87,59641886
1746	0			84,34641886
1795	0			57,72141886
1926	0			173,8464189
1619	0			-185,9660811
1992	0			47,65891886
2233	0			89,09641886
2192	0			-68,52858114
2080	0			272,6112475
1768	0			146,4621829
1835	0			162,8996829
1569	0			10,08718285
1976	0			279,7746829
1853	0			212,5246829
1965	0			248,8996829
1689	0			-41,97531715
1778	0			-5,787817149
1976	0			52,83718285
2397	0			274,2746829
2654	0			414,6496829
2097	0			310,7895114
1963	0			362,6404468
1677	0			26,07794684
1941	0			403,2654468
2003	0			327,9529468
1813	0			193,7029468
2012	0			317,0779468
1912	0			202,2029468
2084	0			321,3904468
2080	0			178,0154468
2118	0			16,45294684
2150	0			-68,17205316
1608	0			-157,0322246
1503	0			-76,18128917
1548	0			-81,74378917
1382	0			-134,5562892
1731	0			77,13121083
1798	0			199,8812108
1779	0			105,2562108
1887	0			198,3812108
2004	0			262,5687108
2077	0			196,1937108
2092	0			11,63121083
2051	0			-145,9937892
1577	0			-166,8539606
1356	0			-202,0030252
1652	0			43,43447482
1382	0			-113,3780252
1519	0			-113,6905252
1421	0			-155,9405252
1442	0			-210,5655252
1543	0			-124,4405252
1656	0			-64,25302518
1561	0			-298,6280252
1905	0			-154,1905252
2199	0			23,18447482
1473	0			-249,6756966
1655	0			118,1752388
1407	0			-180,3872612
1395	0			-79,19976119
1530	0			-81,51226119
1309	0			-246,7622612
1526	0			-105,3872612
1327	0			-319,2622612
1627	0			-72,07476119
1748	0			-90,44976119
1958	0			-80,01226119
2274	0			119,3627388
1648	0			-53,49743261
1401	0			-114,6464972
1411	0			-155,2089972
1403	0			-50,02149721
1394	0			-196,3339972
1520	0			-14,58399721
1528	0			-82,20899721
1643	0			17,91600279
1515	0			-162,8964972
1685	0			-132,2714972
2000	0			-16,83399721
2215	0			81,54100279
1956	0			275,6808314
1462	0			-32,46823322
1563	0			17,96926678
1459	0			27,15676678
1446	0			-123,1557332
1622	0			108,5942668
1657	0			67,96926678
1638	0			34,09426678
1643	0			-13,71823322
1683	0			-113,0932332
2050	0			54,34426678
2262	0			149,7192668
1813	0			153,8590954
1445	0			-28,28996923
1762	0			238,1475308
1461	0			50,33503077
1556	0			8,022530771
1431	0			-61,22746923
1427	0			-140,8524692
1554	0			-28,72746923
1645	0			9,460030771
1653	0			-121,9149692
2016	0			41,52253077
2207	0			115,8975308
1665	0			27,03735936
1361	0			-91,11170524
1506	0			3,325794759
1360	0			-29,48670524
1453	0			-73,79920524
1522	0			50,95079476
1460	0			-86,67420524
1552	0			-9,54920524
1548	0			-66,36170524
1827	0			73,26329476
1737	0			-216,2992052
1941	0			-128,9242052
1474	0			-142,7843767
1458	0			27,06655875
1542	0			60,50405875
1404	0			35,69155875
1522	0			16,37905875
1385	0			-64,87094125
1641	0			115,5040587
1510	0			-30,37094125
1681	0			87,81655875
1938	0			205,4415587
1868	0			-64,12094125
1726	0			-322,7459413
1456	0			-139,6061127
1445	0			35,24482274
1456	0			-4,317677263
1365	0			17,86982274
1487	0			2,557322737
1558	0			129,3073227
1488	0			-16,31767726
1684	0			164,8073227
1594	0			21,99482274
1850	0			138,6198227
1998	0			87,05732274
2079	0			51,43232274
1494	0			-80,42784867
1057	1			-105,1918797
1218	1			5,245620328
1168	1			68,43312033
1236	1			-0,879379672
1076	1			-105,1293797
1174	1			-82,75437967
1139	1			-132,6293797
1427	1			102,5581203
1487	1			23,18312033
1483	1			-180,3793797
1513	1			-267,0043797
1357	1			30,13544892
1165	1			23,98638432
1282	1			90,42388432
1110	1			31,61138432
1297	1			81,29888432
1185	1			25,04888432
1222	1			-13,57611568
1284	1			33,54888432
1444	1			140,7363843
1575	1			132,3613843
1737	1			94,79888432
1763	1			4,173884316




Summary of compuational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time1 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135

\begin{tabular}{lllllllll}
\hline
Summary of compuational transaction \tabularnewline
Raw Input & view raw input (R code)  \tabularnewline
Raw Output & view raw output of R engine  \tabularnewline
Computing time & 1 seconds \tabularnewline
R Server & 'Gwilym Jenkins' @ 72.249.127.135 \tabularnewline
\hline
\end{tabular}
%Source: https://freestatistics.org/blog/index.php?pk=6046&T=0

[TABLE]
[ROW][C]Summary of compuational 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]1 seconds[/C][/ROW]
[ROW][C]R Server[/C][C]'Gwilym Jenkins' @ 72.249.127.135[/C][/ROW]
[/TABLE]
Source: https://freestatistics.org/blog/index.php?pk=6046&T=0

Globally Unique Identifier (entire table): ba.freestatistics.org/blog/index.php?pk=6046&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 compuational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time1 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135



Parameters (Session):
par1 = 1 ; par2 = Include Monthly Dummies ; par3 = First Differences ;
Parameters (R input):
par1 = 1 ; par2 = Include Monthly Dummies ; par3 = First Differences ;
R code (references can be found in the software module):
library(lattice)
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))
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')
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()
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')