Re: [Rd] Cannot Compute Box's M (Three Days Trying...)

2017-10-27 Thread Duncan Murdoch
Just print the string you are asking to R to evaluate.  It doesn't make 
any sense as an R expression.  Fix that, and things will work.


Duncan Murdoch

On 27/10/2017 3:41 PM, Morkus via R-devel wrote:

It can't be this hard, right? I really need a shove in the right direction 
here. Been spinning wheels for three days. Cannot get past the errors.

I'm doing something wrong, obviously, since I can easily compute the Box's M 
right there in RStudio

But I don't see what is wrong below with the coding equivalent.

The entire code snippet is below. The code fails below on the call to the boxM 
statistic call.

PLEASE HELP!!!

Thanks in advance,

-

rConnection.eval("library('biotools')");

String inputIris = "5.1,3.5,1.4,0.2,setosa\n" +
"4.9,3,1.4,0.2,setosa\n" +
"4.7,3.2,1.3,0.2,setosa\n" +
"4.6,3.1,1.5,0.2,setosa\n" +
"5,3.6,1.4,0.2,setosa\n" +
"5.4,3.9,1.7,0.4,setosa\n" +
"4.6,3.4,1.4,0.3,setosa\n" +
"5,3.4,1.5,0.2,setosa\n" +
"4.4,2.9,1.4,0.2,setosa\n" +
"4.9,3.1,1.5,0.1,setosa\n" +
"5.4,3.7,1.5,0.2,setosa\n" +
"4.8,3.4,1.6,0.2,setosa\n" +
"4.8,3,1.4,0.1,setosa\n" +
"4.3,3,1.1,0.1,setosa\n" +
"5.8,4,1.2,0.2,setosa\n" +
"5.7,4.4,1.5,0.4,setosa\n" +
"5.4,3.9,1.3,0.4,setosa\n" +
"5.1,3.5,1.4,0.3,setosa\n" +
"5.7,3.8,1.7,0.3,setosa\n" +
"5.1,3.8,1.5,0.3,setosa\n" +
"5.4,3.4,1.7,0.2,setosa\n" +
"5.1,3.7,1.5,0.4,setosa\n" +
"4.6,3.6,1,0.2,setosa\n" +
"5.1,3.3,1.7,0.5,setosa\n" +
"4.8,3.4,1.9,0.2,setosa\n" +
"5,3,1.6,0.2,setosa\n" +
"5,3.4,1.6,0.4,setosa\n" +
"5.2,3.5,1.5,0.2,setosa\n" +
"5.2,3.4,1.4,0.2,setosa\n" +
"4.7,3.2,1.6,0.2,setosa\n" +
"4.8,3.1,1.6,0.2,setosa\n" +
"5.4,3.4,1.5,0.4,setosa\n" +
"5.2,4.1,1.5,0.1,setosa\n" +
"5.5,4.2,1.4,0.2,setosa\n" +
"4.9,3.1,1.5,0.2,setosa\n" +
"5,3.2,1.2,0.2,setosa\n" +
"5.5,3.5,1.3,0.2,setosa\n" +
"4.9,3.6,1.4,0.1,setosa\n" +
"4.4,3,1.3,0.2,setosa\n" +
"5.1,3.4,1.5,0.2,setosa\n" +
"5,3.5,1.3,0.3,setosa\n" +
"4.5,2.3,1.3,0.3,setosa\n" +
"4.4,3.2,1.3,0.2,setosa\n" +
"5,3.5,1.6,0.6,setosa\n" +
"5.1,3.8,1.9,0.4,setosa\n" +
"4.8,3,1.4,0.3,setosa\n" +
"5.1,3.8,1.6,0.2,setosa\n" +
"4.6,3.2,1.4,0.2,setosa\n" +
"5.3,3.7,1.5,0.2,setosa\n" +
"5,3.3,1.4,0.2,setosa\n" +
"7,3.2,4.7,1.4,versicolor\n" +
"6.4,3.2,4.5,1.5,versicolor\n" +
"6.9,3.1,4.9,1.5,versicolor\n" +
"5.5,2.3,4,1.3,versicolor\n" +
"6.5,2.8,4.6,1.5,versicolor\n" +
"5.7,2.8,4.5,1.3,versicolor\n" +
"6.3,3.3,4.7,1.6,versicolor\n" +
"4.9,2.4,3.3,1,versicolor\n" +
"6.6,2.9,4.6,1.3,versicolor\n" +
"5.2,2.7,3.9,1.4,versicolor\n" +
"5,2,3.5,1,versicolor\n" +
"5.9,3,4.2,1.5,versicolor\n" +
"6,2.2,4,1,versicolor\n" +
"6.1,2.9,4.7,1.4,versicolor\n" +
"5.6,2.9,3.6,1.3,versicolor\n" +
"6.7,3.1,4.4,1.4,versicolor\n" +
"5.6,3,4.5,1.5,versicolor\n" +
"5.8,2.7,4.1,1,versicolor\n" +
"6.2,2.2,4.5,1.5,versicolor\n" +
"5.6,2.5,3.9,1.1,versicolor\n" +
"5.9,3.2,4.8,1.8,versicolor\n" +
"6.1,2.8,4,1.3,versicolor\n" +
"6.3,2.5,4.9,1.5,versicolor\n" +
"6.1,2.8,4.7,1.2,versicolor\n" +
"6.4,2.9,4.3,1.3,versicolor\n" +
"6.6,3,4.4,1.4,versicolor\n" +
"6.8,2.8,4.8,1.4,versicolor\n" +
"6.7,3,5,1.7,versicolor\n" +
"6,2.9,4.5,1.5,versicolor\n" +
"5.7,2.6,3.5,1,versicolor\n" +
"5.5,2.4,3.8,1.1,versicolor\n" +
"5.5,2.4,3.7,1,versicolor\n" +
"5.8,2.7,3.9,1.2,versicolor\n" +
"6,2.7,5.1,1.6,versicolor\n" +
"5.4,3,4.5,1.5,versicolor\n" +
"6,3.4,4.5,1.6,versicolor\n" +
"6.7,3.1,4.7,1.5,versicolor\n" +
"6.3,2.3,4.4,1.3,versicolor\n" +
"5.6,3,4.1,1.3,versicolor\n" +
"5.5,2.5,4,1.3,versicolor\n" +
"5.5,2.6,4.4,1.2,versicolor\n" +
"6.1,3,4.6,1.4,versicolor\n" +
"5.8,2.6,4,1.2,versicolor\n" +
"5,2.3,3.3,1,versicolor\n" +
"5.6,2.7,4.2,1.3,versicolor\n" +
"5.7,3,4.2,1.2,versicolor\n" +
"5.7,2.9,4.2,1.3,versicolor\n" +
"6.2,2.9,4.3,1.3,versicolor\n" +
"5.1,2.5,3,1.1,versicolor\n" +
"5.7,2.8,4.1,1.3,versicolor\n" +
"6.3,3.3,6,2.5,virginica\n" +
"5.8,2.7,5.1,1.9,virginica\n" +
"7.1,3,5.9,2.1,virginica\n" +
"6.3,2.9,5.6,1.8,virginica\n" +
"6.5,3,5.8,2.2,virginica\n" +
"7.6,3,6.6,2.1,virginica\n" +
"4.9,2.5,4.5,1.7,virginica\n" +
"7.3,2.9,6.3,1.8,virginica\n" +
"6.7,2.5,5.8,1.8,virginica\n" +
"7.2,3.6,6.1,2.5,virginica\n" +
"6.5,3.2,5.1,2,virginica\n" +
"6.4,2.7,5.3,1.9,virginica\n" +
"6.8,3,5.5,2.1,virginica\n" +
"5.7,2.5,5,2,virginica\n" +
"5.8,2.8,5.1,2.4,virginica\n" +
"6.4,3.2,5.3,2.3,virginica\n" +
"6.5,3,5.5,1.8,virginica\n" +
"7.7,3.8,6.7,2.2,virginica\n" +
"7.7,2.6,6.9,2.3,virginica\n" +
"6,2.2,5,1.5,virginica\n" +
"6.9,3.2,5.7,2.3,virginica\n" +
"5.6,2.8,4.9,2,virginica\n" +
"7.7,2.8,6.7,2,virginica\n" +
"6.3,2.7,4.9,1.8,virginica\n" +
"6.7,3.3,5.7,2.1,virginica\n" +
"7.2,3.2,6,1.8,virginica\n" +
"6.2,2.8,4.8,1.8,virginica\n" +
"6.1,3,4.9,1.8,virginica\n" +
"6.4,2.8,5.6,2.1,virginica\n" +
"7.2,3,5.8,1.6,virginica\n" +
"7.4,2.8,6.1,1.9,virginica\n" +
"7.9,3.8,6.4,2,virginica\n" +
"6.4,2.8,5.6,2.2,virginica\n" +
"6.3,2.8,5.1,1.5,virginica\n" +
"6.1,2.6,5.6,1.4,virginica\n" +
"7.7,3,6.1,2.3,virginica\n" +
"6.3,3.4,5.6,2.4,virginica\n" +
"6.4,3.1,5.5,1.8,virginica\n" +
"6,3,4.8,1.8,virginica\n" +
"6.9,3.1,5.4,2.1,virginica\n" +
"6.7,3.1,5.

