-
1. Re: Chi-Square P-Value Calculation with R
diego.medrano Sep 7, 2016 4:46 PM (in response to Viva Gore)Mary Solbrig any advice?
-
2. Re: Chi-Square P-Value Calculation with R
Mary SolbrigSep 7, 2016 4:57 PM (in response to Viva Gore)
Suspicion: you are only passing 1 element over at a time, meaning that you are calculating the test on a single value instead of the vector of values. For instance, if you ran "chisq.test(c(1))" in R, you would get the same error message.
To verify whether this is the case:
1. Start Rserve using run.Rserve() (this keeps it in the session so any print statements will appear in R Studio instead of being swallowed)
2. Replace the code with the following:
SCRIPT_REAL(
'
print("arg1 is ")
print(.arg1)
print("which has size ")
print(.arg2)
mm <- data.frame(commodity = .arg1);
d <- split(mm,rep(1:.arg3[1],each=.arg2[1]/.arg3[1]));
zt <-do.call(cbind, d);
print("Taking chisq.test of ")
print(zt)
chisq.test(zt)$p.value'
,SUM([Number of Records]), SIZE(),[Priorities])
That will give you a sense of what exactly is being passed to R.Let me know what that says and I might be able to help further. A sample workbook, even just with some dummy data, would also be really helpful.