Home » date » 2007 » Nov » 18 » attachments

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 13:27:47 -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/t1195417275lep30mplchkm4w2.htm/, Retrieved Sun, 18 Nov 2007 21:21:25 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
6,4 8,7 0 6,3 8,5 0 6 8,2 0 5,3 8,3 0 5,2 8 0 5,1 8,1 0 5,4 8,7 0 5,8 9,3 0 5,6 8,9 0 5,6 8,8 0 5,4 8,4 0 5,4 8,4 0 5,5 7,3 0 5,5 7,2 0 5,3 7 0 5,7 7 0 5,6 6,9 0 5,5 6,9 0 5,6 7,1 0 5,9 7,5 0 6 7,4 0 7 8,9 0 6,6 8,3 1 6,6 8,3 0 6,3 9 0 6,3 8,9 0 6,3 8,8 0 6,3 7,8 0 6,2 7,8 0 6,2 7,8 0 6,3 9,2 0 6,4 9,3 0 6,4 9,2 0 7,8 8,6 0 7,7 8,5 0 7,7 8,5 0 7,7 9 0 7,7 9 0 7,6 8,8 0 7,5 8 0 7,4 7,9 0 7,4 8,1 0 7,5 9,3 0 7,6 9,4 0 7,6 9,4 0 8,1 9,3 1 7,8 9 0 8 9,1 0 7,9 9,7 0 7,9 9,7 0 7,8 9,6 0 6,7 8,3 0 6,6 8,2 0 6,6 8,4 0 7,7 10,6 0 7,9 10,9 0 8 10,9 0 7,7 9,6 0 7,5 9,3 0 7,6 9,3 0 7,8 9,6 0 7,8 9,5 0 7,7 9,5 0 7,4 9 0 7,5 8,9 0 7,2 9 0 7,5 10,1 0 7,6 10,2 0 7,6 10,2 0 7,8 9,5 0 7,7 9,3 0 7,7 9,3 0 8,2 9,4 0 8,2 9,3 0 8,1 9,1 0 7,8 9 0 7,8 8,9 0 7,7 9 0 6,7 9,8 0 6,7 10 0 6,7 9,8 0 7,2 9,4 0 6,9 9 1 6,8 8,9 0 7,2 9,3 0 7,1 9,1 0 6,9 8,8 0 6,9 8,9 1 6,7 8,7 0 6,5 8,6 0 6,6 9,1 0 6,6 9,3 0 6,5 8,9 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
M[t] = + 0.8414664187967 + 0.683065915557792V[t] + 0.221323580627898x[t] + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)0.84146641879670.741771.13440.2596380.129819
V0.6830659155577920.0834758.182800
x0.2213235806278980.3437970.64380.5213660.260683


