Home » date » 2007 » Nov » 19 » attachments

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Mon, 19 Nov 2007 16:01:19 -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/Nov/19/t1195512847yefglvh101me9d4.htm/, Retrieved Mon, 19 Nov 2007 23:54:17 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
99.5 0 101.6 0 103.9 0 106.6 0 108.3 0 102 0 93.8 0 91.6 0 97.7 0 94.8 0 98 0 103.8 0 97.8 0 91.2 0 89.3 0 87.5 0 90.4 0 94.2 0 102.2 0 101.3 0 96 0 90.8 0 93.2 0 90.9 0 91.1 0 90.2 0 94.3 0 96 0 99 0 103.3 0 113.1 0 112.8 0 112.1 0 107.4 0 111 0 110.5 0 110.8 0 112.4 0 111.5 0 116.2 0 122.5 0 121.3 0 113.9 0 110.7 0 120.8 0 141.1 1 147.4 1 148 1 158.1 1 165 1 187 1 190.3 1 182.4 1 168.8 1 151.2 1 120.1 1 112.5 1 106.2 1 107.1 1 108.5 1 106.5 1 108.3 1 125.6 1 124 1 127.2 1 136.9 1 135.8 1 124.3 1 115.4 1 113.6 1 114.4 1 118.4 1 117 1 116.5 1 115.4 1 113.6 1 117.4 1 116.9 1 116.4 1 111.1 1 110.2 1 118.9 1 131.8 1 130.6 1 138.3 1 148.4 1 148.7 1 144.3 1 152.5 1 162.9 1 167.2 1 166.5 1 185.6 1
 
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
Y[t] = + 96.973721340388 + 32.970987654321x[t] + 1.42828483245152M1[t] + 3.24078483245151M2[t] + 8.5032848324515M3[t] + 8.8532848324515M4[t] + 11.5032848324515M5[t] + 12.3282848324515M6[t] + 10.7407848324515M7[t] + 3.8407848324515M8[t] + 5.3282848324515M9[t] -5.41428571428571M10[t] -1.11428571428571M11[t] + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)96.9737213403887.58910412.77800
x32.9709876543213.9817928.280400
M11.428284832451529.9178450.1440.8858530.442927
M23.240784832451519.9178450.32680.7447010.37235
M38.50328483245159.9178450.85740.39380.1969
M48.85328483245159.9178450.89270.3747150.187358
M511.50328483245159.9178451.15990.2495570.124778
M612.32828483245159.9178451.2430.2174840.108742
M710.74078483245159.9178451.0830.2820730.141036
M83.84078483245159.9178450.38730.6995920.349796
M95.32828483245159.9178450.53720.5925920.296296
M10-5.4142857142857110.238894-0.52880.5984110.299206
M11-1.1142857142857110.238894-0.10880.9136110.456805