Re: [Rd] Cannot Compute Box's M (Three Days Trying...)

2017-10-27 Thread William Dunlap via R-devel
Does it work if you supply the closing parenthesis on the call to boxM?
The parser says the input is incomplete and a missing closing parenthesis
would cause that error..

// create a string command with that variable name.String boxVariable =
"boxM(boxMVariable [,-5], boxMVariable[,5]";

// try to execute the command...
// FAILS with org.rosuda.REngine.Rserve.RserveException: eval failed,
request status: R parser: input incomplete FAILS !   REXP
theBoxMResult = rConnection.eval(boxVariable); FAILS <

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Fri, Oct 27, 2017 at 12:41 PM, Morkus via R-devel 
wrote:

> It can't be this hard, right? I really need a shove in the right direction
> here. Been spinning wheels for three days. Cannot get past the errors.
>
> I'm doing something wrong, obviously, since I can easily compute the Box's
> M right there in RStudio
>
> But I don't see what is wrong below with the coding equivalent.
>
> The entire code snippet is below. The code fails below on the call to the
> boxM statistic call.
>
> PLEASE HELP!!!
>
> Thanks in advance,
>
> -
>
> rConnection.eval("library('biotools')");
>
> String inputIris = "5.1,3.5,1.4,0.2,setosa\n" +
> "4.9,3,1.4,0.2,setosa\n" +
> "4.7,3.2,1.3,0.2,setosa\n" +
> "4.6,3.1,1.5,0.2,setosa\n" +
> "5,3.6,1.4,0.2,setosa\n" +
> "5.4,3.9,1.7,0.4,setosa\n" +
> "4.6,3.4,1.4,0.3,setosa\n" +
> "5,3.4,1.5,0.2,setosa\n" +
> "4.4,2.9,1.4,0.2,setosa\n" +
> "4.9,3.1,1.5,0.1,setosa\n" +
> "5.4,3.7,1.5,0.2,setosa\n" +
> "4.8,3.4,1.6,0.2,setosa\n" +
> "4.8,3,1.4,0.1,setosa\n" +
> "4.3,3,1.1,0.1,setosa\n" +
> "5.8,4,1.2,0.2,setosa\n" +
> "5.7,4.4,1.5,0.4,setosa\n" +
> "5.4,3.9,1.3,0.4,setosa\n" +
> "5.1,3.5,1.4,0.3,setosa\n" +
> "5.7,3.8,1.7,0.3,setosa\n" +
> "5.1,3.8,1.5,0.3,setosa\n" +
> "5.4,3.4,1.7,0.2,setosa\n" +
> "5.1,3.7,1.5,0.4,setosa\n" +
> "4.6,3.6,1,0.2,setosa\n" +
> "5.1,3.3,1.7,0.5,setosa\n" +
> "4.8,3.4,1.9,0.2,setosa\n" +
> "5,3,1.6,0.2,setosa\n" +
> "5,3.4,1.6,0.4,setosa\n" +
> "5.2,3.5,1.5,0.2,setosa\n" +
> "5.2,3.4,1.4,0.2,setosa\n" +
> "4.7,3.2,1.6,0.2,setosa\n" +
> "4.8,3.1,1.6,0.2,setosa\n" +
> "5.4,3.4,1.5,0.4,setosa\n" +
> "5.2,4.1,1.5,0.1,setosa\n" +
> "5.5,4.2,1.4,0.2,setosa\n" +
> "4.9,3.1,1.5,0.2,setosa\n" +
> "5,3.2,1.2,0.2,setosa\n" +
> "5.5,3.5,1.3,0.2,setosa\n" +
> "4.9,3.6,1.4,0.1,setosa\n" +
> "4.4,3,1.3,0.2,setosa\n" +
> "5.1,3.4,1.5,0.2,setosa\n" +
> "5,3.5,1.3,0.3,setosa\n" +
> "4.5,2.3,1.3,0.3,setosa\n" +
> "4.4,3.2,1.3,0.2,setosa\n" +
> "5,3.5,1.6,0.6,setosa\n" +
> "5.1,3.8,1.9,0.4,setosa\n" +
> "4.8,3,1.4,0.3,setosa\n" +
> "5.1,3.8,1.6,0.2,setosa\n" +
> "4.6,3.2,1.4,0.2,setosa\n" +
> "5.3,3.7,1.5,0.2,setosa\n" +
> "5,3.3,1.4,0.2,setosa\n" +
> "7,3.2,4.7,1.4,versicolor\n" +
> "6.4,3.2,4.5,1.5,versicolor\n" +
> "6.9,3.1,4.9,1.5,versicolor\n" +
> "5.5,2.3,4,1.3,versicolor\n" +
> "6.5,2.8,4.6,1.5,versicolor\n" +
> "5.7,2.8,4.5,1.3,versicolor\n" +
> "6.3,3.3,4.7,1.6,versicolor\n" +
> "4.9,2.4,3.3,1,versicolor\n" +
> "6.6,2.9,4.6,1.3,versicolor\n" +
> "5.2,2.7,3.9,1.4,versicolor\n" +
> "5,2,3.5,1,versicolor\n" +
> "5.9,3,4.2,1.5,versicolor\n" +
> "6,2.2,4,1,versicolor\n" +
> "6.1,2.9,4.7,1.4,versicolor\n" +
> "5.6,2.9,3.6,1.3,versicolor\n" +
> "6.7,3.1,4.4,1.4,versicolor\n" +
> "5.6,3,4.5,1.5,versicolor\n" +
> "5.8,2.7,4.1,1,versicolor\n" +
> "6.2,2.2,4.5,1.5,versicolor\n" +
> "5.6,2.5,3.9,1.1,versicolor\n" +
> "5.9,3.2,4.8,1.8,versicolor\n" +
> "6.1,2.8,4,1.3,versicolor\n" +
> "6.3,2.5,4.9,1.5,versicolor\n" +
> "6.1,2.8,4.7,1.2,versicolor\n" +
> "6.4,2.9,4.3,1.3,versicolor\n" +
> "6.6,3,4.4,1.4,versicolor\n" +
> "6.8,2.8,4.8,1.4,versicolor\n" +
> "6.7,3,5,1.7,versicolor\n" +
> "6,2.9,4.5,1.5,versicolor\n" +
> "5.7,2.6,3.5,1,versicolor\n" +
> "5.5,2.4,3.8,1.1,versicolor\n" +
> "5.5,2.4,3.7,1,versicolor\n" +
> "5.8,2.7,3.9,1.2,versicolor\n" +
> "6,2.7,5.1,1.6,versicolor\n" +
> "5.4,3,4.5,1.5,versicolor\n" +
> "6,3.4,4.5,1.6,versicolor\n" +
> "6.7,3.1,4.7,1.5,versicolor\n" +
> "6.3,2.3,4.4,1.3,versicolor\n" +
> "5.6,3,4.1,1.3,versicolor\n" +
> "5.5,2.5,4,1.3,versicolor\n" +
> "5.5,2.6,4.4,1.2,versicolor\n" +
> "6.1,3,4.6,1.4,versicolor\n" +
> "5.8,2.6,4,1.2,versicolor\n" +
> "5,2.3,3.3,1,versicolor\n" +
> "5.6,2.7,4.2,1.3,versicolor\n" +
> "5.7,3,4.2,1.2,versicolor\n" +
> "5.7,2.9,4.2,1.3,versicolor\n" +
> "6.2,2.9,4.3,1.3,versicolor\n" +
> "5.1,2.5,3,1.1,versicolor\n" +
> "5.7,2.8,4.1,1.3,versicolor\n" +
> "6.3,3.3,6,2.5,virginica\n" +
> "5.8,2.7,5.1,1.9,virginica\n" +
> "7.1,3,5.9,2.1,virginica\n" +
> "6.3,2.9,5.6,1.8,virginica\n" +
> "6.5,3,5.8,2.2,virginica\n" +
> "7.6,3,6.6,2.1,virginica\n" +
> "4.9,2.5,4.5,1.7,virginica\n" +
> "7.3,2.9,6.3,1.8,virginica\n" +
> "6.7,2.5,5.8,1.8,virginica\n" +
> "7.2,3.6,6.1,2.5,virginica\n" +
> "6.5,3.2,5.1,2,virginica\n" +
> "6.4,2.7,5.3,1.9,virginica\n" +
> "6.8,3,5.5,2.1,virginica\n" +
> "5.7,2.5,5,2,virginica\n" +
> "5.8,2.8,5.1,2.4,virginica\n" +
> "6.4,3.2,5.3,2.3,virginica\n" +
> "6.5,3,5.5,1.8,virginica\n" +
> "7.7,3.8,6.7,2.2,virginica\n" +

