Home » date » 2007 » Dec » 18 » attachments

Multiple regression

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Tue, 18 Dec 2007 11:50:35 -0700
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2.htm/, Retrieved Tue, 18 Dec 2007 19:35:02 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
106,0 100,9 114,3 101,2 109,2 111,6 91,7 93,7 105,7 109,5 105,3 102,8 100,6 97,6 110,3 107,2 107,2 108,1 97,1 92,2 112,2 111,6 115,7 111,3 104,2 103,2 112,7 106,4 102,6 110,6 95,2 89,0 112,5 116,8 107,2 113,6 101,8 102,6 122,7 110,3 110,5 121,6 100,3 100,7 123,4 127,1 124,1 131,2 111,6 114,2 130,1 125,9 119,0 133,8 107,5 113,5 134,4 126,8 135,6 139,9 129,8 131,0 153,1 134,1 144,1 155,9 123,3 128,1 144,3 153,0 149,9 150,9 141,0 138,9 157,4 142,9 151,7 161,0 138,6 136,0 151,9
 
Text written by user:
 
Output produced by software:

Enter (or paste) a matrix (table) containing all data (time) series. Every column represents a different variable and must be delimited by a space or Tab. Every row represents a period in time (or category) and must be delimited by hard returns. The easiest way to enter data is to copy and paste a block of spreadsheet cells. Please, do not use commas or spaces to seperate groups of digits!


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


Multiple Linear Regression - Estimated Regression Equation
x[t] = + 97.4816091954023 -8.10852490421458M1[t] -9.7053913519431M2[t] + 5.66917077175697M3[t] -5.35626710454297M4[t] -3.68170498084293M5[t] + 3.99285714285713M6[t] -17.9325807334428M7[t] -18.6580186097428M8[t] -0.569170771756992M9[t] + 0.491351943076064M10[t] -1.32932402846197M11[t] + 0.654009304871374t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)97.48160919540233.26291529.875600
M1-8.108524904214583.994623-2.02990.0462860.023143
M2-9.70539135194313.993301-2.43040.0177250.008863
M35.669170771756973.9922731.420.1601660.080083
M4-5.356267104542973.991538-1.34190.184090.092045
M5-3.681704980842933.991096-0.92250.359540.17977
M63.992857142857133.9909491.00050.3206260.160313
M7-17.93258073344283.991096-4.49312.8e-051.4e-05
M8-18.65801860974283.991538-4.67441.4e-057e-06
M9-0.5691707717569923.992273-0.14260.8870530.443526
M100.4913519430760644.1421710.11860.9059250.452962
M11-1.329324028461974.141746-0.3210.7492270.374614
t0.6540093048713740.03425719.09100


Multiple Linear Regression - Regression Statistics
Multiple R0.932272717360232
R-squared0.86913241953423
Adjusted R-squared0.846038140628507
F-TEST (value)37.634100769382
F-TEST (DF numerator)12
F-TEST (DF denominator)68
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation7.17346853859014
Sum Squared Residuals3499.1882594417


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
110690.027093596059315.9729064039407
2100.989.08423645320211.8157635467980
3114.3105.1128078817739.18719211822658
4101.294.74137931034486.45862068965518
5109.297.069950738916312.1300492610837
6111.6105.3985221674886.20147783251231
791.784.12709359605917.5729064039409
893.784.05566502463059.64433497536948
9105.7102.7985221674882.90147783251233
10109.5104.5130541871924.9869458128079
11105.3103.3463875205251.95361247947456
12102.8105.329720853859-2.52972085385879
13100.697.87520525451562.72479474548442
1497.696.93234811165840.667651888341568
15110.3112.960919540230-2.66091954022987
16107.2102.5894909688014.6105090311987
17107.2104.9180623973732.28193760262728
18108.1113.246633825944-5.14663382594417
1997.191.97520525451565.12479474548441
2092.291.9037766830870.296223316912988
21112.2110.6466338259441.55336617405584
22111.6112.361165845649-0.761165845648604
23115.7111.1944991789824.50550082101807
24111.3113.177832512315-1.87783251231528
25104.2105.723316912972-1.52331691297203
26103.2104.780459770115-1.58045977011492
27112.7120.809031198686-8.10903119868635
28106.4110.437602627258-4.03760262725778
29102.6112.766174055829-10.1661740558292
30110.6121.094745484401-10.4947454844007
3195.299.823316912972-4.62331691297207
328999.7518883415435-10.7518883415435
33112.5118.494745484401-5.99474548440066
34116.8120.209277504105-3.40927750410509
35107.2119.042610837438-11.8426108374384
36113.6121.025944170772-7.42594417077177
37101.8113.571428571429-11.7714285714285
38102.6112.628571428571-10.0285714285714
39122.7128.657142857143-5.95714285714286
40110.3118.285714285714-7.9857142857143
41110.5120.614285714286-10.1142857142857
42121.6128.942857142857-7.34285714285715
43100.3107.671428571429-7.37142857142857
44100.7107.6-6.9
45123.4126.342857142857-2.94285714285714
46127.1128.057389162562-0.957389162561581
47124.1126.890722495895-2.79072249589492
48131.2128.8740558292282.32594417077173
49111.6121.419540229885-9.81954022988503
50114.2120.476683087028-6.2766830870279
51130.1136.505254515599-6.40525451559935
52125.9126.133825944171-0.233825944170769
53119128.462397372742-9.4623973727422
54133.8136.790968801314-2.99096880131362
55107.5115.519540229885-8.01954022988506
56113.5115.448111658456-1.94811165845649
57134.4134.1909688013140.209031198686370
58126.8135.905500821018-9.10550082101806
59135.6134.7388341543510.861165845648596
60139.9136.7221674876853.17783251231526
61129.8129.2676518883420.532348111658499
62131128.3247947454842.67520525451561
63153.1144.3533661740568.74663382594417
64134.1133.9819376026270.118062397372728
65144.1136.3105090311997.78949096880131
66155.9144.63908045977011.2609195402299
67123.3123.367651888342-0.0676518883415553
68128.1123.2962233169134.80377668308701
69144.3142.0390804597702.26091954022989
70153143.7536124794759.24638752052545
71149.9142.5869458128087.31305418719211
72150.9144.5702791461416.32972085385876
73141137.1157635467983.884236453202
74138.9136.1729064039412.72709359605912
75157.4152.2014778325125.19852216748769
76142.9141.8300492610841.06995073891625
77151.7144.1586206896557.54137931034482
78161152.4871921182278.51280788177339
79138.6131.2157635467987.38423645320195
80136131.1443349753694.85566502463053
81151.9149.8871921182272.01280788177338
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/1urv61198003828.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/1urv61198003828.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/2je3t1198003828.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/2je3t1198003828.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/3m0001198003828.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/3m0001198003828.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/42mov1198003828.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/42mov1198003828.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/54jml1198003828.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/54jml1198003828.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/674r41198003828.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/674r41198003828.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/74zni1198003828.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/74zni1198003828.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/8f73u1198003828.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/8f73u1198003828.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/9d0871198003828.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/18/t1198002891ae2sd5ov0eg0gg2/9d0871198003828.ps (open in new window)


 
Parameters (Session):
 
