Home » date » 2007 » Dec » 14 » attachments

Paper_multiple_linear_regression_2dummies_LT

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Fri, 14 Dec 2007 06:35:31 -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/14/t1197638495dljo3j6ipxpae6l.htm/, Retrieved Fri, 14 Dec 2007 14:21:46 +0100
 
User-defined keywords:
s065921, 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'Gwilym Jenkins' @ 72.249.127.135


Multiple Linear Regression - Estimated Regression Equation
graanprijzen[t] = + 87.782122435839 + 15.6852291055731ontkoppelde_bedrijfstoeslag[t] + 12.9295760919322graanomzet[t] + 0.651272079367334t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)87.7821224358393.92843722.345300
ontkoppelde_bedrijfstoeslag15.68522910557315.9577532.63270.0099510.004975
graanomzet12.92957609193223.1666384.08319.5e-054.8e-05
t0.6512720793673340.0997536.528900


Multiple Linear Regression - Regression Statistics
Multiple R0.833389660968943
R-squared0.694538327009929
Adjusted R-squared0.6844681619663
F-TEST (value)68.969905061224
F-TEST (DF numerator)3
F-TEST (DF denominator)91
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation16.2262570785637
Sum Squared Residuals23959.5191089472


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
1102.788.433394515206514.2666054847935
2103.289.084666594573614.1153334054264
3105.689.73593867394115.8640613260591
4103.990.387210753308313.5127892466917
5107.291.038482832675716.1615171673243
6100.791.6897549120439.010245087957
792.192.3410269914103-0.241026991410338
890.392.9922990707777-2.69229907077767
993.493.643571150145-0.243571150144992
1098.594.29484322951234.20515677048767
11100.894.94611530887975.85388469112033
12102.395.5973873882476.702612611753
13104.796.24865946761438.45134053238566
14101.196.89993154698174.20006845301832
15101.497.5512036263493.848796373651
1699.598.20247570571631.29752429428366
1798.498.8537477850837-0.453747785083666
1896.399.505019864451-3.20501986445101
19100.7100.1562919438180.543708056181662
20101.2100.8075640231860.392435976814327
21100.3101.458836102553-1.15883610255301
2297.8102.110108181920-4.31010818192035
2397.4102.761380261288-5.36138026128767
2498.6103.412652340655-4.81265234065502
2599.7104.063924420022-4.36392442002235
2699104.715196499390-5.71519649938968
2798.1105.366468578757-7.26646857875702
2897106.017740658124-9.01774065812435
2998.5106.669012737492-8.16901273749168
30103.8107.320284816859-3.52028481685902
31114.4107.9715568962266.42844310377365
32124.5108.62282897559415.8771710244063
33134.2109.27410105496124.9258989450390
34131.8109.92537313432821.8746268656717
35125.6110.57664521369615.0233547863043
36119.9111.2279172930638.67208270693698
37114.9111.8791893724303.02081062756965
38115.5112.5304614517982.96953854820230
39112.5113.181733531165-0.68173353116503
40111.4113.833005610532-2.43300561053236
41115.3114.4842776899000.8157223101003
42110.8115.135549769267-4.33554976926704
43103.7115.786821848634-12.0868218486344
44111.1129.367670019934-18.2676700199340
45113130.018942099301-17.0189420993013
46111.2130.670214178669-19.4702141786686
47117.6131.321486258036-13.7214862580360
48121.7131.972758337403-10.2727583374033
49127.3132.624030416771-5.32403041677062
50129.8133.275302496138-3.47530249613795
51137.1133.9265745755053.17342542449471
52141.4134.5778466548736.82215334512738
53137.4135.229118734242.17088126576005
54130.7135.880390813607-5.18039081360731
55117.2136.531662892975-19.3316628929746
56110.8111.323782788477-0.523782788477468
57111.4111.975054867845-0.575054867844793
58108.2112.626326947212-4.42632694721213
59108.8113.277599026579-4.47759902657947
60110.2113.928871105947-3.7288711059468
61109.5114.580143185314-5.08014318531414
62109.5115.231415264681-5.73141526468147
63116115.8826873440490.117312655951195
64111.2116.533959423416-5.33395942341613
65112.1117.185231502783-5.08523150278348
66114117.836503582151-3.83650358215081
67119.1118.4877756615180.61222433848185
68114.1134.824276846459-20.7242768464586
69115.1135.475548925826-20.3755489258260
70115.4136.126821005193-20.7268210051933
71110.8149.707669176493-38.9076691764929
72116150.358941255860-34.3589412558602
73119.2151.010213335228-31.8102133352275
74126.5151.661485414595-25.1614854145949
75127.8152.312757493962-24.5127574939622
76131.3152.964029573330-21.6640295733295
77140.3153.615301652697-13.3153016526969
78137.3154.266573732064-16.9665737320642
79143154.917845811432-11.9178458114316
80134.5155.569117890799-21.0691178907989
81139.9156.220389970166-16.3203899701662
82159.3156.8716620495342.42833795046645
83170.4157.52293412890112.8770658710991
84175158.17420620826816.8257937917318
85175.8158.82547828763616.9745217123644
86180.9159.47675036700321.4232496329971
87180.3160.12802244637020.1719775536298
88169.6160.7792945257388.82070547426243
89172.3161.43056660510510.8694333948951
90184.8162.08183868447222.7181613155278
91177.7162.73311076384014.9668892361604
92184.6163.38438284320721.2156171567931
93211.4164.03565492257447.3643450774258
94215.3164.68692700194250.6130729980584
95215.9165.33819908130950.5618009186911
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/1azxy1197639326.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/1azxy1197639326.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/2r2iv1197639326.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/2r2iv1197639326.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/3jxfk1197639326.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/3jxfk1197639326.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/4b5531197639326.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/4b5531197639326.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/5cjuc1197639326.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/5cjuc1197639326.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/6wzzg1197639326.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/6wzzg1197639326.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/7vw431197639326.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/7vw431197639326.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/8qtv01197639326.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/8qtv01197639326.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/9ct7f1197639326.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/14/t1197638495dljo3j6ipxpae6l/9ct7f1197639326.ps (open in new window)


 
Parameters (Session):
par1 = 1 ; par2 = Do not include Seasonal Dummies ; par3 = Linear Trend ;
 
Parameters (R input):
par1 = 1 ; par2 = Do not include Seasonal 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