Skip to content

Error: object is not a matrix

7 messages · Albert Kim, Peter Dalgaard, Peter Ho +1 more

#
Hi,

I have encountered the following error, when using 'aov', which I think
has something to do with the length of my call to 'aov', and I cannot
understand why:

	Error in model.frame.default(formula = Y2 ~ P2 + P2:AAAAAAAA +
P2:B2 +  :
		object is not a matrix


The error occurs when I run the first sequence below, but not the
second.  The two sequences are based on the SAME data, but in one
case, the variable names are longer [Although I don't think the nature
of my analysis is relevant here, it is a 3-way repeated measures
ANOVA;  the "P" factor is a random factor for participants in an
experiment and the A,B,C factors are factorially crossed within P].

## RESULTS IN ERROR:
"P2","AAAAAAAA","B2","C2"))
P2:B2 + P2:C2 + P2:AAAAAAAA:B2 + P2:AAAAAAAA:C2 + P2:B2:C2 +
P2:AAAAAAAA:B2:C2), data=AK2.df)

Error in model.frame.default(formula = Y2 ~ P2 + P2:AAAAAAAA + P2:B2 +  :
	object is not a matrix

## IDENTICAL ANALYSIS WITH DIFFERENT VARIABLE NAMES DOES NOT PRODOCE
ERROR:
P:A:C + P:B:C + P:A:B:C), data=AK.df)

I have reproduced this error in a number of ways, and the only common
characteristic I can see to my actions is that the length of the call
to 'aov' is always too long:  either one of the variable names is too
long, or I include too many error terms, etc...).

Any help would be appreciated,
Al Kim
Research Scientist
Department of Psychology
University of Washington, Box 351525
Seattle, WA. 98195, USA
E-Mail:  alkim at u.washington.edu;  Tel: (206)543-2395



Included below is the data I'm using.
Y P  A     B       C
1  10 1 E1   Red   Agent
2   9 1 E1   Red Patient
3   0 1 E1 Unred   Agent
4   0 1 E1 Unred Patient
5   5 1 E2   Red   Agent
6   6 1 E2   Red Patient
7   0 1 E2 Unred   Agent
8   0 1 E2 Unred Patient
9   8 2 E1   Red   Agent
10  9 2 E1   Red Patient
11  0 2 E1 Unred   Agent
12  0 2 E1 Unred Patient
13  4 2 E2   Red   Agent
14  4 2 E2   Red Patient
15  0 2 E2 Unred   Agent
16  0 2 E2 Unred Patient
17 12 3 E1   Red   Agent
18 11 3 E1   Red Patient
19  2 3 E1 Unred   Agent
20  0 3 E1 Unred Patient
21  6 3 E2   Red   Agent
22  7 3 E2   Red Patient
23  0 3 E2 Unred   Agent
24  0 3 E2 Unred Patient
Y2 P2 AAAAAAAA    B2      C2
1  10  1       E1   Red   Agent
2   9  1       E1   Red Patient
3   0  1       E1 Unred   Agent
4   0  1       E1 Unred Patient
5   5  1       E2   Red   Agent
6   6  1       E2   Red Patient
7   0  1       E2 Unred   Agent
8   0  1       E2 Unred Patient
9   8  2       E1   Red   Agent
10  9  2       E1   Red Patient
11  0  2       E1 Unred   Agent
12  0  2       E1 Unred Patient
13  4  2       E2   Red   Agent
14  4  2       E2   Red Patient
15  0  2       E2 Unred   Agent
16  0  2       E2 Unred Patient
17 12  3       E1   Red   Agent
18 11  3       E1   Red Patient
19  2  3       E1 Unred   Agent
20  0  3       E1 Unred Patient
21  6  3       E2   Red   Agent
22  7  3       E2   Red Patient
23  0  3       E2 Unred   Agent
24  0  3       E2 Unred Patient


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Albert Kim <alkim at u.washington.edu> writes:
A similar error was fixed in 1.5.0. Which version are you using?

    o   aov() and model.tables() were failing on multistrata models with
        excessively long Error formula. (PR#1315)
#
I'm running 1.4.1.  I'll try the latest version.
Thanks,
Al Kim
Research Scientist
Department of Psychology
University of Washington, Box 351525
Seattle, WA. 98195, USA
E-Mail:  alkim at u.washington.edu;  Tel: (206)543-2395
On 22 Aug 2002, Peter Dalgaard BSA wrote:

            
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
I have updated to R 1.5.1, but now get a new error, which appears to
have the same cause:
P:CLongFactorName + P:A:B + P:A:CLongFactorName + P:B:CLongFactorName +
P:A:B:CLongFactorName), data=AK.df)

