compef {lazy.sasef} | R Documentation |

Comparison of Two Different Parametrization of a Linear Model

compef(obj1 = NULL, obj2 = NULL, print = 0)

`obj1` |
A design object for model1 |

`obj2` |
A design object for model2 |

`print` |
= 1 to print the result |

This program compares the following two equivalent linear models:

model1: yhat = X beta and model2: yhat = Z alpha

where Z is a design matrix of full column rank.

Note that the estimable function of model1 is:

Q = L matSwp(t(X)%*%X)%*%t(X)%*%X

and that Z can be expressed as

Z = X%*%matSwp(t(X)%*%X)%*%t(X)%*%Z .

By multiplying L matSwp(t(X)%*%X)%*%t(X) to the both sides of

X beta = Z alpha

we have,

L matSwp(t(X)%*%X)%*%t(X) %*% X beta
= L matSwp(t(X)%*%X)%*%t(X) %*% Z alpha

Q beta = L matSwp(t(X)%*%X)%*%t(X)%*%
X%*%matSwp(t(X)%*%X)%*%t(X)%*%Z alpha

Q beta = L matSwp(t(X)%*%X)%*%t(X)%*%X
%*%matSwp(t(X)%*%X)%*%t(X)%*%Z alpha

Q beta = Q matSwp(t(X)%*%X)%*%t(X)%*%Z alpha

The correspondence from alpha to beta is obtained by

beta = R %*% alpha

where

R = Q matSwp(t(X)%*%X)%*%t(X)%*%Z

A design object is a list of the design matrix (X),
infomation list (info) and parameter list (param) where

X is the design matrix

and

info is a list whose length is the number of effects.

info[[i]] contains the following:

ename name of effect[i]

order order of effect[i]: 0, 1, ..., maxorder

elevels # of levels of effect[i]

df degrees of freedom of effect[i]

erange range of effect[i] in the (full rank) estimable functions

range=cbind(from,to) where

from is the starting independent colmn of effect[i] in X

to is the ending independent column of effect[i] in X

rangef=cbind(from,to) where

from is the starting colmn of effect[i] in X

to is the ending column of effect[i] in X

menum vector of main effect number involved in effect[i]
contained vector of effect numbers which contains effect[i]

where effect number is defined according to the order of column of X.

contains vector of effects which effect[i] contais.

param is a list consisting of

type, drop, maxorder, sort, pattern

ef Information of estimable function..

List of Q, R, Rf, Rc

where Q is the numeric form of estimable functions

R = Q matSwp(t(X)%*%X)%*%t(X)%*%Z

Rf Fractional expression of R

Rc Character version of R

# SAS type III EF in terms of the Cell Means data <- du23[,1:2] res1 <- design_mat( data, type=-1, pattern="a", sort=0 ) ef1 <- sasef_III( res1, print=1 ) res2 <- design_mat( data, type=-2 ) temp=compef( ef1, res2, print=3 ) # Cell Means in terms of SAS type III EF data <- du23[,1:2] res2 <- design_mat( data, type=-1, pattern="a", sort=0 ) res1 <- design_mat( data, type=-2 ) ef1 <- res1 temp=compef( ef1, res2, print=3 ) # Zero-Sum in terms of the Cell Means data <- du23[,1:2] res1 <- design_mat( data, type=0, pattern="a", sort=0 ) ef1 <- sasef_III( res1, print=1 ) res2 <- design_mat( data, type=-2 ) temp=compef( ef1, res2, print=3 ) # Cell Means in terms of Zero-Sum data <- du23[,1:2] res2 <- design_mat( data, type=0, pattern="a", sort=0 ) res1 <- design_mat( data, type=-2 ) ef1 <- res1 temp=compef( ef1, res2, print=3 ) # type III in terms of zero-sum data=du23[,1:2] res1=design_mat( data, type=-1, pattern="a", sort=0 ) ef1=sasef_III( res1, print=2 ) res2=design_mat( data, type=0 ) temp=compef( ef1, res2, print=3 ) # zero-sum in terms of sas non-full-rank X: # This should gives us the type III ef. data=du23[,1:2] res2=design_mat( data, type=-1, pattern="a", sort=0 ) res1=design_mat( data, type=0 ) ef1=res1 temp=compef( ef1, res2, print=3 )

[Package *lazy.sasef* version 0.1.2 Index]