Home » date » 2007 » Nov » 19 » attachments

regr anal

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 02:50:12 -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/t1195465490v9xxcyhhwzvq5is.htm/, Retrieved Mon, 19 Nov 2007 10:45:25 +0100
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
106.54 107.89 106.44 107.26 106.57 107.76 106.12 107.32 106.13 107.15 106.26 108.04 105.78 106.52 105.77 106.62 105.2 106.47 105.15 105.46 105.01 106.13 104.75 105.15 104.96 105.39 105.26 104.57 105.13 104.29 104.77 104.09 104.79 104.51 104.4 103.39 103.89 102.71 103.93 102.62 103.48 101.94 103.45 101.65 103.47 101.86 103.5 101.27 103.69 101.21 103.57 102.15 103.47 102.07 102.85 102.8 102.54 103.39 102.39 102.71 102.16 102.65 101.51 101.12 100.83 100.29 100.55 99.79 100.88 100.11 101 99.76 100.51 99.96 100.44 99.98 100.32 100.49 99.98 100.75 100.03 100.84 99.64 100.44 99.11 99.57 98.97 99.22 98.6 99.08 98.31 98.04 98.37 98.73 98.19 98.72 98.51 100.07 98.23 99.02 97.96 98.94 97.77 99 97.49 98.54 97.76 98.42 98.01 97.9 97.73 97.46 97.06 97 96.63 95.97 96.58 96.55 96.66 96.51 96.77 96.76 96.5 96.05 96.53 96.47 96.22 96.38 96.49 97.27 96.34 96.67 96.31 96.59 96.06 96.06 95.9 96.92 95.33 94.96 95.53 95.59 95.42 95.68 95.57 95.35 95.3 95.41 95.31 95.32 95.38 95.8 95.22 95.46 94.62 94.16 93.81 92.49 93.6 91.58 93.2 91.5 93.29 90.83 93.54 91.28 93.23 90.57 93.46 90.93 92.82 90.9 92.85 91.49 92.67 91.38 92.32 90.91 92.06 90.72 91.88 89.53 91.53 89.47 91.19 89.28
 
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 time4 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Multiple Linear Regression - Estimated Regression Equation
y[t] = -9.34493940380609 + 1.09136281362709x[t] + e[t]


Multiple Linear Regression - Ordinary Least Squares
VariableParameterS.D.T-STAT
H0: parameter = 0
2-tail p-value1-tail p-value
(Intercept)-9.344939403806092.376769-3.93180.0001648.2e-05
x1.091362813627090.02393645.59500


Multiple Linear Regression - Regression Statistics
Multiple R0.978806779791498
R-squared0.958062712165803
Adjusted R-squared0.957601862848944
F-TEST (value)2078.90665585664
F-TEST (DF numerator)1
F-TEST (DF denominator)91
p-value0
Multiple Linear Regression - Residual Statistics
Residual Standard Deviation1.02853187503467
Sum Squared Residuals96.2668814345723


