[R] nonpos. def. var-cov matrix

Paul, David A paulda at BATTELLE.ORG
Tue Apr 1 00:52:02 CEST 2003


Well, using the Splus language reference menu I was able to find the
way to extract the approximate covariance matrix of the parameters
in the "weights" statement for a *DIFFERENT* model:

"wls2.out$apVar
                       varStruct.const.Group2 varStruct.const.Group1
lSigma
varStruct.const.Group2             219.669352            -461.166077
-1.89736618
varStruct.const.Group1            -461.166077            9774.570475
3.97560767
lSigma                              -1.897366               3.975608
0.01854346
attr(,"Pars")
varStruct.const.Group2 varStruct.const.Group1                 lSigma 
             -2.577615             -14.816961               1.545618"


The 3 x 3 matrix in the first part represents the var-cov matrix of
the constant term for Group2, Group1, and the estimated variance parameter.
This particular matrix is associated with a weights statement that looks
like

"...,weights = varConstPower(form = ~ fitted(.)|Strata.Factor,
fixed = list(power = c(Group1 = 0.5, Group2 = 0.5)), const = 1),..."

I have no idea what the attr(,"Pars") part is telling me.  Trying 

"wls.out$apVar"

on the model I am *actually* interested in yields the not very helpful

[1] "Non-positive definite approximate variance-covariance"

so I guess I'm out of luck.  Suggestions for how to modify my code to
actually
get an estimated covariance matrix and/or do some diagnostics would be
especially 
welcome.  The confidence intervals for the model parameters are what I'm 
really after.

As an aside, I often use the Splus language reference to search for the
proper
tools to use in R.... I'm sure that's bad since I'm wasting my computer
memory 
by having Splus open just so I can look in the language reference
once in a while.  On the other hand, the Splus language reference is a lot
easier to use and it avoids those "...you could try `help.search(" <blah>
")'..."
messages.  Suggestions in this area would also be greatly appreciated.


Respectfully,

  david paul




-----Original Message-----
From: Paul, David A 
Sent: Monday, March 31, 2003 5:07 PM
To: 'r-help at stat.math.ethz.ch'
Subject: [R] nonpos. def. var-cov matrix


R 1.6.2 for Windows, Win2k:

I have fitted a weighted least squares model using the code

"wls.out <- gls(y ~ x1 + x2 + x3 + x4 + x5 + x6 - 1, data = foo.frame, 
weights = varConstPower(form = ~ fitted(.), fixed = list(power = 0.5), 
const = 1))"

The data has 62 rows and the response is zero when the covariates are zero.
The purpose of the model was to account for the the fact that the variances
appear to increase linearly with the fitted values in diagnostic plots.
When I use 

"intervals(wls.out)"

R1.6.2 yields the message

"Error in intervals.gls(wls7.strat1) : Cannot get confidence 
intervals on var-cov components: Non-positive definite approximate 
variance-covariance"

Would I be correct in assuming that this means the form of the 
weighting function is incorrect?  How might I examine the estimated
variance-covariance matrix?  Any suggestions would be greatly 
appreciated.


Respectfully,

 David Paul

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help



More information about the R-help mailing list