Multiple Linear Regression - Regression Statistics
Multiple R0.692865273240383
R-squared0.480062286862471
Adjusted R-squared0.402071629891841
F-TEST (value)6.15538200996637
F-TEST (DF numerator)12
F-TEST (DF denominator)80
p-value1.55241826504948e-07
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation19.1552161462791
Sum Squared Residuals29353.7844488536


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
199.598.40200617283941.09799382716060
2101.6100.2145061728401.38549382716049
3103.9105.477006172840-1.57700617283952
4106.6105.8270061728400.772993827160461
5108.3108.477006172840-0.177006172839517
6102109.302006172840-7.30200617283952
793.8107.714506172840-13.9145061728395
891.6100.814506172840-9.2145061728395
997.7102.302006172839-4.60200617283947
1094.891.55943562610233.2405643738977
119895.85943562610232.14056437389770
12103.896.9737213403886.826278659612
1397.898.4020061728395-0.602006172839525
1491.2100.214506172840-9.0145061728395
1589.3105.477006172840-16.1770061728395
1687.5105.827006172840-18.3270061728395
1790.4108.477006172840-18.0770061728395
1894.2109.302006172840-15.1020061728395
19102.2107.714506172840-5.5145061728395
20101.3100.8145061728400.485493827160489
2196102.302006172839-6.3020061728395
2290.891.5594356261023-0.7594356261023
2393.295.8594356261023-2.65943562610230
2490.996.973721340388-6.073721340388
2591.198.4020061728395-7.30200617283953
2690.2100.214506172840-10.0145061728395
2794.3105.477006172840-11.1770061728395
2896105.827006172840-9.8270061728395
2999108.477006172840-9.4770061728395
30103.3109.302006172840-6.00200617283951
31113.1107.7145061728405.38549382716049
32112.8100.81450617284011.9854938271605
33112.1102.3020061728409.79799382716049
34107.491.559435626102315.8405643738977
3511195.859435626102315.1405643738977
36110.596.97372134038813.526278659612
37110.898.402006172839512.3979938271605
38112.4100.21450617284012.1854938271605
39111.5105.4770061728406.0229938271605
40116.2105.82700617284010.3729938271605
41122.5108.47700617284014.0229938271605
42121.3109.30200617284011.9979938271605
43113.9107.7145061728406.1854938271605
44110.7100.8145061728409.8854938271605
45120.8102.30200617284018.4979938271605
46141.1124.53042328042316.5695767195767
47147.4128.83042328042318.5695767195767
48148129.94470899470918.055291005291
49158.1131.37299382716026.7270061728395
50165133.18549382716031.8145061728395
51187138.44799382716048.5520061728395
52190.3138.79799382716051.5020061728395
53182.4141.44799382716040.9520061728395
54168.8142.27299382716026.5270061728395
55151.2140.68549382716010.5145061728395
56120.1133.785493827161-13.6854938271605
57112.5135.272993827160-22.7729938271605
58106.2124.530423280423-18.3304232804233
59107.1128.830423280423-21.7304232804233
60108.5129.944708994709-21.444708994709
61106.5131.372993827160-24.8729938271605
62108.3133.185493827160-24.8854938271605
63125.6138.447993827161-12.8479938271605
64124138.797993827160-14.7979938271605
65127.2141.447993827161-14.2479938271605
66136.9142.272993827160-5.37299382716049
67135.8140.685493827160-4.88549382716048
68124.3133.785493827161-9.4854938271605
69115.4135.272993827160-19.8729938271605
70113.6124.530423280423-10.9304232804233
71114.4128.830423280423-14.4304232804233
72118.4129.944708994709-11.544708994709
73117131.372993827161-14.3729938271605
74116.5133.185493827160-16.6854938271605
75115.4138.447993827161-23.0479938271605
76113.6138.797993827160-25.1979938271605
77117.4141.447993827161-24.0479938271605
78116.9142.272993827160-25.3729938271605
79116.4140.685493827160-24.2854938271605
80111.1133.785493827161-22.6854938271605
81110.2135.272993827160-25.0729938271605
82118.9124.530423280423-5.63042328042328
83131.8128.8304232804232.96957671957673
84130.6129.9447089947090.655291005291001
85138.3131.3729938271616.92700617283950
86148.4133.18549382716015.2145061728395
87148.7138.44799382716110.2520061728395
88144.3138.7979938271605.50200617283952
89152.5141.44799382716111.0520061728395
90162.9142.27299382716020.6270061728395
91167.2140.68549382716026.5145061728395
92166.5133.78549382716132.7145061728395
93185.6135.27299382716150.3270061728395
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/1t1cp1195513274.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/1t1cp1195513274.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/2dh641195513274.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/2dh641195513274.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/32sa81195513274.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/32sa81195513274.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/4wyob1195513274.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/4wyob1195513274.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/5q11k1195513274.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/5q11k1195513274.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/6rhgl1195513274.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/6rhgl1195513274.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/7gm061195513274.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/7gm061195513274.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/8v0en1195513274.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/8v0en1195513274.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/99cx31195513274.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195512847yefglvh101me9d4/99cx31195513274.ps (open in new window)


 
Parameters:
par1 = 1 ; par2 = Include Monthly Dummies ; par3 = No 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