Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: xplore

Macro: gls
Description: Computes the Generalized Least Squares estimate for the coefficients of a linear model when the errors have as covariance matrix sigma^2 * om.

Usage: b = gls (x, y{, om})
Input:
x n x p x d1 x ... x dn array
y n x 1 x d1 x ... x dn array
om optional, n x n x d1 x ... x dn array
Output:
b p x 1 x d1 x ... x dn array

Note:

Example:
library("xplore")
randomize(1964)
n = 50
x = matrix(n)~normal(n,2)
beta = #(10, 2, 3)
u = 0.5 * normal(n)
y = x*beta .+ u
b = gls (x, y)
b
Result:
Contents of b
[1,]     9.97 
[2,]   1.9116 
[3,]   3.0123 
Example:
library("xplore")
randomize(1964)
n = 50
x = matrix(n)~normal(n,2)
beta = #(10, 2, 3) 
covar = (0.5.*x[,2] .+ 0.3.*x[,3]).^2
y = x*beta .+ sqrt(covar).*u
b2 = gls (x, y, diag(covar))
b2
Result:
Contents of b2
[1,]   9.9977 
[2,]   1.9946 
[3,]   3.0093  

Library: xplore

Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Author: Sigbert Klinke, 920424, 960327, 960425
(C) MD*TECH Method and Data Technologies, 17.8.2000