Parameters (R input):
par1 = 1 ; par2 = Include Monthly Dummies ; par3 = Linear Trend ;
 
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('http://www.xycoon.com/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<br />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<br />Forecast', 1, TRUE)
a<-table.element(a, 'Residuals<br />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')
 





Copyright

Creative Commons License

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.

Software written by Ed van Stee & Patrick Wessa


Disclaimer

Information provided on this web site is provided "AS IS" without warranty of any kind, either express or implied, including, without limitation, warranties of merchantability, fitness for a particular purpose, and noninfringement. We use reasonable efforts to include accurate and timely information and periodically update the information, and software without notice. However, we make no warranties or representations as to the accuracy or completeness of such information (or software), and we assume no liability or responsibility for errors or omissions in the content of this web site, or any software bugs in online applications. Your use of this web site is AT YOUR OWN RISK. Under no circumstances and under no legal theory shall we be liable to you or any other person for any direct, indirect, special, incidental, exemplary, or consequential damages arising from your access to, or use of, this web site.


Privacy Policy

We may request personal information to be submitted to our servers in order to be able to:

We NEVER allow other companies to directly offer registered users information about their products and services. Banner references and hyperlinks of third parties NEVER contain any personal data of the visitor.

We do NOT sell, nor transmit by any means, personal information, nor statistical data series uploaded by you to third parties.

We carefully protect your data from loss, misuse, alteration, and destruction. However, at any time, and under any circumstance you are solely responsible for managing your passwords, and keeping them secret.

We store a unique ANONYMOUS USER ID in the form of a small 'Cookie' on your computer. This allows us to track your progress when using this website which is necessary to create state-dependent features. The cookie is used for NO OTHER PURPOSE. At any time you may opt to disallow cookies from this website - this will not affect other features of this website.

We examine cookies that are used by third-parties (banner and online ads) very closely: abuse from third-parties automatically results in termination of the advertising contract without refund. We have very good reason to believe that the cookies that are produced by third parties (banner ads) do NOT cause any privacy or security risk.

FreeStatistics.org is safe. There is no need to download any software to use the applications and services contained in this website. Hence, your system's security is not compromised by their use, and your personal data - other than data you submit in the account application form, and the user-agent information that is transmitted by your browser - is never transmitted to our servers.

As a general rule, we do not log on-line behavior of individuals (other than normal logging of webserver 'hits'). However, in cases of abuse, hacking, unauthorized access, Denial of Service attacks, illegal copying, hotlinking, non-compliance with international webstandards (such as robots.txt), or any other harmful behavior, our system engineers are empowered to log, track, identify, publish, and ban misbehaving individuals - even if this leads to ban entire blocks of IP addresses, or disclosing user's identity.


FreeStatistics.org is powered by