Re: [R-pkg-devel] [Error] data length differs from size of matrix

2021-06-04 Thread Tiago Olivoto
Exactly Bill!
I'll implement your suggestion (solve_svd(cor.x2)%*%cor.y), to return betas.
Best!
Tiago


Em sex., 4 de jun. de 2021 às 15:12, Bill Dunlap 
escreveu:

> solve_svd's second argument is 'tolerance', a small scalar value, not the
> right hand side of X %*% beta == Y.  It returns the [approximate] inverse
> of X, not beta.
>
> solve_svd(cor.x2,cor.y) should probably be solve_svd(cor.x2)%*%cor.y (or
> just solve(cor.x2,cor.y)).
>
> -Bill
>
> On Fri, Jun 4, 2021 at 8:41 AM Bill Dunlap 
> wrote:
>
>> The offending line in path_coeff seems to be
>>betas[i, 2:nvar] <- t(solve_svd(cor.x2, cor.y))
>> where i is a single integer, nvar is 15, and the right hand side is a 14
>> by 14 matrix.  What is this line trying to do?  Did it ever give the
>> correct result?
>>
>> -Bill
>>
>>
>> On Fri, Jun 4, 2021 at 7:39 AM Bill Dunlap 
>> wrote:
>>
>>> That log file includes the line
>>> using R Under development (unstable) (2021-05-30 r80413)
>>> and later says
>>>
>>> The error most likely occurred in:
>>>
>>> > ### Name: path_coeff
>>> > ### Title: Path coefficients with minimal multicollinearity
>>> > ### Aliases: path_coeff path_coeff_mat
>>> >
>>> > ### ** Examples
>>> >
>>> > ## No test:
>>> > library(metan)
>>> >
>>> > # Using KW as the response variable and all other ones as predictors
>>> > pcoeff <- path_coeff(data_ge2, resp = KW)
>>> Error in matrix(value, n, p) :
>>>   data length differs from size of matrix: [196 != 1 x 14]
>>> Calls: path_coeff -> [<- -> [<-.data.frame -> matrix
>>> Execution halted
>>>
>>> In the current R-devel the matrix command matrix(value, nrow, ncol) 
>>> complains if length(value)>nrow*ncol, so you need to truncate 'value'.  
>>> (Previously matrix() would silently truncate value.)
>>>
>>>
>>> -Bill
>>>
>>>
>>> On Thu, Jun 3, 2021 at 5:57 PM Tiago Olivoto 
>>> wrote:
>>>
 Dear all,
 I have received an email from the CRAN team to fix a problem with my R
 package metan > to safely retain it on
 CRAN.

 The error is given at <
 https://www.stats.ox.ac.uk/pub/bdr/donttest/metan.out>
 and seems to be related to data different from size of matrix.

 The question is that and I cannot reproduce the error locally and thus
 not
 able to fix anything. By googling the error I've seen similar issues
 with a
 lot of other packages. Could be this be a temporary issue?

 Thanks in advance!
 Tiago

 [[alternative HTML version deleted]]

 __
 R-package-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-package-devel

>>>

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] [Error] data length differs from size of matrix

2021-06-04 Thread Bill Dunlap
solve_svd's second argument is 'tolerance', a small scalar value, not the
right hand side of X %*% beta == Y.  It returns the [approximate] inverse
of X, not beta.

solve_svd(cor.x2,cor.y) should probably be solve_svd(cor.x2)%*%cor.y (or
just solve(cor.x2,cor.y)).

-Bill

On Fri, Jun 4, 2021 at 8:41 AM Bill Dunlap  wrote:

> The offending line in path_coeff seems to be
>betas[i, 2:nvar] <- t(solve_svd(cor.x2, cor.y))
> where i is a single integer, nvar is 15, and the right hand side is a 14
> by 14 matrix.  What is this line trying to do?  Did it ever give the
> correct result?
>
> -Bill
>
>
> On Fri, Jun 4, 2021 at 7:39 AM Bill Dunlap 
> wrote:
>
>> That log file includes the line
>> using R Under development (unstable) (2021-05-30 r80413)
>> and later says
>>
>> The error most likely occurred in:
>>
>> > ### Name: path_coeff
>> > ### Title: Path coefficients with minimal multicollinearity
>> > ### Aliases: path_coeff path_coeff_mat
>> >
>> > ### ** Examples
>> >
>> > ## No test:
>> > library(metan)
>> >
>> > # Using KW as the response variable and all other ones as predictors
>> > pcoeff <- path_coeff(data_ge2, resp = KW)
>> Error in matrix(value, n, p) :
>>   data length differs from size of matrix: [196 != 1 x 14]
>> Calls: path_coeff -> [<- -> [<-.data.frame -> matrix
>> Execution halted
>>
>> In the current R-devel the matrix command matrix(value, nrow, ncol) 
>> complains if length(value)>nrow*ncol, so you need to truncate 'value'.  
>> (Previously matrix() would silently truncate value.)
>>
>>
>> -Bill
>>
>>
>> On Thu, Jun 3, 2021 at 5:57 PM Tiago Olivoto 
>> wrote:
>>
>>> Dear all,
>>> I have received an email from the CRAN team to fix a problem with my R
>>> package metan >> > to safely retain it on CRAN.
>>>
>>> The error is given at <
>>> https://www.stats.ox.ac.uk/pub/bdr/donttest/metan.out>
>>> and seems to be related to data different from size of matrix.
>>>
>>> The question is that and I cannot reproduce the error locally and thus
>>> not
>>> able to fix anything. By googling the error I've seen similar issues
>>> with a
>>> lot of other packages. Could be this be a temporary issue?
>>>
>>> Thanks in advance!
>>> Tiago
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> __
>>> R-package-devel@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>>
>>

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] [Error] data length differs from size of matrix

2021-06-04 Thread Tiago Olivoto
Thanks, Bill and Max for your suggestions.
I was using R 4.1.0. After updating to R-devel I was able to reproduce the
error, which was just fixed by using solve() instead solve_svd() in the
line suggested by Bill.

Best regards,
Tiago

Em sex., 4 de jun. de 2021 às 12:41, Bill Dunlap 
escreveu:

> The offending line in path_coeff seems to be
>betas[i, 2:nvar] <- t(solve_svd(cor.x2, cor.y))
> where i is a single integer, nvar is 15, and the right hand side is a 14
> by 14 matrix.  What is this line trying to do?  Did it ever give the
> correct result?
>
> -Bill
>
>
> On Fri, Jun 4, 2021 at 7:39 AM Bill Dunlap 
> wrote:
>
>> That log file includes the line
>> using R Under development (unstable) (2021-05-30 r80413)
>> and later says
>>
>> The error most likely occurred in:
>>
>> > ### Name: path_coeff
>> > ### Title: Path coefficients with minimal multicollinearity
>> > ### Aliases: path_coeff path_coeff_mat
>> >
>> > ### ** Examples
>> >
>> > ## No test:
>> > library(metan)
>> >
>> > # Using KW as the response variable and all other ones as predictors
>> > pcoeff <- path_coeff(data_ge2, resp = KW)
>> Error in matrix(value, n, p) :
>>   data length differs from size of matrix: [196 != 1 x 14]
>> Calls: path_coeff -> [<- -> [<-.data.frame -> matrix
>> Execution halted
>>
>> In the current R-devel the matrix command matrix(value, nrow, ncol) 
>> complains if length(value)>nrow*ncol, so you need to truncate 'value'.  
>> (Previously matrix() would silently truncate value.)
>>
>>
>> -Bill
>>
>>
>> On Thu, Jun 3, 2021 at 5:57 PM Tiago Olivoto 
>> wrote:
>>
>>> Dear all,
>>> I have received an email from the CRAN team to fix a problem with my R
>>> package metan >> > to safely retain it on CRAN.
>>>
>>> The error is given at <
>>> https://www.stats.ox.ac.uk/pub/bdr/donttest/metan.out>
>>> and seems to be related to data different from size of matrix.
>>>
>>> The question is that and I cannot reproduce the error locally and thus
>>> not
>>> able to fix anything. By googling the error I've seen similar issues
>>> with a
>>> lot of other packages. Could be this be a temporary issue?
>>>
>>> Thanks in advance!
>>> Tiago
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> __
>>> R-package-devel@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>>
>>

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] [Error] data length differs from size of matrix

2021-06-04 Thread Bill Dunlap
The offending line in path_coeff seems to be
   betas[i, 2:nvar] <- t(solve_svd(cor.x2, cor.y))
where i is a single integer, nvar is 15, and the right hand side is a 14 by
14 matrix.  What is this line trying to do?  Did it ever give the correct
result?

-Bill


On Fri, Jun 4, 2021 at 7:39 AM Bill Dunlap  wrote:

> That log file includes the line
> using R Under development (unstable) (2021-05-30 r80413)
> and later says
>
> The error most likely occurred in:
>
> > ### Name: path_coeff
> > ### Title: Path coefficients with minimal multicollinearity
> > ### Aliases: path_coeff path_coeff_mat
> >
> > ### ** Examples
> >
> > ## No test:
> > library(metan)
> >
> > # Using KW as the response variable and all other ones as predictors
> > pcoeff <- path_coeff(data_ge2, resp = KW)
> Error in matrix(value, n, p) :
>   data length differs from size of matrix: [196 != 1 x 14]
> Calls: path_coeff -> [<- -> [<-.data.frame -> matrix
> Execution halted
>
> In the current R-devel the matrix command matrix(value, nrow, ncol) complains 
> if length(value)>nrow*ncol, so you need to truncate 'value'.  (Previously 
> matrix() would silently truncate value.)
>
>
> -Bill
>
>
> On Thu, Jun 3, 2021 at 5:57 PM Tiago Olivoto 
> wrote:
>
>> Dear all,
>> I have received an email from the CRAN team to fix a problem with my R
>> package metan > > to safely retain it on CRAN.
>>
>> The error is given at <
>> https://www.stats.ox.ac.uk/pub/bdr/donttest/metan.out>
>> and seems to be related to data different from size of matrix.
>>
>> The question is that and I cannot reproduce the error locally and thus not
>> able to fix anything. By googling the error I've seen similar issues with
>> a
>> lot of other packages. Could be this be a temporary issue?
>>
>> Thanks in advance!
>> Tiago
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-package-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>
>

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] [Error] data length differs from size of matrix

2021-06-04 Thread Bill Dunlap
That log file includes the line
using R Under development (unstable) (2021-05-30 r80413)
and later says

The error most likely occurred in:

> ### Name: path_coeff
> ### Title: Path coefficients with minimal multicollinearity
> ### Aliases: path_coeff path_coeff_mat
>
> ### ** Examples
>
> ## No test:
> library(metan)
>
> # Using KW as the response variable and all other ones as predictors
> pcoeff <- path_coeff(data_ge2, resp = KW)
Error in matrix(value, n, p) :
  data length differs from size of matrix: [196 != 1 x 14]
Calls: path_coeff -> [<- -> [<-.data.frame -> matrix
Execution halted

In the current R-devel the matrix command matrix(value, nrow, ncol)
complains if length(value)>nrow*ncol, so you need to truncate 'value'.
(Previously matrix() would silently truncate value.)


-Bill


On Thu, Jun 3, 2021 at 5:57 PM Tiago Olivoto  wrote:

> Dear all,
> I have received an email from the CRAN team to fix a problem with my R
> package metan  > to safely retain it on CRAN.
>
> The error is given at <
> https://www.stats.ox.ac.uk/pub/bdr/donttest/metan.out>
> and seems to be related to data different from size of matrix.
>
> The question is that and I cannot reproduce the error locally and thus not
> able to fix anything. By googling the error I've seen similar issues with a
> lot of other packages. Could be this be a temporary issue?
>
> Thanks in advance!
> Tiago
>
> [[alternative HTML version deleted]]
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] [Error] data length differs from size of matrix

2021-06-04 Thread Max Turgeon
I apologize for the wrong link below; as described here: 
https://cran.r-project.org/doc/manuals/r-devel/NEWS.html



Max Turgeon<https://www.name-coach.com/maxime-turgeon>
Assistant Professor
Department of Statistics
Department of Computer Science
University of Manitoba
maxturgeon.ca<http://maxturgeon.ca>



From: R-package-devel  on behalf of Max 
Turgeon 
Sent: Friday, June 4, 2021 9:35 AM
To: Tiago Olivoto ; R Package Devel 

Subject: Re: [R-pkg-devel] [Error] data length differs from size of matrix


Caution: This message was sent from outside the University of Manitoba.


Hi Tiago,

Which version of R are you using? You will probably need to use the R-devel 
version to reproduce the error AND set a flag, as described here: 
https://cran.r-project.org/

Best,


Max Turgeon<https://www.name-coach.com/maxime-turgeon>
Assistant Professor
Department of Statistics
Department of Computer Science
University of Manitoba
maxturgeon.ca<http://maxturgeon.ca>



From: R-package-devel  on behalf of 
Tiago Olivoto 
Sent: Thursday, June 3, 2021 7:56 PM
To: R Package Devel 
Subject: [R-pkg-devel] [Error] data length differs from size of matrix


Caution: This message was sent from outside the University of Manitoba.


Dear all,
I have received an email from the CRAN team to fix a problem with my R
package metan <https://CRAN.R-project.org/package=metan
<https://cran.r-project.org/package=metan>> to safely retain it on CRAN.

The error is given at <https://www.stats.ox.ac.uk/pub/bdr/donttest/metan.out>
and seems to be related to data different from size of matrix.

The question is that and I cannot reproduce the error locally and thus not
able to fix anything. By googling the error I've seen similar issues with a
lot of other packages. Could be this be a temporary issue?

Thanks in advance!
Tiago

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[R-pkg-devel] [Error] data length differs from size of matrix

2021-06-03 Thread Tiago Olivoto
Dear all,
I have received an email from the CRAN team to fix a problem with my R
package metan > to safely retain it on CRAN.

The error is given at 
and seems to be related to data different from size of matrix.

The question is that and I cannot reproduce the error locally and thus not
able to fix anything. By googling the error I've seen similar issues with a
lot of other packages. Could be this be a temporary issue?

Thanks in advance!
Tiago

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel