Home » date » 2008 » Jan » 09 » attachments

regressie 1

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 05:06:38 -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/t11998807503p7gisgs84f793b.htm/, Retrieved Wed, 09 Jan 2008 13:12:40 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
1,0137 89,97 0,9834 99,8 0,9643 112,99 0,947 93,69 0,906 108,02 0,9492 99,11 0,9397 94,33 0,9041 83,75 0,8721 106,37 0,8552 109,63 0,8564 105,5 0,8973 96,13 0,9383 102,48 0,9217 101,37 0,9095 112,76 0,892 95,57 0,8742 102,81 0,8532 104,13 0,8607 97,52 0,9005 85,29 0,9111 101,01 0,9059 108,48 0,8883 101,33 0,8924 87,57 0,8833 97,44 0,87 96,06 0,8758 106,67 0,8858 102,67 0,917 104,54 0,9554 102,46 0,9922 103,35 0,9778 83,27 0,9808 108,22 0,9811 115,23 1,0014 103,7 1,0183 93,61 1,0622 100,25 1,0773 100,56 1,0807 108,86 1,0848 105,43 1,1582 104,77 1,1663 109,13 1,1372 106,13 1,1139 82,27 1,1222 113,6 1,1692 117,73 1,1702 104,83 1,2286 104,61 1,2613 102,93 1,2646 106,95 1,2262 123,45 1,1985 111,99 1,2007 103,95 1,2138 122,05 1,2266 108,04 1,2176 93,72 1,2218 119,61 1,249 118,29 1,2991 117,14 1,3408 112,76 1,3119 105,97 1,3014 107,96 1,3201 122,27 1,2938 114,54 1,2694 110,15 1,2165 120,02 1,2037 103,94 1,2292 96,18 1,2256 121,01 1,2015 110,55 1,1786 120,04 1,1856 114,19
 
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 time4 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Multiple Linear Regression - Estimated Regression Equation
uit[t] = + 76.9448945475292 + 17.9272790802276wk[t] -0.0729373360848385M1[t] + 2.24275774771011M2[t] + 14.6337467597814M3[t] + 4.22137035214254M4[t] + 5.75861868890598M5[t] + 9.33169792914856M6[t] + 1.93242931516801M7[t] -12.9390144262923M8[t] + 11.1954660667304M9[t] + 12.6753380348809M10[t] + 7.90052272628074M11[t] + 0.117237698854330t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)76.94489454752926.51314411.813800
wk17.92727908022767.6095082.35590.0218790.010939
M1-0.07293733608483852.600614-0.0280.9777220.488861
M22.242757747710112.5803540.86920.3883390.194169
M314.63374675978142.5667225.701300
M44.221370352142542.5558911.65160.1040160.052008
M55.758618688905982.5534272.25530.0279070.013953
M69.331697929148562.5514973.65730.0005510.000275
M71.932429315168012.5497410.75790.4515840.225792
M8-12.93901442629232.549667-5.07484e-062e-06
M911.19546606673042.55144.3884.9e-052.4e-05
M1012.67533803488092.5516454.96756e-063e-06
M117.900522726280742.5519233.09590.003020.00151
t0.1172376988543300.0572492.04790.0451110.022556


