Home » date » 2008 » Jan » 09 » attachments

paper_multipleregression_2dummies

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Wed, 09 Jan 2008 06:25:32 -0700
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs.htm/, Retrieved Wed, 09 Jan 2008 14:25:03 +0100
 
User-defined keywords:
s0650921, s0650125
 
Dataseries X:
» Textbox « » Textfile « » CSV «
102.7 0 0 103.2 0 0 105.6 0 0 103.9 0 0 107.2 0 0 100.7 0 0 92.1 0 0 90.3 0 0 93.4 0 0 98.5 0 0 100.8 0 0 102.3 0 0 104.7 0 0 101.1 0 0 101.4 0 0 99.5 0 0 98.4 0 0 96.3 0 0 100.7 0 0 101.2 0 0 100.3 0 0 97.8 0 0 97.4 0 0 98.6 0 0 99.7 0 0 99.0 0 0 98.1 0 0 97.0 0 0 98.5 0 0 103.8 0 0 114.4 0 0 124.5 0 0 134.2 0 0 131.8 0 0 125.6 0 0 119.9 0 0 114.9 0 0 115.5 0 0 112.5 0 0 111.4 0 0 115.3 0 0 110.8 0 0 103.7 0 0 111.1 0 1 113.0 0 1 111.2 0 1 117.6 0 1 121.7 0 1 127.3 0 1 129.8 0 1 137.1 0 1 141.4 0 1 137.4 0 1 130.7 0 1 117.2 0 1 110.8 0 -1 111.4 0 -1 108.2 0 -1 108.8 0 -1 110.2 0 -1 109.5 0 -1 109.5 0 -1 116.0 0 -1 111.2 0 -1 112.1 0 -1 114.0 0 -1 119.1 0 -1 114.1 1 -1 115.1 1 -1 115.4 1 -1 110.8 1 0 116.0 1 0 119.2 1 0 126.5 1 0 127.8 1 0 131.3 1 0 140.3 1 0 137.3 1 0 143.0 1 0 134.5 1 0 139.9 1 0 159.3 1 0 170.4 1 0 175.0 1 0 175.8 1 0 180.9 1 0 180.3 1 0 169.6 1 0 172.3 1 0 184.8 1 0 177.7 1 0 184.6 1 0 211.4 1 0 215.3 1 0 215.9 1 0
 
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'George Udny Yule' @ 72.249.76.132


Multiple Linear Regression - Estimated Regression Equation
prijsindex[t] = + 109.925373134328 + 46.3420967451897ontkoppelde_bedrijfstoeslag[t] + 10.329718875502oogstomvang[t] + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)109.9253731343282.38909146.011400
ontkoppelde_bedrijfstoeslag46.34209674518974.41929310.486300
oogstomvang10.3297188755023.7860722.72830.0076250.003812


