Home » date » 2007 » Nov » 17 » attachments

mult regr

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Sat, 17 Nov 2007 11:22:13 -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/17/t119532370472pnpgf3d75vzp8.htm/, Retrieved Sat, 17 Nov 2007 19:21:53 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
95,90 96,92 95,86 96,06 96,06 96,02 96,31 96,59 96,34 96,34 96,67 96,84 96,49 97,27 96,73 96,22 96,38 96,34 96,53 96,47 96,60 96,50 96,05 96,64 96,77 96,76 97,20 96,66 96,51 97,50 96,58 96,55 96,99 96,63 95,97 97,08 97,06 97,00 97,55 97,73 97,46 98,42 98,01 97,90 98,78 97,76 98,42 97,49 97,49 98,54 96,99 97,77 99,00 97,16 97,96 98,94 97,29 98,23 99,02 97,80 98,51 100,07 98,12 98,19 98,72 98,03 98,37 98,73 98,11 98,31 98,04 98,07 98,60 99,08 98,21 98,97 99,22 98,48 99,11 99,57 98,83 99,64 100,44 99,20 100,03 100,84 99,88 99,98 100,75 99,71 100,32 100,49 100,03 100,44 99,98 100,60 100,51 99,96 100,85 101,00 99,76 101,96 100,88 100,11 101,40 100,55 99,79 100,81 100,83 100,29 100,66 101,51 101,12 101,55 102,16 102,65 102,23 102,39 102,71 102,90 102,54 103,39 102,68 102,85 102,80 103,41 103,47 102,07 104,62 103,57 102,15 104,93 103,69 101,21 105,88 103,50 101,27 105,18 103,47 101,86 104,54 103,45 101,65 104,58 103,48 101,94 104,34 103,93 102,62 104,66 103,89 102,71 104,73 104,40 103,39 105,44 104,79 104,51 105,72 104,77 104,09 105,68 105,13 104,29 105,90 105,26 104,57 105,97 104,96 105,39 105,21 104,75 105,15 104,75 105,01 106,13 104,89 105,15 105,46 105,26 105,20 106,47 104,84 105,77 106,62 105,47 105,78 106,52 105,40 106,26 108,04 105,73 106,13 107,15 105,72 106,12 107,32 105,63 106,57 107,76 105,97 106,44 107,26 105,92 106,54 107,89 106,32
 
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
x[t] = + 0.80040639255172 + 0.379659939126742y[t] + 0.611032021039155z[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.800406392551720.6536341.22450.2250980.112549
y0.3796599391267420.01555124.413300
z0.6110320210391550.01516440.294200


Multiple Linear Regression - Regression Statistics
Multiple R0.998619183453074
R-squared0.997240273560485
Adjusted R-squared0.99715664548656
F-TEST (value)11924.7069406202
F-TEST (DF numerator)2
F-TEST (DF denominator)66
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation0.186084686163247
Sum Squared Residuals2.28541568801528


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
195.996.1705772295294-0.270577229529418
296.0695.94183480524630.118165194753693
396.3196.338584819716-0.0285848197160194
496.3496.6744736253657-0.334473625365734
596.4996.8350560665275-0.345056066527479
696.2296.2588562324994-0.0388562324994034
796.5396.4518939524910.0781060475090164
896.596.31687805889930.183121941100678
996.7796.9286145474612-0.158614547461245
1096.6697.0170091689913-0.357009168991304
1196.5896.7205692358264-0.140569235826396
1296.6396.55535935302640.074640646973585
1397.0697.2335941402154-0.173594140215355
1497.7397.9398355705177-0.209835570517721
1598.0198.3268574713076-0.316857471307586
1697.7697.7360493325130.0239506674870234
1797.4997.47609251468860.0139074853113800
1897.7797.75461153026360.0153884697364248
1997.9697.8112660966510.148733903348932
2098.2398.15326522251120.0767347774888395
2198.5198.7474384053268-0.237438405326772
2298.1998.17990460561220.0100953943878467
2398.3798.23258376668650.137416233313453
2498.3197.94617712784750.363822872152472
2598.698.42656794748480.173432052515173
2698.9798.64469898464310.325301015356855
2799.1198.99144117070120.118558829298797
2899.6499.5478271655260.0921728344740407
29100.03100.115192915483-0.085192915483279
3099.9899.97714807738520.00285192261478946
31100.32100.0739667399450.246033260055199
32100.44100.2286284229820.211371577017525
33100.51100.3737932294600.136206770540282
34101100.9761067849880.0238932150121592
35100.88100.7668098319000.113190168099716
36100.55100.2848097589670.265190241033377
37100.83100.3829849253740.447015074625884
38101.51101.2419211735740.268078826425846
39102.16102.238302654745-0.0783026547447078
40102.39102.670473705189-0.280473705188539
41102.54102.794215419166-0.254215419166107
42102.85103.01626943044-0.166269430439917
43103.47103.478466420335-0.00846642033477176
44103.57103.698259141987-0.128259141987061
45103.69103.921859219195-0.231859219195105
46103.5103.516916400815-0.0169164008153062
47103.47103.3498552714350.120144728564973
48103.45103.294567965060.155432034940029
49103.48103.2580216623570.221978337642672
50103.93103.7117206676960.218279332303962
51103.89103.7886623036900.101337696309808
52104.4104.480663797234-0.0806637972341706
53104.79105.076971894947-0.286971894947087
54104.77104.893073439672-0.123073439672304
55105.13105.1034324721260.0265675278737328
56105.26105.2525094965540.00749050344552279
57104.96105.099446310649-0.139446310648659
58104.75104.7272531955800.0227468044197707
59105.01105.18486441887-0.174864418869910
60105.15105.156574107439-0.00657410743948088
61105.2105.283397197121-0.083397197121049
62105.77105.7252963612450.0447036387552654
63105.78105.6445581258590.135441874140684
64106.26106.423281800275-0.163281800274884
65106.13106.0792741342420.0507258657583022
66106.12106.0888234420000.0311765580002959
67106.57106.4636247023690.106375297631199
68106.44106.2432431317530.19675686824653
69106.54106.726841701819-0.186841701818964
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/1jkqf1195323728.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/1jkqf1195323728.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/2jo8y1195323728.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/2jo8y1195323728.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/3f41a1195323728.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/3f41a1195323728.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/4pi5b1195323728.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/4pi5b1195323728.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/5t0dz1195323728.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/5t0dz1195323728.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/61ljk1195323728.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/61ljk1195323728.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/7aamy1195323728.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/7aamy1195323728.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/8l3el1195323728.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/8l3el1195323728.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/9hbtj1195323728.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/17/t119532370472pnpgf3d75vzp8/9hbtj1195323728.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