Home » date » 2007 » Nov » 19 » attachments

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Mon, 19 Nov 2007 03:22:35 -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/19/t119546743378pvz4yc6df7viu.htm/, Retrieved Mon, 19 Nov 2007 11:17:41 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
112.1 0 104.2 0 102.4 0 100.3 0 102.6 0 101.5 0 103.4 0 99.4 0 97.9 0 98 0 90.2 0 87.1 0 91.8 0 94.8 0 91.8 0 89.3 0 91.7 0 86.2 0 82.8 0 82.3 0 79.8 0 79.4 0 85.3 0 87.5 0 88.3 0 88.6 0 94.9 0 94.7 0 92.6 0 91.8 0 96.4 0 96.4 0 107.1 0 111.9 0 107.8 0 109.2 0 115.3 0 119.2 0 107.8 0 106.8 0 104.2 0 94.8 0 97.5 0 98.3 0 100.6 1 94.9 1 93.6 1 98 1 104.3 1 103.9 1 105.3 1 102.6 1 103.3 1 107.9 1 107.8 1 109.8 1 110.6 1 110.8 1 119.3 1 128.1 1 127.6 1 137.9 1 151.4 1 143.6 1 143.4 1 141.9 1 135.2 1 133.1 1 129.6 1 134.1 1 136.8 1 143.5 1 162.5 1 163.1 1 157.2 1 158.8 1 155.4 1 148.5 1 154.2 1 153.3 1 149.4 1 147.9 1 156 1 163 1 159.1 1 159.5 1 157.3 1 156.4 1 156.6 1 162.4 1 166.8 1 162.6 1 168.1 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 time3 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Multiple Linear Regression - Estimated Regression Equation
Suiker[t] = + 75.5132381823562 -4.9594561794693Fluctuatie[t] + 0.952340929269015t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)75.51323818235622.98649625.284900
Fluctuatie-4.95945617946935.381921-0.92150.3592510.179626
t0.9523409292690150.1000959.514400


Multiple Linear Regression - Regression Statistics
Multiple R0.877834062380164
R-squared0.770592641074862
Adjusted R-squared0.765494699765415
F-TEST (value)151.157613299078
F-TEST (DF numerator)2
F-TEST (DF denominator)90
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation13.0103985336055
Sum Squared Residuals15234.3423002919


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
1112.176.465579111625535.6344208883745
2104.277.417920040894226.7820799591058
3102.478.370260970163324.0297390298367
4100.379.322601899432320.9773981005677
5102.680.274942828701322.3250571712987
6101.581.227283757970320.2727162420297
7103.482.179624687239421.2203753127607
899.483.131965616508416.2680343834916
997.984.084306545777413.8156934542226
109885.036647475046412.9633525249536
1190.285.98898840431544.21101159568459
1287.186.94132933358440.158670666415566
1391.887.89367026285343.90632973714655
1494.888.84601119212255.95398880787754
1591.889.79835212139152.00164787860852
1689.390.7506930506605-1.45069305066049
1791.791.7030339799295-0.00303397992949916
1886.292.6553749091985-6.45537490919851
1982.893.6077158384675-10.8077158384675
2082.394.5600567677366-12.2600567677366
2179.895.5123976970056-15.7123976970056
2279.496.4647386262746-17.0647386262746
2385.397.4170795555436-12.1170795555436
2487.598.3694204848126-10.8694204848126
2588.399.3217614140816-11.0217614140816
2688.6100.274102343351-11.6741023433506
2794.9101.226443272620-6.32644327261965
2894.7102.178784201889-7.47878420188866
2992.6103.131125131158-10.5311251311577
3091.8104.083466060427-12.2834660604267
3196.4105.035806989696-8.6358069896957
3296.4105.988147918965-9.58814791896472
33107.1106.9404888482340.159511151766253
34111.9107.8928297775034.00717022249725
35107.8108.845170706772-1.04517070677177
36109.2109.797511636041-0.597511636040781
37115.3110.7498525653104.5501474346902
38119.2111.7021934945797.49780650542119
39107.8112.654534423848-4.85453442384783
40106.8113.606875353117-6.80687535311685
41104.2114.559216282386-10.3592162823859
4294.8115.511557211655-20.7115572116549
4397.5116.463898140924-18.9638981409239
4498.3117.416239070193-19.1162390701929
45100.6113.409123819993-12.8091238199926
4694.9114.361464749262-19.4614647492616
4793.6115.313805678531-21.7138056785307
4898116.266146607800-18.2661466077997
49104.3117.218487537069-12.9184875370687
50103.9118.170828466338-14.2708284663377
51105.3119.123169395607-13.8231693956067
52102.6120.075510324876-17.4755103248757
53103.3121.027851254145-17.7278512541447
54107.9121.980192183414-14.0801921834137
55107.8122.932533112683-15.1325331126828
56109.8123.884874041952-14.0848740419518
57110.6124.837214971221-14.2372149712208
58110.8125.789555900490-14.9895559004898
59119.3126.741896829759-7.44189682975883
60128.1127.6942377590280.405762240972151
61127.6128.646578688297-1.04657868829686
62137.9129.5989196175668.30108038243413
63151.4130.55126054683520.8487394531651
64143.6131.50360147610412.0963985238961
65143.4132.45594240537310.9440575946271
66141.9133.4082833346428.49171666535807
67135.2134.3606242639110.839375736089042
68133.1135.31296519318-2.21296519317997
69129.6136.265306122449-6.66530612244898
70134.1137.217647051718-3.117647051718
71136.8138.169987980987-1.36998798098700
72143.5139.1223289102564.37767108974398
73162.5140.07466983952522.4253301604750
74163.1141.02701076879422.0729892312059
75157.2141.97935169806315.2206483019369
76158.8142.93169262733215.8683073726679
77155.4143.88403355660111.5159664433989
78148.5144.836374485873.66362551412989
79154.2145.7887154151398.41128458486086
80153.3146.7410563444086.55894365559187
81149.4147.6933972736771.70660272632285
82147.9148.645738202946-0.745738202946165
83156149.5980791322156.40192086778482
84163150.55042006148412.4495799385158
85159.1151.5027609907537.59723900924678
86159.5152.4551019200227.04489807997777
87157.3153.4074428492913.89255715070877
88156.4154.3597837785602.04021622143975
89156.6155.3121247078291.28787529217072
90162.4156.2644656370986.13553436290172
91166.8157.2168065663679.5831934336327
92162.6158.1691474956364.43085250436367
93168.1159.1214884249058.97851157509466
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/1k1hv1195467750.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/1k1hv1195467750.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/26ex81195467750.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/26ex81195467750.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/3igas1195467750.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/3igas1195467750.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/4v1y21195467750.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/4v1y21195467750.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/5qwle1195467750.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/5qwle1195467750.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/6nw2y1195467750.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/6nw2y1195467750.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/7q2j51195467750.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/7q2j51195467750.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/8rac81195467750.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/8rac81195467750.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/9rtud1195467751.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t119546743378pvz4yc6df7viu/9rtud1195467751.ps (open in new window)


 
Parameters:
par1 = 1 ; par2 = Do not include Seasonal 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:

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