Error in gee.fit$working.correlation[1, 2] : subscript out of bounds

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error in gee.fit$working.correlation[1, 2] : subscript out of bounds

Phat Chau
Hello,

I have a dataframe in R that looks like the following

  cluster id period   u_3 timeID startTrt Ijt    error      y
1:       1  1      0 -1.26      1        1   0   1.2015 17.809
2:       1  2      0 -1.26      1        1   0  -1.6577 14.950
3:       1  3      0 -1.26      1        1   0  -3.8639 12.744
4:       1  4      0 -1.26      1        1   0   1.4978 18.105
5:       1  5      0 -1.26      1        1   0  -5.3182 11.289

When I try to run a gee model on it using the geesmv package which adjusts the variance covariance matrix for small sample sizes as follows

test <- GEE.var.fg(y ~ factor(period) + factor(Ijt),id="id",family=gaussian, dx,corstr="exchangeable")

I get this error message:

Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27
running glm to get initial regression estimate
    (Intercept) factor(period)1 factor(period)2 factor(period)3 factor(period)4 factor(period)5    factor(Ijt)1
          17.25           -8.27           -6.47           -9.13           -8.17          -11.89            8.96
Error in gee.fit$working.correlation[1, 2] : subscript out of bounds

I think the usual culprit for this kind of error message is that the variable being referred to (id in this case I assume) is non-existent. That is clearly not the case here and I checked to make sure it is it not a typo.

Does anyone know why this is? How would I troubleshoot this?

Thank you,
Edward


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Error in gee.fit$working.correlation[1, 2] : subscript out of bounds

R help mailing list-2
The usual reason for the 'subscript out of bounds' error is that an array's
subscripts exceed the dimensions of the array.  In this case
gee.fit$working.correlation is a 1 by 1 matrix, so subscripting with [1,2]
will cause the error.

Here is a self-contained example that you can send the package's maintainer.

> maintainer("geesmv")
[1] "Zheng Li <[hidden email]>"

> dx <- cbind(id=1:18, y=sin(1:18), expand.grid(period=c(1.1,1.2,1.3),
Ijt=c("i","ii","iii"))[c(1:9,1:9),])
> options(error=recover)
> test <- GEE.var.fg(y ~ factor(period) +
factor(Ijt),id="id",family=gaussian, dx,corstr="exchangeable")
Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27
running glm to get initial regression estimate
      (Intercept) factor(period)1.2 factor(period)1.3     factor(Ijt)ii
       0.02712257       -0.06015777       -0.11555784        0.04243596
   factor(Ijt)iii
       0.04114518
Error in gee.fit$working.correlation[1, 2] : subscript out of bounds

Enter a frame number, or 0 to exit

1: GEE.var.fg(y ~ factor(period) + factor(Ijt), id = "id", family =
gaussian,

Selection: 1
Called from: top level
Browse[1]> str(gee.fit$working.correlation)
 num [1, 1] 1

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Fri, Jun 5, 2020 at 12:28 AM Phat Chau <[hidden email]>
wrote:

> Hello,
>
> I have a dataframe in R that looks like the following
>
>   cluster id period   u_3 timeID startTrt Ijt    error      y
> 1:       1  1      0 -1.26      1        1   0   1.2015 17.809
> 2:       1  2      0 -1.26      1        1   0  -1.6577 14.950
> 3:       1  3      0 -1.26      1        1   0  -3.8639 12.744
> 4:       1  4      0 -1.26      1        1   0   1.4978 18.105
> 5:       1  5      0 -1.26      1        1   0  -5.3182 11.289
>
> When I try to run a gee model on it using the geesmv package which adjusts
> the variance covariance matrix for small sample sizes as follows
>
> test <- GEE.var.fg(y ~ factor(period) +
> factor(Ijt),id="id",family=gaussian, dx,corstr="exchangeable")
>
> I get this error message:
>
> Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27
> running glm to get initial regression estimate
>     (Intercept) factor(period)1 factor(period)2 factor(period)3
> factor(period)4 factor(period)5    factor(Ijt)1
>           17.25           -8.27           -6.47           -9.13
>  -8.17          -11.89            8.96
> Error in gee.fit$working.correlation[1, 2] : subscript out of bounds
>
> I think the usual culprit for this kind of error message is that the
> variable being referred to (id in this case I assume) is non-existent. That
> is clearly not the case here and I checked to make sure it is it not a typo.
>
> Does anyone know why this is? How would I troubleshoot this?
>
> Thank you,
> Edward
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.