Multiple Linear Regression - Regression Statistics
Multiple R0.910125143298849
R-squared0.82832777646475
Adjusted R-squared0.78984951946547
F-TEST (value)21.5271647174726
F-TEST (DF numerator)13
F-TEST (DF denominator)58
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation4.41081407999703
Sum Squared Residuals1128.40628920140


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
189.9795.1620777139252-5.1920777139252
299.897.05181394044382.74818605955620
3112.99109.2176296209373.77237037906297
493.6998.6123489840646-4.92234898406459
5108.0299.5318165773938.48818342260697
699.11103.996591972756-4.88659197275576
794.3396.5442519063674-2.21425190636739
883.7581.15183472850532.59816527149473
9106.37104.8298799898151.540120010185
10109.63106.1240186403643.50598135963589
11105.5101.4879537655144.01204623448553
1296.1394.43789445246941.69210554753064
13102.4895.21721325752827.2627867424718
14101.3797.35255320744574.0174467925543
15112.76109.6420671135933.1179328864075
1695.5799.033201020904-3.46320102090404
17102.81100.3685814888942.44141851110625
18104.13103.6824255673060.447574432694119
1997.5296.53484924528140.985150754718628
2085.2982.49414891006842.79585108993161
21101.01106.935896260196-5.92589626019584
22108.48108.4397840759840.0402159240164185
23101.33103.466686354426-2.1366863544257
2487.5795.7569031712282-8.18690317122823
2597.4495.63806529436761.80193470563236
2696.0697.83256526525-1.7725652652499
27106.67110.444770194841-3.77477019484081
28102.67100.3289042768592.34109572314142
29104.54102.5427214197791.99727858022055
30102.46106.921445875557-4.4614458755571
31103.35100.2991388305833.05086116941675
3283.2785.286779969222-2.01677996922196
33108.22109.592279998340-1.37227999833967
34115.23111.1947678490694.03523215093135
35103.7106.901114004651-3.20111400465140
3693.6199.4207999936808-5.81079999368084
37100.25100.252107908072-0.00210790807231687
38100.56102.955742604833-2.39574260483303
39108.86115.524922064631-6.6649220646314
40105.43105.3032852000760.126714799924179
41104.77108.273633520182-3.50363352018231
42109.13112.109161419829-2.97916141982905
43106.13104.3054466834681.82455331653179
4482.2789.1335350382929-6.86353503829289
45113.6113.5340496465360.0659503534641888
46117.73115.9737414303111.75625856968858
47104.83111.334091099646-6.50409109964577
48104.61104.5977591705050.0122408294953484
49102.93105.228281559198-2.29828155919758
50106.95107.720374362812-0.770374362811615
51123.45119.5401935570563.90980644294354
52111.99108.7484692177503.24153078225034
53103.95110.442395267344-6.49239526734394
54122.05114.3675595623927.68244043760818
55108.04107.3149978194930.725002180507494
5693.7292.39944626516441.32055373483555
57119.61116.7264590291782.88354097082157
58118.29118.811190687166-0.521190687165538
59117.14115.0517697593392.08823024066094
60112.76108.0160522695584.74394773044186
61105.97107.542254266909-1.57225426690906
62107.96109.786950619216-1.82695061921596
63122.27122.630417448942-0.360417448941798
64114.54111.8637913003472.67620869965269
65110.15113.080851726408-2.93085172640753
66120.02115.8228156021604.19718439783961
67103.94108.311315514807-4.37131551480727
6896.1894.0142550887472.16574491125296
69121.01118.2014350759352.80856492406475
70110.55119.366497317107-8.8164973171067
71120.04114.2983850164245.7416149835764
72114.19106.6405909425597.54940905744121
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t11998807503p7gisgs84f793b/1l5rp1199880393.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t11998807503p7gisgs84f793b/1l5rp1199880393.ps (open in new window)


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


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t11998807503p7gisgs84f793b/3vbt41199880393.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t11998807503p7gisgs84f793b/3vbt41199880393.ps (open in new window)


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


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t11998807503p7gisgs84f793b/5hhwm1199880393.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t11998807503p7gisgs84f793b/5hhwm1199880393.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t11998807503p7gisgs84f793b/68hcv1199880393.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t11998807503p7gisgs84f793b/68hcv1199880393.ps (open in new window)


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


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t11998807503p7gisgs84f793b/88al31199880393.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t11998807503p7gisgs84f793b/88al31199880393.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t11998807503p7gisgs84f793b/9gwdp1199880393.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2008/Jan/09/t11998807503p7gisgs84f793b/9gwdp1199880393.ps (open in new window)


 
Parameters (Session):
par1 = 2 ; par2 = Include Monthly Dummies ; par3 = Linear Trend ;
 
Parameters (R input):
par1 = 2 ; 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:

  • 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