Ok, I chased down all the problems. This is my last output: > sshc(100,10) [1] 0.8000 0.7908 0.7844 0.7773 0.7785 0.7989 [1] 5.37 10.29 13.27 13.04 9.66 3.54 [1] " old.abs.dev= 0.0701944484789673" [1] " abs.dev= 0.034407699378335" [1] 0.8000 0.8030 0.8057 0.8041 0.8035 0.8180 [1] 5.37 10.87 14.73 15.32 11.74 3.85 [1] " old.abs.dev= 0.034407699378335" [1] " abs.dev= 0.00908198716779307" [1] 0.8000 0.7989 0.7994 0.7979 0.7950 0.7998 [1] 5.37 10.69 14.16 14.63 11.49 3.48 [1] " old.abs.dev= 0.00908198716779307" [1] " abs.dev= 0.00616028545602321" [1] 0.8000 0.8000 0.8011 0.8011 0.7989 0.8028 [1] 5.37 10.77 14.25 14.74 11.93 3.53 $ne [1] 5.369543 10.769265 14.252492 14.743598 11.928704 3.533269 $Ep [1] 0.7999630 0.8000404 0.8010525 0.8011409 0.7988643 0.8027538 There were 15 warnings (use warnings() to see them) > warnings() Warning messages: 1: span too small. fewer data values than degrees of freedom. 2: pseudoinverse used at -0.0025 3: neighborhood radius 0.2025 4: reciprocal condition number 0 5: There are other near singularities as well. 0.041006 6: span too small. fewer data values than degrees of freedom. 7: pseudoinverse used at -0.0025 8: neighborhood radius 0.2025 9: reciprocal condition number 0 10: There are other near singularities as well. 0.041006 11: span too small. fewer data values than degrees of freedom. 12: pseudoinverse used at -0.0025 13: neighborhood radius 0.2025 14: reciprocal condition number 0 15: There are other near singularities as well. 0.041006
Are my problems with syntax or the algorithm or the call sshc(100,10)? I still don't understand what the arguments in the call mean. Thanks. ________________________________ From: Uwe Ligges <lig...@statistik.tu-dortmund.de> Cc: Barry Rowlingson <b.rowling...@lancaster.ac.uk>; "r-help@r-project.org" <r-help@r-project.org> Sent: Wednesday, October 5, 2011 8:03 AM Subject: Re: [R] SPlus to R On 05.10.2011 13:44, Scott Raynaud wrote: > Hope I did this right. I repeated what I'd done before: > > 1) Opened script > 2) Selected run all (this produced my inital post > > Then as suggested I: > > 3) Typed ls() > 4) Saw that the function was present and issued sshc(100,10) > > Here's what I got: > >> ls() > [1] "c.searchd" "convex" "Epower" "nef" "nef2" "power1.f" > [7] "ss.rand" "sshc" "vertex" >> sshc(100,10) > Error in return(ne = ne, Ep = Ep1) : > multi-argument returns are not permitted > > So it looks like I need to change the return(ne = ne, Ep = Ep1) to two > separate lines, correct? No: return(list(ne = ne, Ep = Ep1)) Uwe > > On a brighter note, I did get a power curve as expected. One thing I don't > understand is the meaning of the arguments in sshc(100,10). > > Thanks agian for your help. > > > ________________________________ > From: Barry Rowlingson<b.rowling...@lancaster.ac.uk> > > Cc: "r-help@r-project.org"<r-help@r-project.org> > Sent: Wednesday, October 5, 2011 4:02 AM > Subject: Re: [R] SPlus to R > > > te: >> I'm trying to convert an S-Plus program to R. Since I'm a SAS programmer >> I'm not facile is either S-Plus or R, so I need some help. All I did was >> convert the underscores in S-Plus to the assignment operator<-. Here are >> the first few lines of the S-Plus file: >> >> sshc _ function(rc, nc, d, method, alpha=0.05, power=0.8, >> tol=0.01, tol1=.0001, tol2=.005, cc=c(.1,2), l.span=.5) >> { >> ### for method 1 >> if (method==1) { >> ne1 _ ss.rand(rc,nc,d,alpha=.05,power=.8,tol=.01) >> return(ne=ne1) >> } >> >> >> My translation looks like this: >> >> sshc<-function(rc, nc=500, d=.5, method=3, alpha=0.05, power=0.8, >> tol=0.01, tol1=.0001, tol2=.005, cc=c(.1,2), l.span=.5) >> { >> ### for method 1 >> if (method==1) { >> ne1<-ss.rand(rc,nc,d,alpha=.05,power=.8,tol=.01) >> return(ne=ne1) >> } >> >> The program runs without throwing errors, but I'm not getting any ourput in >> the console. This is where it should be, right? I think I have this set up >> correctly. I'm using method=3 which only requires nc and d to be >> specified. Any ideas why I'm not seeing output? > > Long shot: the code you posted looked like (and hard to tell without > indentation) just a bunch of function definitions. R won't actually do > anything unless you call those functions with some parameters. > > So, when you say you get no output when you 'run' the code, what > exactly do you mean by 'run' the code? What I would do is: > > 1. Put the code in a file called 'whatever.R'. > 2. Start R, and do source("whatever.R"). That defines the functions. > do "ls()" and you should see them. > 3. Call one of the functions: sshc(100,10) > > I'd call that, in R terms, "calling the sshc function" rather than > running anything. > > Barry > [[alternative HTML version deleted]] > > > > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.