Multiple Linear Regression - Regression Statistics
Multiple R0.7425997210836
R-squared0.55145434575344
Adjusted R-squared0.541703353269819
F-TEST (value)56.5536632993759
F-TEST (DF numerator)2
F-TEST (DF denominator)92
p-value1.11022302462516e-16
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation19.5555528610616
Sum Squared Residuals35182.6075885632


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
1102.7109.925373134329-7.22537313432858
2103.2109.925373134328-6.72537313432836
3105.6109.925373134328-4.3253731343283
4103.9109.925373134328-6.02537313432835
5107.2109.925373134328-2.72537313432835
6100.7109.925373134328-9.22537313432835
792.1109.925373134328-17.8253731343284
890.3109.925373134328-19.6253731343284
993.4109.925373134328-16.5253731343284
1098.5109.925373134328-11.4253731343284
11100.8109.925373134328-9.12537313432836
12102.3109.925373134328-7.62537313432836
13104.7109.925373134328-5.22537313432836
14101.1109.925373134328-8.82537313432836
15101.4109.925373134328-8.52537313432835
1699.5109.925373134328-10.4253731343284
1798.4109.925373134328-11.5253731343284
1896.3109.925373134328-13.6253731343284
19100.7109.925373134328-9.22537313432835
20101.2109.925373134328-8.72537313432836
21100.3109.925373134328-9.62537313432836
2297.8109.925373134328-12.1253731343284
2397.4109.925373134328-12.5253731343284
2498.6109.925373134328-11.3253731343284
2599.7109.925373134328-10.2253731343284
2699109.925373134328-10.9253731343284
2798.1109.925373134328-11.8253731343284
2897109.925373134328-12.9253731343284
2998.5109.925373134328-11.4253731343284
30103.8109.925373134328-6.12537313432836
31114.4109.9253731343284.47462686567165
32124.5109.92537313432814.5746268656716
33134.2109.92537313432824.2746268656716
34131.8109.92537313432821.8746268656717
35125.6109.92537313432815.6746268656716
36119.9109.9253731343289.97462686567165
37114.9109.9253731343284.97462686567165
38115.5109.9253731343285.57462686567164
39112.5109.9253731343282.57462686567164
40111.4109.9253731343281.47462686567165
41115.3109.9253731343285.37462686567164
42110.8109.9253731343280.87462686567164
43103.7109.925373134328-6.22537313432836
44111.1120.255092009830-9.15509200983037
45113120.255092009830-7.25509200983037
46111.2120.255092009830-9.05509200983037
47117.6120.255092009830-2.65509200983037
48121.7120.2550920098301.44490799016963
49127.3120.2550920098307.04490799016963
50129.8120.2550920098309.54490799016964
51137.1120.25509200983016.8449079901696
52141.4120.25509200983021.1449079901696
53137.4120.25509200983017.1449079901696
54130.7120.25509200983010.4449079901696
55117.2120.255092009830-3.05509200983037
56110.899.595654258826311.2043457411737
57111.499.595654258826311.8043457411737
58108.299.59565425882638.60434574117366
59108.899.59565425882639.20434574117365
60110.299.595654258826310.6043457411737
61109.599.59565425882639.90434574117365
62109.599.59565425882639.90434574117365
6311699.595654258826416.4043457411736
64111.299.595654258826311.6043457411737
65112.199.595654258826312.5043457411736
6611499.595654258826314.4043457411737
67119.199.595654258826419.5043457411736
68114.1145.937751004016-31.8377510040161
69115.1145.937751004016-30.8377510040161
70115.4145.937751004016-30.5377510040161
71110.8156.267469879518-45.4674698795181
72116156.267469879518-40.2674698795181
73119.2156.267469879518-37.0674698795181
74126.5156.267469879518-29.7674698795181
75127.8156.267469879518-28.4674698795181
76131.3156.267469879518-24.9674698795181
77140.3156.267469879518-15.9674698795181
78137.3156.267469879518-18.9674698795181
79143156.267469879518-13.2674698795181
80134.5156.267469879518-21.7674698795181
81139.9156.267469879518-16.3674698795181
82159.3156.2674698795183.03253012048194
83170.4156.26746987951814.1325301204819
84175156.26746987951818.7325301204819
85175.8156.26746987951819.5325301204819
86180.9156.26746987951824.6325301204819
87180.3156.26746987951824.0325301204819
88169.6156.26746987951813.3325301204819
89172.3156.26746987951816.0325301204819
90184.8156.26746987951828.5325301204819
91177.7156.26746987951821.4325301204819
92184.6156.26746987951828.3325301204819
93211.4156.26746987951855.132530120482
94215.3156.26746987951859.032530120482
95215.9156.26746987951859.6325301204819
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/1b99m1199885127.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/1b99m1199885127.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/2tmc31199885127.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/2tmc31199885127.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/37nr81199885127.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/37nr81199885127.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/4qtek1199885127.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/4qtek1199885127.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/548yr1199885127.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/548yr1199885127.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/6lz0w1199885128.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/6lz0w1199885128.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/7skib1199885128.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/7skib1199885128.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/833ao1199885128.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/833ao1199885128.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/957bo1199885128.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t1199885093g8afn5ybttuxngs/957bo1199885128.ps (open in new window)


 
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)
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:

  • personalize online software applications according to your needs
  • enforce strict security rules with respect to the data that you upload (e.g. statistical data)
  • manage user sessions of online applications
  • alert you about important changes or upgrades in resources or applications

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