[Rd] Cannot Compute Box's M (Three Days Trying...)

2017-10-27 Thread Morkus via R-devel
It can't be this hard, right? I really need a shove in the right direction 
here. Been spinning wheels for three days. Cannot get past the errors.

I'm doing something wrong, obviously, since I can easily compute the Box's M 
right there in RStudio

But I don't see what is wrong below with the coding equivalent.

The entire code snippet is below. The code fails below on the call to the boxM 
statistic call.

PLEASE HELP!!!

Thanks in advance,

-

rConnection.eval("library('biotools')");

String inputIris = "5.1,3.5,1.4,0.2,setosa\n" +
"4.9,3,1.4,0.2,setosa\n" +
"4.7,3.2,1.3,0.2,setosa\n" +
"4.6,3.1,1.5,0.2,setosa\n" +
"5,3.6,1.4,0.2,setosa\n" +
"5.4,3.9,1.7,0.4,setosa\n" +
"4.6,3.4,1.4,0.3,setosa\n" +
"5,3.4,1.5,0.2,setosa\n" +
"4.4,2.9,1.4,0.2,setosa\n" +
"4.9,3.1,1.5,0.1,setosa\n" +
"5.4,3.7,1.5,0.2,setosa\n" +
"4.8,3.4,1.6,0.2,setosa\n" +
"4.8,3,1.4,0.1,setosa\n" +
"4.3,3,1.1,0.1,setosa\n" +
"5.8,4,1.2,0.2,setosa\n" +
"5.7,4.4,1.5,0.4,setosa\n" +
"5.4,3.9,1.3,0.4,setosa\n" +
"5.1,3.5,1.4,0.3,setosa\n" +
"5.7,3.8,1.7,0.3,setosa\n" +
"5.1,3.8,1.5,0.3,setosa\n" +
"5.4,3.4,1.7,0.2,setosa\n" +
"5.1,3.7,1.5,0.4,setosa\n" +
"4.6,3.6,1,0.2,setosa\n" +
"5.1,3.3,1.7,0.5,setosa\n" +
"4.8,3.4,1.9,0.2,setosa\n" +
"5,3,1.6,0.2,setosa\n" +
"5,3.4,1.6,0.4,setosa\n" +
"5.2,3.5,1.5,0.2,setosa\n" +
"5.2,3.4,1.4,0.2,setosa\n" +
"4.7,3.2,1.6,0.2,setosa\n" +
"4.8,3.1,1.6,0.2,setosa\n" +
"5.4,3.4,1.5,0.4,setosa\n" +
"5.2,4.1,1.5,0.1,setosa\n" +
"5.5,4.2,1.4,0.2,setosa\n" +
"4.9,3.1,1.5,0.2,setosa\n" +
"5,3.2,1.2,0.2,setosa\n" +
"5.5,3.5,1.3,0.2,setosa\n" +
"4.9,3.6,1.4,0.1,setosa\n" +
"4.4,3,1.3,0.2,setosa\n" +
"5.1,3.4,1.5,0.2,setosa\n" +
"5,3.5,1.3,0.3,setosa\n" +
"4.5,2.3,1.3,0.3,setosa\n" +
"4.4,3.2,1.3,0.2,setosa\n" +
"5,3.5,1.6,0.6,setosa\n" +
"5.1,3.8,1.9,0.4,setosa\n" +
"4.8,3,1.4,0.3,setosa\n" +
"5.1,3.8,1.6,0.2,setosa\n" +
"4.6,3.2,1.4,0.2,setosa\n" +
"5.3,3.7,1.5,0.2,setosa\n" +
"5,3.3,1.4,0.2,setosa\n" +
"7,3.2,4.7,1.4,versicolor\n" +
"6.4,3.2,4.5,1.5,versicolor\n" +
"6.9,3.1,4.9,1.5,versicolor\n" +
"5.5,2.3,4,1.3,versicolor\n" +
"6.5,2.8,4.6,1.5,versicolor\n" +
"5.7,2.8,4.5,1.3,versicolor\n" +
"6.3,3.3,4.7,1.6,versicolor\n" +
"4.9,2.4,3.3,1,versicolor\n" +
"6.6,2.9,4.6,1.3,versicolor\n" +
"5.2,2.7,3.9,1.4,versicolor\n" +
"5,2,3.5,1,versicolor\n" +
"5.9,3,4.2,1.5,versicolor\n" +
"6,2.2,4,1,versicolor\n" +
"6.1,2.9,4.7,1.4,versicolor\n" +
"5.6,2.9,3.6,1.3,versicolor\n" +
"6.7,3.1,4.4,1.4,versicolor\n" +
"5.6,3,4.5,1.5,versicolor\n" +
"5.8,2.7,4.1,1,versicolor\n" +
"6.2,2.2,4.5,1.5,versicolor\n" +
"5.6,2.5,3.9,1.1,versicolor\n" +
"5.9,3.2,4.8,1.8,versicolor\n" +
"6.1,2.8,4,1.3,versicolor\n" +
"6.3,2.5,4.9,1.5,versicolor\n" +
"6.1,2.8,4.7,1.2,versicolor\n" +
"6.4,2.9,4.3,1.3,versicolor\n" +
"6.6,3,4.4,1.4,versicolor\n" +
"6.8,2.8,4.8,1.4,versicolor\n" +
"6.7,3,5,1.7,versicolor\n" +
"6,2.9,4.5,1.5,versicolor\n" +
"5.7,2.6,3.5,1,versicolor\n" +
"5.5,2.4,3.8,1.1,versicolor\n" +
"5.5,2.4,3.7,1,versicolor\n" +
"5.8,2.7,3.9,1.2,versicolor\n" +
"6,2.7,5.1,1.6,versicolor\n" +
"5.4,3,4.5,1.5,versicolor\n" +
"6,3.4,4.5,1.6,versicolor\n" +
"6.7,3.1,4.7,1.5,versicolor\n" +
"6.3,2.3,4.4,1.3,versicolor\n" +
"5.6,3,4.1,1.3,versicolor\n" +
"5.5,2.5,4,1.3,versicolor\n" +
"5.5,2.6,4.4,1.2,versicolor\n" +
"6.1,3,4.6,1.4,versicolor\n" +
"5.8,2.6,4,1.2,versicolor\n" +
"5,2.3,3.3,1,versicolor\n" +
"5.6,2.7,4.2,1.3,versicolor\n" +
"5.7,3,4.2,1.2,versicolor\n" +
"5.7,2.9,4.2,1.3,versicolor\n" +
"6.2,2.9,4.3,1.3,versicolor\n" +
"5.1,2.5,3,1.1,versicolor\n" +
"5.7,2.8,4.1,1.3,versicolor\n" +
"6.3,3.3,6,2.5,virginica\n" +
"5.8,2.7,5.1,1.9,virginica\n" +
"7.1,3,5.9,2.1,virginica\n" +
"6.3,2.9,5.6,1.8,virginica\n" +
"6.5,3,5.8,2.2,virginica\n" +
"7.6,3,6.6,2.1,virginica\n" +
"4.9,2.5,4.5,1.7,virginica\n" +
"7.3,2.9,6.3,1.8,virginica\n" +
"6.7,2.5,5.8,1.8,virginica\n" +
"7.2,3.6,6.1,2.5,virginica\n" +
"6.5,3.2,5.1,2,virginica\n" +
"6.4,2.7,5.3,1.9,virginica\n" +
"6.8,3,5.5,2.1,virginica\n" +
"5.7,2.5,5,2,virginica\n" +
"5.8,2.8,5.1,2.4,virginica\n" +
"6.4,3.2,5.3,2.3,virginica\n" +
"6.5,3,5.5,1.8,virginica\n" +
"7.7,3.8,6.7,2.2,virginica\n" +
"7.7,2.6,6.9,2.3,virginica\n" +
"6,2.2,5,1.5,virginica\n" +
"6.9,3.2,5.7,2.3,virginica\n" +
"5.6,2.8,4.9,2,virginica\n" +
"7.7,2.8,6.7,2,virginica\n" +
"6.3,2.7,4.9,1.8,virginica\n" +
"6.7,3.3,5.7,2.1,virginica\n" +
"7.2,3.2,6,1.8,virginica\n" +
"6.2,2.8,4.8,1.8,virginica\n" +
"6.1,3,4.9,1.8,virginica\n" +
"6.4,2.8,5.6,2.1,virginica\n" +
"7.2,3,5.8,1.6,virginica\n" +
"7.4,2.8,6.1,1.9,virginica\n" +
"7.9,3.8,6.4,2,virginica\n" +
"6.4,2.8,5.6,2.2,virginica\n" +
"6.3,2.8,5.1,1.5,virginica\n" +
"6.1,2.6,5.6,1.4,virginica\n" +
"7.7,3,6.1,2.3,virginica\n" +
"6.3,3.4,5.6,2.4,virginica\n" +
"6.4,3.1,5.5,1.8,virginica\n" +
"6,3,4.8,1.8,virginica\n" +
"6.9,3.1,5.4,2.1,virginica\n" +
"6.7,3.1,5.6,2.4,virginica\n" +
"6.9,3.1,5.1,2.3,virginica\n" +
"5.8,2.7,5.1,1.9,virginica\n" +
"6.8,3.2,5.9,2.3,virginica\n" +
"6.7,3.3,5.7,2.5,virginica\n" +
"6.7,3,5.2,2.3,virginica\n" +
"6.3,2.5,5,1.9,virginica\

