[R] Symbolic equations to R code?

Scott Rifkin sarifkin at ucsd.edu
Thu Nov 20 20:35:21 CET 2014


On the one hand I'd like it to be as flexible as possible so the 
students could really come up with whatever they like.  On the other 
hand, restricting their choices probably would make it easier to do the 
backend.  The goal would be to get them to realize that the apparatus of 
hypothesis testing (when done via simulation/randomization techniques) 
doesn't depend on what the statistic is. The flow of steps is the same 
whether the statistic is a mean, variance, or their own kooky thing. 
Obviously this isn't the end of the story - what the statistic is 
actually describing is also a crucial component to interpreting the 
results of a hypothesis test, but I think it teaches an important 
pedagogical point about where statistics come from and that if they find 
themselves in a situation in the future where they need to make up their 
own, then that is perfectly okay.

So they could make up ones like:  arctan( (max({x})^2)/ (min({x})^2) 
)-3), max({x})-min({x}), sum from i to n of (x_i - 25th%ile({x}) )^3)  
[that might be tricky to write in a standard equation editor]
none of these is hard to write in R, but translating from an equation 
editor might be.

Perhaps the best solution is (as Alan suggests below) to write a Shiny 
function builder myself so that I can control the whole process and make 
sure that they can't enter anything that would break the backend.  Or to 
have them learn the rudiments of writing equations in R so that it 
bypasses the whole process.


On 11/19/14 1:52 PM, Ista Zahn wrote:
> Hi Scott,
> Can you give a couple of examples of the equations you have in mind
> along with how those should be translated to R?
> Thanks,
> Ista

More information about the R-help mailing list