Home » date » 2007 » Nov » 18 » attachments

Workshop 6 Q3

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Sun, 18 Nov 2007 09:02:48 -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/18/t11954014147kb3e2i55bjtn7e.htm/, Retrieved Sun, 18 Nov 2007 16:56:54 +0100
 
User-defined keywords:
Multiple Regression line
 
Dataseries X:
» Textbox « » Textfile « » CSV «
100,6 115,9 59,7 96,1 112,9 58,2 110 126,3 75,3 108,2 116,8 69 106,9 112 66,1 117,2 129,7 77,5 105,2 113,6 69,3 106,3 115,7 70,2 95,9 119,5 70,2 107,5 125,8 78,2 113 129,6 85,4 111,4 128 82,4 95,5 112,8 61,2 90,3 101,6 52,2 110,8 123,9 85,3 107,1 118,8 79,9 101,4 109,1 72,2 112,9 130,6 85,7 98,5 112,4 75,5 100,1 111 69,2 93,4 116,2 77,6 104,4 119,8 85,3 101,8 117,2 77 107,9 127,3 89,9 91,3 107,7 60 86,6 97,5 54,3 111,4 120,1 84 98,4 110,6 69,9 102,2 111,3 75,1 103 119,8 81,7 95,8 105,5 69,9 96 108,7 68,3 95,7 128,7 77,3 106,4 119,5 77,4 112 121,1 85,3 116,2 128,4 91 93,9 108,8 60,6 100,5 107,5 57,6 112,5 125,6 93,8 101,2 102,9 78,7 107,8 107,5 80,3 114,3 120,4 89,8 99,6 104,3 77,5 98,6 100,6 71,7 93,6 121,9 83,2 99,6 112,7 86,2 113,1 124,9 100,7 110,7 123,9 100,8 88,1 102,2 57,1 93,1 104,9 62,5 107,4 109,8 79,7 99,5 98,9 80,3 105,6 107,3 92,4 108,3 112,6 91,8 99,2 104 85,8 99,3 110,6 84,2 107,1 100,8 93,1 106,9 103,8 101,2 115,4 117 100,6 99 108,4 106,7 100,1 95,5 64 96,2 96,9 67,5 96,9 103,9 101 96,2 101,1 95,5 91 100,6 97 99 104,3 103,8 99 98 95,2 107,2 99,5 86,7 110,8 97,4 93,5 111,1 105,6 102,5 104,6 117,5 112,3 94,3 107,4 105,5 90,7 97,8 75,4 88,8 91,5 70,4 90,9 107,7 108 90,5 100,1 100 95,5 96,6 93,3 103,1 106,8 111,1 100,6 98 101,1 103,1 98,6 98,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 time6 seconds
R Server'Herman Ole Andreas Wold' @ 193.190.124.10:1001


Multiple Linear Regression - Estimated Regression Equation
Int[t] = + 39.8313765615007 + 0.443260583766398Cons[t] + 0.157433989020551Duurzcons[t] + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)39.83137656150077.6955765.17592e-061e-06
Cons0.4432605837663980.0627157.067900
Duurzcons0.1574339890205510.0426713.68950.0004170.000209


Multiple Linear Regression - Regression Statistics
Multiple R0.678910073141829
R-squared0.460918887413444
Adjusted R-squared0.446916780593014
F-TEST (value)32.9178239621006
F-TEST (DF numerator)2
F-TEST (DF denominator)77
p-value4.66319205472132e-11
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation5.60341382082505
Sum Squared Residuals2417.66497645081


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
1100.6100.604087364553-0.00408736455320509
296.199.0381546297231-2.93815462972312
3110107.6699676644442.33003233555573
4108.2102.4671579878345.73284201216599
5106.999.88294861759577.0170513824043
6117.2109.5234084250957.67659157490478
7105.2101.0959543164884.10404568351230
8106.3102.1684921325164.13150786748436
995.9103.852882350828-7.95288235082795
10107.5107.904895940721-0.404895940720662
11113110.7228108799812.27718912001906
12111.4109.5412919788931.85870802110695
1395.599.4661305384081-3.96613053840813
1490.393.0847060990395-2.78470609903952
15110.8108.1804821536102.61951784638958
16107.1105.0697096356912.03029036430918
17101.499.55784025769851.84215974230149
18112.9111.2133016604531.68669833954650
1998.5101.540132347895-3.04013234789545
20100.199.9277333997930.172266600206973
2193.4103.555133943151-10.1551339431509
22104.4106.363113760168-1.96311376016818
23101.8103.903934133505-2.10393413350499
24107.9110.411764487911-2.51176448791070
2591.397.0165807743748-5.71658077437485
2686.691.5979490825405-4.99794908254045
27111.4106.2914277495715.10857225042862
2898.499.8606329586008-1.46063295860084
29102.2100.9895721101441.21042788985582
30103105.796351399694-2.79635139969420
3195.897.6000039813922-1.80000398139222
329698.7665434670118-2.76654346701181
3395.7109.048661043525-13.3486610435247
34106.4104.9864070717761.41359292822409
35112106.9393525190645.0606474809355
36116.2111.0725285179765.12747148202365
3793.997.5986278099302-3.69862780993020
38100.596.55008708397223.94991291602776
39112.5110.2722140526882.22778594731203
40101.297.83294556698043.36705443301957
41107.8100.1238386347397.67616136526125
42114.3107.3375230610216.96247693897949
4399.698.26458959742871.33541040257127
4498.695.71140830117392.88859169882613
4593.6106.963349609134-13.3633496091345
4699.6103.357654205545-3.75765420554527
47113.1111.0482261682932.05177383170669
48110.7110.6207089834290.079291016571046
4988.194.1220889955-6.02208899550006
5093.196.1690361123803-3.06903611238031
51107.4101.0488775839896.35112241601088
5299.596.31179761434773.18820238565228
53105.6101.9401377851343.65986221486587
54108.3104.1949584856844.10504151431630
5599.299.4383135311694-0.238313531169377
5699.3102.111939001595-2.81193900159472
57107.199.1691477829677.93085221703307
58106.9101.7741448453335.12585515466743
59115.4107.5307241576377.8692758423633
6099104.679030470271-5.67903047027104
61100.192.2385376085077.861462391493
6296.293.41012138735192.78987861264812
6396.9101.786984105905-4.88698410590511
6496.299.6799675317462-3.47996753174616
659199.6944882233938-8.6944882233938
6699102.405103508669-3.40510350866921
679998.25862952536420.741370474635829
68107.297.5853314943399.61466850566092
69110.897.725035393769413.0749646062306
70111.1102.7766780818398.32332191816118
71104.6109.594332121060-4.99433212106035
7294.3104.04684909968-9.74684909967999
7390.795.052784426004-4.35278442600398
7488.891.473072803173-2.67307280317293
7590.9104.573412247361-13.6734122473613
7690.599.9451598985722-9.44515989857225
7795.597.3389401289522-1.83894012895216
78103.1104.662523087935-1.56252308793523
79100.699.18749006058541.41250993941458
80103.198.98114444378364.11885555621639
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/1owqt1195401758.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/1owqt1195401758.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/2rt3p1195401758.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/2rt3p1195401758.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/38qsp1195401758.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/38qsp1195401758.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/4nse81195401758.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/4nse81195401758.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/5l8yt1195401758.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/5l8yt1195401758.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/6j2dc1195401758.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/6j2dc1195401758.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/74v2h1195401758.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/74v2h1195401758.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/8loav1195401759.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/8loav1195401759.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/9y5r31195401759.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t11954014147kb3e2i55bjtn7e/9y5r31195401759.ps (open in new window)


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

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