Re: [Rd] Slow down using the compiler

2017-10-27 Thread luke-tierney

This is due to a temporary change to not compile assignments, like
your loop body, that appear within an argument. This is to work around
a bug elsewhere in R that will take some time to fix. Once that fix is
available these assignments will again be compiled.

Best,

On Fri, 27 Oct 2017, Colin Gillespie wrote:


Dear All,

In R 3.4.2 (Linux), the compiler seems to have regressed:

$ R --vanilla
g = function() {
 N = 1e7; ans = numeric(N)
 system.time({for (j in 1:N) ans[j] = 1})
}
g()
#   user  system elapsed
# 4.272   0.000   4.272

g1 = compiler::cmpfun(g)
g1()
#   user  system elapsed
# 4.232   0.004   4.235

Running the above code in Windows 3.3.1, g() takes the same time, but g1()
takes around 0.5 seconds.

Removing the function wrapper we have

N = 1e7; ans = numeric(N)
system.time({for (j in 1:N) ans[j] = 1})
#   user  system elapsed
# 0.304   0.000   0.304
compiler::enableJIT(0)
#[1] 3
N = 1e7; ans = numeric(N)
system.time({for (j in 1:N) ans[j] = 1})
#   user  system elapsed
# 5.448   0.000   5.446

Best wishes