Error in eval(expr, envir, enclos) : couldn't find function "Error"

I can avoid the error by either of the following steps:
	1)  replace "CLongFactorName" with the shorter label "C"
	2)  reduce the number of terms in my Error formula.

Thanks
Al
--
Al Kim
Research Scientist
Department of Psychology
University of Washington, Box 351525
Seattle, WA. 98195, USA
E-Mail:  alkim at u.washington.edu;  Tel: (206)543-2395
On Thu, 22 Aug 2002, Albert Kim wrote:

            
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
There is another call to deparse in aov(),  Does adding width = 500 to
that call solve this?

If not, please submit a bug report with a reproducible example: there is
nothing here I can try.
On Thu, 22 Aug 2002, Albert Kim wrote:

            

  
    
#
I had a similar problem with a long Error formula. I sent an email to 
the list a few days ago.

Subject:
Re: [R]: Bug in Error() and the use of Error() for repeated measures 
with more than 2 factors
From:
Peter Ho <peter at esb.ucp.pt>
Date:
Mon, 19 Aug 2002 14:33:01 +0100

To:
ripley at stats.ox.ac.uk, r-help at stat.math.ethz.ch


I have repeated my analysis using shorter factor names , where the 
following  original formula:


simulation.blockE.aov.CV.3waymodel <- aov(CV 
~(Twb+Plb+Psb+tinsb+tseedb+Tmb+Mcb+Mom0b+Mom1b+Mom2b+Mom3b)^3 + 
Error(Batch / 
(Twb+Plb+Psb+tinsb+tseedb+Tmb+Mcb+Mom0b+Mom1b+Mom2b+Mom3b)), data= 
simulation.6batches.aovdata)

 gave an error:

Error in eval(expr, envir, enclos) : couldn't find function "Error"

The now shortened factor names formula below works :

simulation.blockE.aov.CV.3waymodel.S <- aov(CV 
~(Tw+Pl+Ps+ti+ts+Tm+Mc+M0+M1+M2+M3)^3 + Error(B/ 
(Tw+Pl+Ps+ti+ts+Tm+Mc+M0+M1+M2+M3)),simulation.aovdata.S)

So this solves the problem I had earlier, although
ripley at stats.ox.ac.uk wrote:

            
I have tried this , but got the following error:

 > simulation.blockE.aov.CV.3waymodel <- aov(CV 
~(Twb+Plb+Psb+tinsb+tseedb+Tmb+Mcb+Mom0b+Mom1b+Mom2b+Mom3b)^3 + 
Error(Batch / 
(Twb+Plb+Psb+tinsb+tseedb+Tmb+Mcb+Mom0b+Mom1b+Mom2b+Mom3b)),width = 500, 
data= simulation.6batches.aovdata)

Error in eval(expr, envir, enclos) : couldn't find function "Error"
In addition: Warning message:
Extra arguments 500 are just disregarded. in: lm.fit(x, y, offset = 
offset, ...)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
1 day later
#
On Fri, 23 Aug 2002 ripley at stats.ox.ac.uk wrote:

            
It does.  Unfortunately, deparse is currently broken in R-devel which
complicated finding this.

[...]