Tk Library Source Code

Attachment Details
Login
Overview

Artifact ID: 8b86dd2a273b766a0bd9fea6310810ddcfd2cdc7
Ticket: 1663970fffffffffffffffffffffffffffffffff
Date: 2007-02-28 17:33:49
User: erickb
Artifact Attached: 866fa3b64dc541b946f4baeda5274b7fbb6232b6
Filename:mvlr.man.txt
Description:
Content:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
   100
   101
   102
   103
   104
   105
   106
   107
   108
   109
mvlinreg 1.0

NAME
----
mvlinreg - Multivariate linear regression

SYNOPSIS
--------
mvlinreg::tstat dof ?alpha?
mvlinreg::wls wt1 {y1 x11 x12 ... x1N} wt2 {y2 x21 x22 ... x2N} ...
mvlinreg::ols {y1 x11 x12 ... x1N} {y2 x21 x22 ... x2N} ...

DESCRIPTION
-----------
The mvlinreg package requires
  ::math::linearalgebra 1.0
  ::math::statistics 0.1.1

The mvlinreg package provides procedures for doing ordinary least
squares (OLS) and weighted least squares (WLS) linear regression.
It also provides a procedure for calculating the value of the
t-statistic for the specified number of degrees of freedom that is
required to demonstrate a given level of significance.

PROCEDURES
----------

::mvlinreg::tstat dof ?alpha?
    Returns the value of the t-distribution t* satisfying
    
               P(t*)  =  1 - alpha/2
               P(-t*) =  alpha/2
    
    for the number of degrees of freedom dof.
    
    Given a sample of normally-distributed data x, with an
    estimate xbar for the mean and sbar for the standard deviation,
    the alpha confidence interval for the estimate of the mean can
    be calculated as
    
          ( xbar - t* sbar , xbar + t* sbar)
    
    The return values from this procedure can be compared to
    an estimated t-statistic to determine whether the estimated
    value of a parameter is significantly different from zero at
    the given confidence level.

::mvlinreg::wls wt1 {y1 x11 x12 ... x1N} wt2 {y2 x21 x22 ... x2N} ...
    Carries out a weighted least squares linear regression for
    the data points provided, with weights assigned to each point.
    
    The linear model is of the form
    
        y = b0 + b1 * x1 + b2 * x2 ... + bN * xN + error
    
    and each point satisfies
    
        yi = b0 + b1 * xi1 + b2 * xi2 + ... + bN * xiN + Residual_i
    
    The procedure returns a list with the following elements:
     * The r-squared statistic
     * The adjusted r-squared statistic
     * A list containing the estimated coefficients b1, ... bN, b0
       (The constant b0 comes last in the list.)
     * A list containing the standard errors of the coefficients
     * A list containing the 95% confidence bounds of the coefficients,
       with each set of bounds returned as a list with two values

::mvlinreg::ols {y1 x11 x12 ... x1N} {y2 x21 x22 ... x2N} ...
    Carries out an ordinary least squares linear regression for
    the data points provided.
    
    This procedure simply calls ::mvlinreg::wls with the weights
    set to 1.0, and returns the same information.

EXAMPLE
-------
# Store the value of the unicode value for the "+/-" character 
set pm "\u00B1"

# Provide some data
set data {{-.67 14.18 60.03 -7.5} \
{36.97 15.52 34.24 14.61} \
{-29.57 21.85 83.36 -7.} \
{-16.9 11.79 51.67 -6.56} \
{14.09 16.24 36.97 -12.84} \
{31.52 20.93 45.99 -25.4} \
{24.05 20.69 50.27 17.27} \
{22.23 16.91 45.07 -4.3} \
{40.79 20.49 38.92 -.73} \
{-10.35 17.24 58.77 18.78}}

# Call the ols routine
set results [eval mvlinreg::ols $data]

# Pretty-print the results
puts "R-squared: [lindex $results 0]"
puts "Adj R-squared: [lindex $results 1]"
puts "Coefficients $pm s.e. -- \[95% confidence interval\]:"
foreach val [lindex $results 2] se [lindex $results 3] bounds [lindex $results 4] {
    set lb [lindex $bounds 0]
    set ub [lindex $bounds 1]
    puts "   $val $pm $se -- \[$lb to $ub\]"
}


SEE ALSO
--------
    ::math::statistics