Colin

--


sessionInfo()

R version 3.4.2 (2017-09-28)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.3 LTS

Matrix products: default
BLAS: /usr/lib/atlas-base/atlas/libblas.so.3.0
LAPACK: /usr/lib/atlas-base/atlas/liblapack.so.3.0

locale:
[1] LC_CTYPE=en_GB.UTF-8   LC_NUMERIC=C
[3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=en_GB.UTF-8LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8   LC_NAME=C
[9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_3.4.2

[[alternative HTML version deleted]]

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



--
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
   Actuarial Science
241 Schaeffer Hall  email:   luke-tier...@uiowa.edu
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu

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


Re: [Rd] Bug in model.matrix.default for higher-order interaction encoding when specific model terms are missing

2017-10-27 Thread Arie ten Cate
Hello Tyler,

I want to bring to your attention the following document: "What
happens if you omit the main effect in a regression model with an
interaction?" 
(https://stats.idre.ucla.edu/stata/faq/what-happens-if-you-omit-the-main-effect-in-a-regression-model-with-an-interaction).
This gives a useful review of the problem. Your example is Case 2: a
continuous and a categorical regressor.

The numerical examples are coded in Stata, and they give the same
result as in R. Hence, if this is a bug in R then it is also a bug in
Stata. That seems very unlikely.

Here is a simulation in R of the above mentioned Case 2 in Stata:

df <- expand.grid(socst=c(-1:1),grp=c("1","2","3","4"))
print("Full model")
print(model.matrix(~(socst+grp)^2 ,data=df))
print("Example 2.1: drop socst")
print(model.matrix(~(socst+grp)^2 -socst ,data=df))
print("Example 2.2: drop grp")
print(model.matrix(~(socst+grp)^2 -grp ,data=df))

This gives indeed the following regressors:

"Full model"
(Intercept) socst grp2 grp3 grp4 socst:grp2 socst:grp3 socst:grp4
"Example 2.1: drop socst"
(Intercept) grp2 grp3 grp4 socst:grp1 socst:grp2 socst:grp3 socst:grp4
"Example 2.2: drop grp"
(Intercept) socst socst:grp2 socst:grp3 socst:grp4

There is a little bit of R documentation about this, based on the
concept of marginality, which typically forbids a model having an
interaction but not the corresponding main effects. (You might see the
references in https://en.wikipedia.org/wiki/Principle_of_marginality )
See "An Introduction to R", by Venables and Smith and the R Core
Team. At the bottom of page 52 (PDF: 57) it says: "Although the
details are complicated, model formulae in R will normally generate
the models that an expert statistician would expect, provided that
marginality is preserved. Fitting, for [a contrary] example, a model
with an interaction but not the corresponding main effects will in
general lead to surprising results ".
The Reference Manual states that the R functions dropterm() and
addterm() resp. drop or add only terms such that marginality is
preserved.

Finally, about your singular matrix t(mm)%*%mm. This is in fact
Example 2.1 in Case 2 discussed above. As discussed there, in Stata
and in R the drop of the continuous variable has no effect on the
degrees of freedom here: it is just a reparameterisation of the full
model, protecting you against losing marginality... Hence the
model.matrix 'mm' is still square and nonsingular after the drop of
X1, unless of course when a row is removed from the matrix 'design'
when before creating 'mm'.

Arie

On Sun, Oct 15, 2017 at 7:05 PM, Tyler  wrote:
> You could possibly try to explain away the behavior for a missing main
> effects term, since without the main effects term we don't have main effect
> columns in the model matrix used to compute the interaction columns (At
> best this is undocumented behavior--I still think it's a bug, as we know
> how we would encode the categorical factors if they were in fact present.
> It's either specified in contrasts.arg or using the default set in
> options). However, when all the main effects are present, why would the
> three-factor interaction column not simply be the product of the main
> effect columns? In my example: we know X1, we know X2, and we know X3. Why
> does the encoding of X1:X2:X3 depend on whether we specified a two-factor
> interaction, AND only changes for specific missing interactions?
>
> In addition, I can use a two-term example similar to yours to show how this
> behavior results in a singular covariance matrix when, given the desired
> factor encoding, it should not be singular.
>
> We start with a full factorial design for a two-level continuous factor and
> a three-level categorical factor, and remove a single row. This design
> matrix does not leave enough degrees of freedom to determine
> goodness-of-fit, but should allow us to obtain parameter estimates.
>
>> design = expand.grid(X1=c(1,-1),X2=c("A","B","C"))
>> design = design[-1,]
>> design
>   X1 X2
> 2 -1  A
> 3  1  B
> 4 -1  B
> 5  1  C
> 6 -1  C
>
> Here, we first calculate the model matrix for the full model, and then
> manually remove the X1 column from the model matrix. This gives us the
> model matrix one would expect if X1 were removed from the model. We then
> successfully calculate the covariance matrix.
>
>> mm = model.matrix(~(X1+X2)^2,data=design)
>> mm
>   (Intercept) X1 X2B X2C X1:X2B X1:X2C
> 2   1 -1   0   0  0  0
> 3   1  1   1   0  1  0
> 4   1 -1   1   0 -1  0
> 5   1  1   0   1  0  1
> 6   1 -1   0   1  0 -1
>
>> mm = mm[,-2]
>> solve(t(mm) %*% mm)
> (Intercept)  X2B  X2C X1:X2B X1:X2C
> (Intercept)   1 -1.0 -1.00.00.0
> X2B  -1  1.5  1.00.00.0
> X2C  -1  1.0  1.50.00.0
> X1:X2B0  0.0  0.00.50.0
> X1:X2C0  0.0  0.00.00.5
>
> Here, w

Re: [Rd] How to do a "Box's M" Test with

2017-10-27 Thread Morkus via R-devel
Thanks for the ideas. I'll keep trying...

Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted email.

>  Original Message 
> Subject: Re: [Rd] How to do a "Box's M" Test with
> Local Time: October 27, 2017 8:50 AM
> UTC Time: October 27, 2017 12:50 PM
> From: murdoch.dun...@gmail.com
> To: Morkus , r-devel@r-project.org 
> 
>
> On 27/10/2017 8:10 AM, Morkus via R-devel wrote:
>
>> Trying to get past a frustrating error to do a "simple" Box's M test using 
>> Java.
>> The Box's M test says it will work with a data.frame.
>> Here's the setup code:
>> REXP myDf = REXP.createDataFrame(new RList(
>> new REXP[]
>> {
>> new REXPDouble(d1),
>> new REXPDouble(d2),
>> new REXPDouble(d3),
>> new REXPDouble(d4),
>> new REXPInteger(d5)
>> }));
>> Here's the call:
>> REXP boxMResult = rConnection.eval( "boxM(" + myDf+ "[,-5], " + myDf + " [, 
>> 5])");
>>
>> I don't really know the R Java interface, but this doesn't make sense.
>> You are pasting an REXP object myDf into a string to evaluate. It would
>> make sense to assign that dataframe object to an R variable, and paste
>> the name of that variable into your expression, or to construct a
>> language object containing the dataframe object, but I don't know how to
>> do those things.
>>
>> Duncan Murdoch
>> But, I keep getting syntax errors.
>> If this code isn't right, how do you build a data.frame R will like? No 
>> examples I can find, anywhere.
>> Not sure what to try next. I've tried just sending a string with everything 
>> commented, but nothing I've tried works.
>> Can anyone please suggest something to try?
>> Thanks in advance.
>>
>> - M
>>
>> Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted email.
>> [[alternative HTML version deleted]]
>> ---
>>
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
[[alternative HTML version deleted]]

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


[Rd] Slow down using the compiler

2017-10-27 Thread Colin Gillespie
Dear All,

In R 3.4.2 (Linux), the compiler seems to have regressed:

$ R --vanilla
g = function() {
  N = 1e7; ans = numeric(N)
  system.time({for (j in 1:N) ans[j] = 1})
}
g()
#   user  system elapsed
 # 4.272   0.000   4.272

g1 = compiler::cmpfun(g)
g1()
#   user  system elapsed
# 4.232   0.004   4.235

Running the above code in Windows 3.3.1, g() takes the same time, but g1()
takes around 0.5 seconds.

Removing the function wrapper we have

N = 1e7; ans = numeric(N)
system.time({for (j in 1:N) ans[j] = 1})
#   user  system elapsed
 # 0.304   0.000   0.304
compiler::enableJIT(0)
#[1] 3
N = 1e7; ans = numeric(N)
system.time({for (j in 1:N) ans[j] = 1})
#   user  system elapsed
 # 5.448   0.000   5.446

Best wishes

Colin

--

> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.3 LTS

Matrix products: default
BLAS: /usr/lib/atlas-base/atlas/libblas.so.3.0
LAPACK: /usr/lib/atlas-base/atlas/liblapack.so.3.0

locale:
 [1] LC_CTYPE=en_GB.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8
 [5] LC_MONETARY=en_GB.UTF-8LC_MESSAGES=en_GB.UTF-8
 [7] LC_PAPER=en_GB.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_3.4.2

[[alternative HTML version deleted]]

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


Re: [Rd] How to do a "Box's M" Test with

2017-10-27 Thread Duncan Murdoch

On 27/10/2017 8:10 AM, Morkus via R-devel wrote:

Trying to get past a frustrating error to do a "simple" Box's M test using Java.

The Box's M test says it will work with a data.frame.

Here's the setup code:

REXP myDf = REXP.createDataFrame(new RList(
new REXP[]
{
new REXPDouble(d1),
new REXPDouble(d2),
new REXPDouble(d3),
new REXPDouble(d4),
new REXPInteger(d5)
}));

Here's the call:

REXP boxMResult = rConnection.eval( "boxM(" + myDf+ "[,-5], " + myDf + " [, 
5])");


I don't really know the R Java interface, but this doesn't make sense. 
You are pasting an REXP object myDf into a string to evaluate.  It would 
make sense to assign that dataframe object to an R variable, and paste 
the name of that variable into your expression, or to construct a 
language object containing the dataframe object, but I don't know how to 
do those things.


Duncan Murdoch



But, I keep getting syntax errors.

If this code isn't right, how do you build a data.frame R will like?  No 
examples I can find, anywhere.

Not sure what to try next. I've tried just sending a string with everything 
commented, but nothing I've tried works.

Can anyone please suggest something to try?

Thanks in advance.

- M

Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted email.
[[alternative HTML version deleted]]

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



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


[Rd] How to do a "Box's M" Test with

2017-10-27 Thread Morkus via R-devel
Trying to get past a frustrating error to do a "simple" Box's M test using Java.

The Box's M test says it will work with a data.frame.

Here's the setup code:

REXP myDf = REXP.createDataFrame(new RList(
new REXP[]
{
new REXPDouble(d1),
new REXPDouble(d2),
new REXPDouble(d3),
new REXPDouble(d4),
new REXPInteger(d5)
}));

Here's the call:

REXP boxMResult = rConnection.eval( "boxM(" + myDf+ "[,-5], " + myDf + " [, 
5])");

But, I keep getting syntax errors.

If this code isn't right, how do you build a data.frame R will like?  No 
examples I can find, anywhere.

Not sure what to try next. I've tried just sending a string with everything 
commented, but nothing I've tried works.

Can anyone please suggest something to try?

Thanks in advance.

- M

Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted email.
[[alternative HTML version deleted]]

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


Re: [Rd] javareconf issue

2017-10-27 Thread Prof Brian Ripley

On 27/10/2017 04:13, rosseji wrote:

Using a real name and a signature are regarded as polite here.


Hi,

Wasn't able to see a bug report on this issue yet... Hope I'm not doublng
up.


This is a problem on your system.  Also, macOS issues should be reported 
to R-sig-mac ... and you should give the 'at a minimum' information 
requested by the posting guide.



There seems to be little info around for what "R CMD javareconf" does but
it has some deprecation errors seemingly.


See R CMD javareconf --help , and the R-admin manual.



On running cmd in terminal:

Java interpreter : /usr/bin/java

Java version : 9

Java home path   : /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home

Java compiler: /usr/bin/javac

Java headers gen.: /usr/bin/javah

Java archive tool: /usr/bin/jar

System Java on macOS


Try updating your R (as suggested by the posting guide): javareconf did 
not detect Java 9 on macOS until the it was released recently.  You are 
trying to use an obsolete system installation of Java (not Oracle Java).


From the NEWS for R 3.4.2.patched (and R-devel)

• R CMD javareconf has been updated to recognize the use of a Java
  9 SDK on macOS.





*trying to compile and link a JNI program *

*detected JNI cpp flags:
-I/System/Library/Frameworks/JavaVM.framework/Headers*

*detected JNI linker flags : -framework JavaVM*

*clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I/System/Library/Frameworks/JavaVM.framework/Headers  -I/usr/local/include
   -fPIC  -Wall -g -O2  -c conftest.c -o conftest.o*

*conftest.c:4:5: warning: 'JNI_CreateJavaVM' is deprecated
[-Wdeprecated-declarations]*

*JNI_CreateJavaVM(0, 0, 0);*

*^*

*/System/Library/Frameworks/JavaVM.framework/Headers/jni.h:1936:39: note:
'JNI_CreateJavaVM' has*

*  been explicitly marked deprecated here*

*_JNI_IMPORT_OR_EXPORT_ __attribute__((deprecated)) jint JNICALL*

*  ^*

*1 warning generated.*

*clang -dynamiclib -Wl,-headerpad_max_install_names -undefined
dynamic_lookup -single_module -multiply_defined suppress
-L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o
conftest.so conftest.o -framework JavaVM
-F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
-Wl,CoreFoundation*



*JAVA_HOME:
/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home*

*Java library path: *

*JNI cpp flags: -I/System/Library/Frameworks/JavaVM.framework/Headers*

*JNI linker flags : -framework JavaVM*

*Updating Java configuration in /Library/Frameworks/R.framework/Resources*

*Done.*

[[alternative HTML version deleted]]

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




--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford

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

[Rd] javareconf issue

2017-10-27 Thread rosseji
Hi,

Wasn't able to see a bug report on this issue yet... Hope I'm not doublng
up.

There seems to be little info around for what "R CMD javareconf" does but
it has some deprecation errors seemingly.

On running cmd in terminal:

Java interpreter : /usr/bin/java

Java version : 9

Java home path   : /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home

Java compiler: /usr/bin/javac

Java headers gen.: /usr/bin/javah

Java archive tool: /usr/bin/jar

System Java on macOS


*trying to compile and link a JNI program *

*detected JNI cpp flags:
-I/System/Library/Frameworks/JavaVM.framework/Headers*

*detected JNI linker flags : -framework JavaVM*

*clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I/System/Library/Frameworks/JavaVM.framework/Headers  -I/usr/local/include
  -fPIC  -Wall -g -O2  -c conftest.c -o conftest.o*

*conftest.c:4:5: warning: 'JNI_CreateJavaVM' is deprecated
[-Wdeprecated-declarations]*

*JNI_CreateJavaVM(0, 0, 0);*

*^*

*/System/Library/Frameworks/JavaVM.framework/Headers/jni.h:1936:39: note:
'JNI_CreateJavaVM' has*

*  been explicitly marked deprecated here*

*_JNI_IMPORT_OR_EXPORT_ __attribute__((deprecated)) jint JNICALL*

*  ^*

*1 warning generated.*

*clang -dynamiclib -Wl,-headerpad_max_install_names -undefined
dynamic_lookup -single_module -multiply_defined suppress
-L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o
conftest.so conftest.o -framework JavaVM
-F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
-Wl,CoreFoundation*



*JAVA_HOME:
/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home*

*Java library path: *

*JNI cpp flags: -I/System/Library/Frameworks/JavaVM.framework/Headers*

*JNI linker flags : -framework JavaVM*

*Updating Java configuration in /Library/Frameworks/R.framework/Resources*

*Done.*

[[alternative HTML version deleted]]

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