Home » date » 2007 » Dec » 22 » attachments

Multiple lineair regression

R Software Module: rwasp_multipleregression.wasp (opens new window with default values)
Title produced by software: Multiple Regression
Date of computation: Sat, 22 Dec 2007 09:30:31 -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/Dec/22/t1198339934ugo23igddcoytxn.htm/, Retrieved Sat, 22 Dec 2007 17:12:29 +0100
 
User-defined keywords:
Goudkoers Inflatie
 
Dataseries X:
» Textbox « » Textfile « » CSV «
10511 1.1 10812 1.3 10738 1.2 10171 1.6 9721 1.7 9897 1.5 9828 0.9 9924 1.5 10371 1.4 10846 1.6 10413 1.7 10709 1.4 10662 1.8 10570 1.7 10297 1.4 10635 1.2 10872 1 10296 1.7 10383 2.4 10431 2 10574 2.1 10653 2 10805 1.8 10872 2.7 10625 2.3 10407 1.9 10463 2 10556 2.3 10646 2.8 10702 2.4 11353 2.3 11346 2.7 11451 2.7 11964 2.9 12574 3 13031 2.2 13812 2.3 14544 2.8 14931 2.8 14886 2.8 16005 2.2 17064 2.6 15168 2.8 16050 2.5 15839 2.4 15137 2.3 14954 1.9 15648 1.7 15305 2 15579 2.1 16348 1.7 15928 1.8 16171 1.8 15937 1.8 15713 1.3 15594 1.3 15683 1.3 16438 1.2 17032 1.4 17696 2.2
 
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
Goud[t] = + 9521.03968922578 -485.323390468976inflatie[t] + 70.033067018788M1[t] + 157.990803021074M2[t] + 122.483860929558M3[t] -80.0389996400236M4[t] + 7.78639731535772M5[t] + 11.9570689363958M6[t] -447.924001917602M7[t] -379.366265915322M8[t] -415.034401150561M9[t] -321.889600767041M10[t] -333.86420381166M11[t] + 140.561667425859t + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)9521.03968922578778.05567512.23700
inflatie-485.323390468976286.152717-1.6960.0966390.04832
M170.033067018788736.7114120.09510.9246790.462339
M2157.990803021074735.5373730.21480.8308750.415438
M3122.483860929558735.5751890.16650.8684820.434241
M4-80.0389996400236733.676362-0.10910.9136030.456802
M57.78639731535772733.1662420.01060.9915720.495786
M611.9570689363958732.17780.01630.9870410.493521
M7-447.924001917602731.746783-0.61210.5434660.271733
M8-379.366265915322731.110496-0.51890.6063250.303162
M9-415.034401150561730.798946-0.56790.5728520.286426
M10-321.889600767041730.502495-0.44060.6615370.330768
M11-333.86420381166730.59874-0.4570.6498410.32492
t140.5616674258599.17272915.323900


Multiple Linear Regression - Regression Statistics
Multiple R0.91870547257001
R-squared0.844019745330085
Adjusted R-squared0.799938369010327
F-TEST (value)19.1468555611266
F-TEST (DF numerator)13
F-TEST (DF denominator)46
p-value2.48689957516035e-14
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation1154.65073860238
Sum Squared Residuals61328043.095131


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
1105119197.778694154591313.22130584542
2108129329.23341948891482.7665805111
3107389482.820483870141255.17951612986
4101719226.72993453882944.270065461176
597219406.58465987317314.415340126828
698979648.38167701386248.618322986138
798289620.2563078671207.743692132889
899249538.18167701386385.818322986137
9103719691.60754825138679.392451748619
10108469828.249337966971017.75066203303
11104139908.30406330131504.695936698691
121070910528.3269516795180.673048320477
131066210544.7923299366117.207670063421
141057010821.8440724116-251.844072411618
151029711072.4958148867-775.495814886657
161063511107.5992998367-472.599299836731
171087211433.0510423118-561.051042311765
181029611238.0570080304-942.057008030382
191038310579.0112312740-196.011231273959
201043110982.2599908897-551.259990889688
211057411038.6211840334-464.621184033411
221065311320.8599908897-667.859990889688
231080511546.5117333647-741.511733364724
241087211584.1465531802-712.146553180164
251062511988.8706438124-1363.87064381240
261040712411.5194034281-2004.51940342814
271046312468.0417897156-2005.04178971558
281055612260.4835794312-1704.48357943117
291064612246.2089485779-1600.20894857792
301070212585.0706438124-1883.07064381241
311135312314.2835794312-961.283579431169
321134612329.2736266717-983.273626671717
331145112434.1671588623-983.167158862338
341196412570.8089485779-606.808948577922
351257412650.8636739123-76.8636739122658
361303113513.5482575250-482.548257524965
371381213675.6106529227136.389347077286
381454413661.4683611164882.531638883626
391493113766.52308645071164.47691354928
401488613704.5618933071181.43810669301
411600514224.14299196961780.85700803038
421706414174.74597482892889.25402517107
431516813758.3618933071409.63810669301
441605014113.07831387581936.92168612418
451583914266.50418511331572.49581488666
461513714548.7429919696588.257008030381
471495414871.459412538582.5405874615483
481564815442.9499618698205.050038130236
491530515507.9476791737-202.947679173718
501557915687.9347435550-108.934743554969
511634815987.1188250769360.881174923100
521592815876.625292886351.3747071137194
531617116105.012357267565.9876427324785
541593716249.7446963144-312.744696314419
551571316173.0869881208-460.086988120768
561559416382.2063915489-788.206391548907
571568316487.0999237395-804.099923739527
581643816769.3387305958-331.338730595804
591703216800.8611168833231.138883116751
601769616887.0282757456808.971724254413
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/155fr1198341026.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/155fr1198341026.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/25cbj1198341026.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/25cbj1198341026.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/3vhw11198341026.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/3vhw11198341026.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/4w4gq1198341026.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/4w4gq1198341026.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/5pade1198341026.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/5pade1198341026.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/6u55t1198341026.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/6u55t1198341026.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/7jze01198341026.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/7jze01198341026.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/8rn851198341026.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/8rn851198341026.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/9u9tg1198341026.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Dec/22/t1198339934ugo23igddcoytxn/9u9tg1198341026.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:

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