Multiple Linear Regression - Regression Statistics
Multiple R0.654525601329131
R-squared0.428403762795261
Adjusted R-squared0.415701624190711
F-TEST (value)33.7269003380117
F-TEST (DF numerator)2
F-TEST (DF denominator)90
p-value1.17225118501096e-11
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation0.672625893279218
Sum Squared Residuals40.71830330787


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
16.46.78413988414947-0.384139884149473
26.36.64752670103793-0.347526701037931
366.44260692637059-0.442606926370593
45.36.51091351792637-1.21091351792637
55.26.30599374325903-1.10599374325903
65.16.37430033481481-1.27430033481481
75.46.78413988414949-1.38413988414949
85.87.19397943348416-1.39397943348416
95.66.92075306726105-1.32075306726105
105.66.85244647570527-1.25244647570527
115.46.57922010948215-1.17922010948215
125.46.57922010948215-1.17922010948215
135.55.82784760236858-0.32784760236858
145.55.7595410108128-0.259541010812801
155.35.62292782770124-0.322927827701243
165.75.622927827701240.0770721722987576
175.65.554621236145460.0453787638545361
185.55.55462123614546-0.0546212361454636
195.65.69123441925702-0.091234419257022
205.95.96446078548014-0.0644607854801381
2165.896154193924360.103845806075641
2276.920753067261050.0792469327389527
236.66.73223709855427-0.132237098554270
246.66.510913517926370.0890864820736272
256.36.98905965881683-0.689059658816826
266.36.92075306726105-0.620753067261047
276.36.85244647570527-0.552446475705269
286.36.169380560147480.130619439852524
296.26.169380560147480.0306194398525243
306.26.169380560147480.0306194398525243
316.37.12567284192838-0.825672841928384
326.47.19397943348416-0.793979433484164
336.47.12567284192838-0.725672841928384
347.86.715833292593711.08416670740629
357.76.647526701037931.05247329896207
367.76.647526701037931.05247329896207
377.76.989059658816830.710940341183174
387.76.989059658816830.710940341183174
397.66.852446475705270.747553524294731
407.56.305993743259031.19400625674097
417.46.237687151703261.16231284829675
427.46.374300334814811.02569966518519
437.57.193979433484160.306020566515836
447.67.262286025039940.337713974960056
457.67.262286025039940.337713974960056
468.17.415303014112060.684696985887938
477.86.989059658816830.810940341183174
4887.05736625037260.942633749627395
497.97.467205799707280.43279420029272
507.97.467205799707280.43279420029272
517.87.39889920815150.401100791848499
526.76.510913517926370.189086482073628
536.66.442606926370590.157393073629407
546.66.579220109482150.0207798905178482
557.78.0819651237093-0.381965123709293
567.98.28688489837663-0.386884898376630
5788.28688489837663-0.286884898376631
587.77.39889920815150.301100791848499
597.57.193979433484160.306020566515836
607.67.193979433484160.406020566515835
617.87.39889920815150.401100791848499
627.87.330592616595720.469407383404278
637.77.330592616595720.369407383404278
647.46.989059658816830.410940341183174
657.56.920753067261050.579246932738953
667.26.989059658816830.210940341183174
677.57.7404321659304-0.240432165930397
687.67.80873875748618-0.208738757486176
697.67.80873875748618-0.208738757486176
707.87.330592616595720.469407383404278
717.77.193979433484160.506020566515836
727.77.193979433484160.506020566515836
738.27.262286025039940.937713974960056
748.27.193979433484161.00602056651584
758.17.05736625037261.04263374962739
767.86.989059658816830.810940341183174
777.86.920753067261050.879246932738953
787.76.989059658816830.710940341183174
796.77.53551239126306-0.83551239126306
806.77.67212557437462-0.972125574374618
816.77.53551239126306-0.83551239126306
827.27.26228602503994-0.062286025039943
836.97.21038323944472-0.310383239444723
846.86.92075306726105-0.120753067261047
857.27.193979433484160.00602056651583593
867.17.05736625037260.0426337496273944
876.96.852446475705270.047553524294732
886.97.14207664788894-0.242076647888944
896.76.78413988414949-0.084139884149488
906.56.71583329259371-0.215833292593709
916.67.0573662503726-0.457366250372606
926.67.19397943348416-0.593979433484165
936.56.92075306726105-0.420753067261047
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195417275lep30mplchkm4w2/1tawq1195417662.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195417275lep30mplchkm4w2/1tawq1195417662.ps (open in new window)


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


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195417275lep30mplchkm4w2/3mhrk1195417662.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195417275lep30mplchkm4w2/3mhrk1195417662.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195417275lep30mplchkm4w2/404xf1195417662.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195417275lep30mplchkm4w2/404xf1195417662.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195417275lep30mplchkm4w2/5526y1195417662.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195417275lep30mplchkm4w2/5526y1195417662.ps (open in new window)


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


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195417275lep30mplchkm4w2/7rh171195417662.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195417275lep30mplchkm4w2/7rh171195417662.ps (open in new window)


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


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195417275lep30mplchkm4w2/91l5l1195417662.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/18/t1195417275lep30mplchkm4w2/91l5l1195417662.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