Multiple Linear Regression - Actuals, Interpolation, and Residuals
Time or IndexActualsInterpolation
Forecast
Residuals
Prediction Error
1107.89106.9288547600240.96114523997586
2107.26106.8197184786610.440281521338944
3107.76106.9615956444330.79840435556744
4107.32106.4704823783000.849517621699604
5107.15106.4813960064370.668603993563355
6108.04106.6232731722081.41672682779182
7106.52106.0994190216670.420580978332819
8106.62106.0885053935310.531494606469105
9106.47105.4664285897631.00357141023653
10105.46105.4118604490820.0481395509178773
11106.13105.2590696551740.870930344825672
12105.15104.9753153236310.174684676368731
13105.39105.2045015144930.185498485507044
14104.57105.531910358581-0.961910358581102
15104.29105.390033192810-1.10003319280956
16104.09104.997142579904-0.90714257990381
17104.51105.018969836176-0.50896983617636
18103.39104.593338338862-1.2033383388618
19102.71104.036743303912-1.32674330391199
20102.62104.080397816457-1.46039781645707
21101.94103.589284550325-1.64928455032488
22101.65103.556543665916-1.90654366591606
23101.86103.578370922189-1.71837092218860
24101.27103.611111806597-2.34111180659742
25101.21103.818470741187-2.60847074118657
26102.15103.687507203551-1.5375072035513
27102.07103.578370922189-1.50837092218861
28102.8102.901725977740-0.101725977739807
29103.39102.5634035055150.82659649448458
30102.71102.3996990834710.310300916528643
31102.65102.1486856363370.501314363662889
32101.12101.439299807480-0.319299807479515
33100.29100.697173094213-0.407173094213087
3499.79100.391591506398-0.601591506397501
35100.11100.751741234894-0.641741234894445
3699.76100.882704772530-1.12270477252969
3799.96100.347936993852-0.387936993852439
3899.98100.271541596899-0.291541596898525
39100.49100.1405780592630.349421940736722
40100.7599.769514702630.980485297369925
41100.8499.82408284331141.01591715668858
42100.4499.39845134599691.04154865400314
4399.5798.82002905477450.749970945225488
4499.2298.66723826086670.552761739133287
4599.0898.26343401982470.816565980175313
4698.0497.94693880387280.0930611961271679
4798.7398.01242057269050.717579427309538
4898.7297.81597526623760.904024733762416
49100.0798.16521136659831.90478863340173
5099.0297.85962977878271.16037022121732
5198.9497.56496181910331.37503818089665
529997.35760288451421.64239711548580
5398.5497.05202129669861.48797870330139
5498.4297.3466892563781.07331074362206
5597.997.61952995978470.28047004021529
5697.4697.31394837196910.146051628030864
579796.5827352868390.41726471316102
5895.9796.1134492769793-0.143449276979326
5996.5596.0588811362980.491118863702023
6096.5196.14619016138810.363809838611866
6196.7696.26624007088710.493759929112887
6296.0595.97157211120780.0784278887921881
6396.4796.00431299561660.465687004383376
6496.3895.66599052339220.714009476607772
6597.2795.96065848307151.30934151692846
6696.6795.79695406102750.873045938972523
6796.5995.76421317661870.825786823381338
6896.0695.49137247321190.568627526788109
6996.9295.31675442303161.60324557696844
7094.9694.6946776192640.265322380735878
7195.5994.91295018198950.677049818010468
7295.6894.79290027249060.88709972750945
7395.3594.95660469453460.393395305465384
7495.4194.66193673485530.748063265144695
7595.3294.67285036299160.647149637008415
7695.894.74924575994551.05075424005453
7795.4694.57462770976510.885372290234858
7894.1693.9198100215890.240189978411106
7992.4993.035806142551-0.545806142550952
8091.5892.8066199516893-1.22661995168925
8191.592.3700748262384-0.870074826238425
8290.8392.4682974794649-1.63829747946487
8391.2892.7411381828716-1.46113818287164
8490.5792.4028157106472-1.83281571064725
8590.9392.6538291577815-1.72382915778145
8690.991.9553569570601-1.05535695706012
8791.4991.988097841469-0.49809784146894
8891.3891.7916525350161-0.411652535016073
8990.9191.4096755502466-0.499675550246581
9090.7291.1259212187036-0.405921218703547
9189.5390.9294759122507-1.39947591225066
9289.4790.5474989274812-1.07749892748119
9389.2890.176435570848-0.896435570847973
 
Charts produced by software:
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195465490v9xxcyhhwzvq5is/1gq1j1195465807.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195465490v9xxcyhhwzvq5is/1gq1j1195465807.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195465490v9xxcyhhwzvq5is/2uzc01195465807.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195465490v9xxcyhhwzvq5is/2uzc01195465807.ps (open in new window)


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


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


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


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


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


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195465490v9xxcyhhwzvq5is/87yof1195465807.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195465490v9xxcyhhwzvq5is/87yof1195465807.ps (open in new window)


http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195465490v9xxcyhhwzvq5is/94y0y1195465807.png (open in new window)
http://127.0.0.1/wessadotnet/public_html/freestatisticsdotorg/blog/date/2007/Nov/19/t1195465490v9xxcyhhwzvq5is/94y0y1195465807.ps (open in new window)


 
Parameters:
par1 = 2 ; 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