Home » date » 2010 » Nov » 30 »

WS 8, Multiple Regression

*The author of this computation has been verified*
R Software Module: /rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Mon, 29 Nov 2010 23:45:10 +0000
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr.htm/, Retrieved Tue, 30 Nov 2010 00:44:15 +0100
 
BibTeX entries for LaTeX users:
@Manual{KEY,
    author = {{YOUR NAME}},
    publisher = {Office for Research Development and Education},
    title = {Statistical Computations at FreeStatistics.org, URL http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr.htm/},
    year = {2010},
}
@Manual{R,
    title = {R: A Language and Environment for Statistical Computing},
    author = {{R Development Core Team}},
    organization = {R Foundation for Statistical Computing},
    address = {Vienna, Austria},
    year = {2010},
    note = {{ISBN} 3-900051-07-0},
    url = {http://www.R-project.org},
}
 
Original text written by user:
 
IsPrivate?
No (this computation is public)
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
9 911 8 915 9 452 9 112 8 472 8 230 8 384 8 625 8 221 8 649 8 625 10 443 10 357 8 586 8 892 8 329 8 101 7 922 8 120 7 838 7 735 8 406 8 209 9 451 10 041 9 411 10 405 8 467 8 464 8 102 7 627 7 513 7 510 8 291 8 064 9 383 9 706 8 579 9 474 8 318 8 213 8 059 9 111 7 708 7 680 8 014 8 007 8 718 9 486 9 113 9 025 8 476 7 952 7 759 7 835 7 600 7 651 8 319 8 812 8 630
 
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 computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time9 seconds
R Server'George Udny Yule' @ 72.249.76.132


Multiple Linear Regression - Estimated Regression Equation
y[t] = + 9.81564665770551 -0.00130798098140336V2[t] + 0.467047542017969M1[t] -0.496870365252102M2[t] + 0.0191390733849997M3[t] -0.914554765271227M4[t] -1.17461898261787M5[t] -1.39948880362134M6[t] -1.18904313812691M7[t] -1.46415884470312M8[t] -1.58241850777879M9[t] -1.06574537070756M10[t] -1.04666703073587M11[t] -0.0091376845130207t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)9.815646657705510.22366343.885800
V2-0.001307980981403360.000196-6.689800
M10.4670475420179690.2414311.93450.0592160.029608
M2-0.4968703652521020.24102-2.06150.0449290.022465
M30.01913907338499970.2411510.07940.9370860.468543
M4-0.9145547652712270.243112-3.76190.0004760.000238
M5-1.174618982617870.240717-4.87971.3e-057e-06
M6-1.399488803621340.240897-5.80951e-060
M7-1.189043138126910.240689-4.94021.1e-055e-06
M8-1.464158844703120.240945-6.076700
M9-1.582418507778790.239542-6.60600
M10-1.065745370707560.242209-4.40016.4e-053.2e-05
M11-1.046667030735870.241932-4.32638.1e-054e-05
t-0.00913768451302070.002878-3.17470.0026760.001338


Multiple Linear Regression - Regression Statistics
Multiple R0.914398840553984
R-squared0.83612523960647
Adjusted R-squared0.789812807321342
F-TEST (value)18.0540126776060
F-TEST (DF numerator)13
F-TEST (DF denominator)46
p-value7.37188088351104e-14
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation0.378355541378205
Sum Squared Residuals6.58503412181335


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
199.081985841152-0.0819858411519943
288.1036983254433-0.103698325443292
399.21616527395713-0.216165273957128
498.718047284465020.281952715534975
587.977972229300150.0220277706998493
688.06049612128328-0.0604961212832768
788.06037503112856-0.0603750311285617
887.460898223521120.539101776478877
987.86192519241940.138074807580605
1087.809644784936960.190355215063036
1187.850976983949310.149023016050689
12109.126558868787570.873441131212428
13109.696955090693210.30304490930679
1488.42437185416875-0.424371854168749
1588.5310014279834-0.531001427983402
1688.32456319734425-0.324563197344247
1788.35358095924455-0.353580959244549
1877.0457210679959-0.0457210679959024
1988.2960297960628-0.296029796062801
2077.07264606032596-0.07264606032596
2177.07997075382182-0.0799707538218178
2288.01783194926173-0.0178319492617327
2388.28544485805686-0.28544485805686
2499.0064428067801-0.00644280678009763
251010.0006248666604-0.000624866660424087
2698.543616311758090.456383688241911
27109.058335951770590.94166404822941
2888.03440960775433-0.0344096077543344
2987.769131648838880.230868351161119
3088.00861325859041-0.00861325859040978
3177.52323122433505-0.523231224335049
3277.3880876651258-0.388087665125803
3377.26461426048133-0.264614260481326
3488.05859754796687-0.0585975479668706
3588.3654498862041-0.365449886204099
3698.985733299359280.0142667006407225
3799.02116529987094-0.0211652998709404
3888.21422329272608-0.214223292726076
3998.858433049897510.141566950102490
4088.11964655982719-0.119646559827187
4187.987782661014880.0122173389851243
4287.95520422663450.044795773365494
4398.088497196582940.911502803417065
4477.0233791595959-0.0233791595958998
4576.932605279486510.0673947205134941
4688.31125606565935-0.311256065659353
4788.33035258798784-0.330352587987842
4888.4379074564329-0.437907456432903
4999.19926890162343-0.199268901623431
5098.71409021590380.285909784096206
5199.33606429639137-0.33606429639137
5287.80333335060920.196666649390793
5376.911532501601540.0884674983984564
5476.92996532549590.0700346745040952
5577.03186675189065-0.0318667518906529
5677.05498889143121-0.054988891431214
5776.860884513790960.139115486209045
5887.802669652175080.197330347824921
5987.167775683801890.832224316198112
6088.44335756864015-0.44335756864015
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/1lshp1291074300.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/1lshp1291074300.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/2lshp1291074300.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/2lshp1291074300.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/3lshp1291074300.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/3lshp1291074300.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/4vjya1291074300.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/4vjya1291074300.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/5vjya1291074300.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/5vjya1291074300.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/6vjya1291074300.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/6vjya1291074300.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/76sxv1291074300.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/76sxv1291074300.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/8hkfy1291074300.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/8hkfy1291074300.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/9hkfy1291074300.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Nov/30/t1291074246mwgy9ysn53so9xr/9hkfy1291074300.ps (open in new window)


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