I have some additional comments to my previous post.
If we perform some calculation inside R, e.g.
> x <- fisher.test(matrix(c(60,40,70,30),2))
We assigned the results to the object 'x'. Now we can access various
elements of x as follows:
1. How many elemts are stored inside x?
> length(x)
[1] 7
2. What are the names of those variables?
> y <- names(x)
> y
[1] "p.value" "conf.int" "estimate" "null.value" "alternative"
[6] "method" "data.name"
This command has created an array (= y) with the names of the variables!
We can get an individual name with y[[1]] (y[1] works as well).
3. How do we access the stored output by variable?
- either iterate through x[[1]] -> to x[[length(x)]]
> x[[i]]
- OR iterate i = 1 to length(x), with
> x[[y[[i]]]]
- for subarrays, like x[[2]], we can apply the same thing one more time:
> length(x[[2]])
[1] 2
(x[[2]] is the 95% confidence interval for the OddsRatio, so it has an
upper and a lower limit)
> x[[2]][1] // for first value = lower limit
[1] 0.8317144
> x[[2]][2] // for second value = upper limit
[1] 2.918995
CONCLUSIONS
============
A.) For statistical functions/techniques that return primarily a
p-value, we can easily detect this, as one of the names will be
"p.value" (it is usually the first element in the array, aka x[[1]]).
B.) We can import the data from R back into Calc, and create a list with
the names of the variables from the output (aka names(x) ) AND let the
more advanced user choose which variable from this list to enter into a
Calc cell.
Well, hope this helps to overcome some of the obstacles.
Sincerely,
Leonard
Leonard Mada wrote:
Hi Wojciech,
I just read (http://www.utsc.utoronto.ca/~04grycwo/overview.pdf) and
began thinking on your ideas.
Basically you are right, we need both methods: for advanced users and
for beginners. That's my point, too.
Regarding your concerns with importing the R-output back into Calc, I
do admit that there are some problems and issues to discuss. I will
try to think of the best solution.
Until then, I can give you some useful tips:
1. lets say we perform some calculations in R and store the output in
a new variable, e.g.
x <- fisher.test(matrix(c(40,60,30,70),2))
then we can get the output by typing at the prompt:> x
OR
we can get the length of the return object:
:> length(x)
<output> 7
and get every element individually from this output: (iterate
through x[[1]] -> x[[7]] )
:> x[[1]]
<output>> [1] 0.1819324 (this is the p-value)
2. I imagine statistical functions as belonging to 2 large groups
(this is NOT necessarily accurate BUT useful here):
a.) those that report a p-value as the main result
- this is usually the first value (aka x[[1]])
b.) those that perform more complex actions, like a multivariate
model, or a resampling, or graphic
These latter functions will be more difficult to deal with. But lets
stick now to the first group.
Hope this is helpful. I will try to work up a solution for the rest.
Sincerely,
Leonard
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]