Re: [R] non-conformable arrays

2024-09-12 Thread Thierry Onkelinx
Dear Peter, That was indeed this issue. Thanks for the feedback. Best regards, ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST Team Biometrie & Kwaliteitszorg / Team Biome

Re: [R] non-conformable arrays

2024-09-11 Thread Ivan Krylov via R-help
В Wed, 11 Sep 2024 17:55:53 +0200 Thierry Onkelinx пишет: > For those how like a fully reproducible example: > the offending line in the code: > https://github.com/inbo/multimput/blob/e1cd0cdff7d2868e4101c411f7508301c7be7482/R/impute_glmermod.R#L65 > a (failing) unit test for the code: > https://

Re: [R] non-conformable arrays

2024-09-11 Thread peter dalgaard
Hum... Two points: You are using |> a lot and tcrossprod() is a primitive, so ignores argnames. This makes me suspicious that things like ... ) |> tcrossprod(x = mm) might not do what you think it does. E.g., > a <- matrix(1,10,2) > b <- matrix(1,3,2) > tcrossprod(y=b, x=a) [,1] [,2] [

Re: [R] non-conformable arrays

2013-07-24 Thread Thomas Stewart
You need to be careful how you index. In the example code, y is a 'zoo series' and y[i] is gives the ith row, as in y[i, ]. This means t(y[i]) %*% y[i] is actually a 2X2 matrix. Also, the code c(S)[c(1,4,2)] picks off the diagonal and lower triangular elements. The example involves two stocks,

Re: [R] Non-conformable arrays

2011-03-02 Thread Gregory Ryslik
Perfect! Thank you! On Mar 2, 2011, at 10:55 PM, wrote: > Here is one way. > > 1. make sure y.test is a factor > > 2. Use > > table(y.test, > factor(PredictedTestCurrent, levels = levels(y.test)) > > 3. If PredictedTestCurrent is already a factor with the wrong levels, turn it > back in

Re: [R] Non-conformable arrays

2011-03-02 Thread Bill.Venables
Here is one way. 1. make sure y.test is a factor 2. Use table(y.test, factor(PredictedTestCurrent, levels = levels(y.test)) 3. If PredictedTestCurrent is already a factor with the wrong levels, turn it back into a character string vector first. -Original Message- From: r-help-boun