[R] IMSL Wrapper
Dear R-help, Is there any wrapper avaliable to use IMSL C library functions within R? Thanks. Manoj __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] A question related with resale()
Dearfriends, A question related with resale(). I have a dataset *a* with three variables *x,y,id* I want to do two different things: 1. rescale the combination of x and y into the new range --unit square(0,1),that is, keep the shape of original plot; 2.rescale x and y into the new range (0,1) respectively,change the shape of original plot ; e.g. the orignial dataset id-c(1,2,3,4,5,6,7,8,9,10) x-rnorm(10) y-rnorm(10) a-data.frame(id=id,x=x,y=y) Thanks very much! -- Kind Regards, Zhi Jie,Zhang ,PHD Department of Epidemiology School of Public Health Fudan University Tel:86-21-54237149 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] hello Excel... (native/Package/BETA)
Hans-Peter wrote: Dear list members I am pleased to annonce that I have just finished a native Excel reader/writer. It's wrapped up in two packages: either xlsReadWrite (open source) or the slightly beefed-up xlsReadWritePro (shareware). Working with Excel data is now as easy as writing read.xls and write.xls. Some more details: - Infos and download: http://treetron.googlepages.com - for detailed documentation pls. download and see: help files, DESCRIPTION and README. - I set up a newsgroup for technical questions and feedback: http://groups.google.ch/group/supportR - while it could be ported to other platforms, currently it is WINDOWS only (see technical below) SNIP If I understand it right, the the flexcel library includes the components for kylix as well - therefore I would try to compile it for Linux, I would suggest to use CrossKylix to compile it. Rainer SNIP -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)21 808 3304 Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] multi-dimension array of raw
On Tue, 20 Jun 2006, Duncan Murdoch wrote: On 6/20/2006 6:24 PM, Gerald Jansen wrote: I would like to store and manipulate large sets of marker genotypes compactly using raw data arrays. This works fine for vectors or matrices, but I run into the error shown in the example below as soon as I try to use 3 dimensional arrays (eg. animal x marker x allele). a - array(as.raw(1:6),c(2,3)) a [,1] [,2] [,3] [1,] 01 03 05 [2,] 02 04 06 a[1,] - raw(3) a [,1] [,2] [,3] [1,] 00 00 00 [2,] 02 04 06 b - array(as.raw(1:6),c(1,2,3)) b[1,,] [,1] [,2] [,3] [1,] 01 03 05 [2,] 02 04 06 b[1,1,] - raw(3) Error: incompatible types (from raw to raw) in array subset assignment I can work around this with computed indices, but I wonder if this is expected behaviour. I don't think so. It is just an unimplemented case. Using raw in this way is a fairly unusual thing to do, and you've come across a case nobody thought of implementing. Actually, raw arrays were originally not implemented at all, so this is `expected behaviour', and you may well encounter other unimplemented areas as no one has attempted to implement them comprehensively. Please report them, but on R-devel not here. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] GARCH
Why do you think help.search(garch-methods, package=tseries) finds accessor functions? That is notation for S4 methods, and garch is an S3 class so there will be none. Here there _is_ an accessor, coef(), and you can find that there is by methods(class=garch) [1] coef.garch* fitted.garch*logLik.garch*plot.garch* [5] predict.garch* print.garch* residuals.garch* summary.garch* Non-visible functions are asterisked Note though that inherited methods might be relevant too (e.g. default methods) and indeed it seems that here the default method for coef would work just as well. On Tue, 20 Jun 2006, Jeff Newmiller wrote: Arun Kumar Saha wrote: Dear all R-users, I have a GARCH related query. Suppose I fit a GARCH(1,1) model on a dataframe dat garch1 = garch(dat) summary(garch1) Call: garch(x = dat) Model: GARCH(1,1) Residuals: Min 1Q Median 3Q Max -4.7278 -0.3240 0. 0.3107 12.3981 Coefficient(s): Estimate Std. Error t value Pr(|t|) a0 1.212e-04 2.053e-0659.05 2e-16 *** a1 1.001e+00 4.165e-0224.04 2e-16 *** b1 2.435e-15 1.086e-02 2.24e-131 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Diagnostic Tests: Jarque Bera Test data: Residuals X-squared = 54480.76, df = 2, p-value 2.2e-16 Now I want to store the value of Pr(|t|) for coefficient a0, a1, and b1, and also values of these coefficients, so that I can use them in future separately. I know that I can do it for coefficients by using the command: coef(garch1)[a0] etc, but not for Pr(|t|). Can anyone please tell me how to do this? This is less a question about GARCH and more a question about how R works (which I know is true because I didn't know what GARCH was when I read the question and I still don't but I can provide you a usable answer). You can use the str() function to see the structure of an object in R: garch1.summary - summary(garch1) str(garch1.summary) List of 6 $ residuals: Time-Series [1:999] from 2 to 1000: 0.206 0.709 0.476 -0.291 -1.676 ... ..- attr(*, na.removed)= int 1 $ coef : num [1:3, 1:4] 0.0799 0.6287 0.2118 0.0110 0.0755 ... ..- attr(*, dimnames)=List of 2 .. ..$ : chr [1:3] a0 a1 b1 .. ..$ : chr [1:4] Estimate Std. Error t value Pr(|t|) $ call : language garch(x = x, order = c(1, 1)) $ order: Named num [1:2] 1 1 ..- attr(*, names)= chr [1:2] p q $ j.b.test :List of 5 ..$ statistic: Named num 0.468 .. ..- attr(*, names)= chr X-squared ..$ parameter: Named num 2 .. ..- attr(*, names)= chr df ..$ p.value : Named num 0.791 .. ..- attr(*, names)= chr X-squared ..$ method : chr Jarque Bera Test ..$ data.name: chr Residuals ..- attr(*, class)= chr htest $ l.b.test :List of 5 ..$ statistic: Named num 1.01 .. ..- attr(*, names)= chr X-squared ..$ parameter: Named num 1 .. ..- attr(*, names)= chr df ..$ p.value : num 0.316 ..$ method : chr Box-Ljung test ..$ data.name: chr Squared.Residuals ..- attr(*, class)= chr htest - attr(*, class)= chr summary.garch From this you can see that there is a coef list member that contains the information you are after: garch1.summary$coef Estimate Std. Error t value Pr(|t|) a0 0.07989234 0.01104719 7.231912 4.762857e-13 a1 0.62870916 0.07551333 8.325804 0.00e+00 b1 0.21184013 0.05384033 3.934599 8.333558e-05 this is apparently a matrix, so try matrix notation: garch1.summary$coef[,4] a0 a1 b1 4.762857e-13 0.00e+00 8.333558e-05 or garch1.summary$coef[1,4] [1] 4.762857e-13 Having said all that, this solution depends on implementation details of the innards of the relevant objects, and in general if accessor functions are available they should be used instead... but in this case such accessors don't seem to be available. help.search(garch-methods, package=tseries) -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] latex function with lm
Dear R People: I have used the latex function from the Hmisc package and it is just great! However, I have a new question regarding that function: is there an option for summary(lm(y~x)), please? There are options for different types of objects, but I didn't see one for that. Maybe I just missed it. Thanks in advance! R for Windows Version 2.3.1 Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] png() or jpeg() in a php script
Hello, I've got a problem with a PHP script, in which I call the system function (to call another processes). The call is : system(R --slave --vanilla path/to/source/source.R); if in this R file, I've got the lines: pdf(file=/path/to/file/file.pdf) commands dev.off() the pdf file is perfectly created but if I change the lines to: png(file=/path/to/file/file.png); commands dev.off() (or with the jpeg() function) the files are not created. any help? Thanks [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] png() or jpeg() in a php script
This is covered (in at least three places) on the help page for those functions. PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html and do as we ask (including reporting your system, reading help pages and not sending HTML mail). On Wed, 21 Jun 2006, Angel Roman wrote: Hello, I've got a problem with a PHP script, in which I call the system function (to call another processes). The call is : system(R --slave --vanilla path/to/source/source.R); if in this R file, I've got the lines: pdf(file=/path/to/file/file.pdf) commands dev.off() the pdf file is perfectly created but if I change the lines to: png(file=/path/to/file/file.png); commands dev.off() (or with the jpeg() function) the files are not created. any help? Thanks [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] latex function with lm
Erin Hodgess hodgess at gator.dt.uh.edu writes: I have used the latex function from the Hmisc package and it is just great! However, I have a new question regarding that function: is there an option for summary(lm(y~x)), please? There are options for different types of objects, but I didn't see one I have written one (also form lme) in a library called Dmisc. It passes CRAN tests, but as it's a bit my personal taste, I have not submitted it to CRAN. Main feature is that reduces show number of digits per line by looking at the standard deviation. Too many people loved Excel-type 12 decimals. You may try it as starter. http://www.menne-biomed.de/download Dieter __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] sort matrix by sum of columns
Hi all, I would like to know how can I sort the cols of a matrix by the sum of their elements. a - matrix(as.integer(rnorm(25,4,2)),10,5) colnames(a) = c(alfa,bravo,charlie,delta,echo) I guess I should use colSums, and then rearrange the matrix somehow according to the result. My idea is to display a sorted barplot: barplot(a, horiz=TRUE, legend.text=T) Thanks in advance, Albert. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] sort matrix by sum of columns
probably you're looking for ?order(), e.g., barplot(a[, order(colSums(a))], horiz = TRUE, legend.text = TRUE) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Albert Vilella [EMAIL PROTECTED] To: r help r-help@stat.math.ethz.ch Sent: Wednesday, June 21, 2006 12:38 PM Subject: [R] sort matrix by sum of columns Hi all, I would like to know how can I sort the cols of a matrix by the sum of their elements. a - matrix(as.integer(rnorm(25,4,2)),10,5) colnames(a) = c(alfa,bravo,charlie,delta,echo) I guess I should use colSums, and then rearrange the matrix somehow according to the result. My idea is to display a sorted barplot: barplot(a, horiz=TRUE, legend.text=T) Thanks in advance, Albert. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] sort matrix by sum of columns
Hi order is your friend On 21 Jun 2006 at 11:38, Albert Vilella wrote: From: Albert Vilella [EMAIL PROTECTED] To: r help r-help@stat.math.ethz.ch Date sent: Wed, 21 Jun 2006 11:38:17 +0100 Subject:[R] sort matrix by sum of columns Send reply to: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Hi all, I would like to know how can I sort the cols of a matrix by the sum of their elements. a - matrix(as.integer(rnorm(25,4,2)),10,5) colnames(a) = c(alfa,bravo,charlie,delta,echo) ord-order(colSums(a)) barplot(a[,ord], horiz=TRUE, legend.text=T) HTH Petr I guess I should use colSums, and then rearrange the matrix somehow according to the result. My idea is to display a sorted barplot: barplot(a, horiz=TRUE, legend.text=T) Thanks in advance, Albert. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] IMSL Wrapper
Dear All, Is there any Wrapper written around IMSL C libraries that makes it possible to access the IMSL C functions from within R? Any pointers would be greatly appreciated! Cheers Manoj __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] IMSL Wrapper
Manoj wrote: Dear All, Is there any Wrapper written around IMSL C libraries that makes it possible to access the IMSL C functions from within R? Any pointers would be greatly appreciated! Cheers Manoj What functions are you looking for? I'd be surprised if IMSL had some functionality that R did not. --sundar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] submission
__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] latex function with lm
Erin Hodgess wrote: Dear R People: I have used the latex function from the Hmisc package and it is just great! However, I have a new question regarding that function: is there an option for summary(lm(y~x)), please? There are options for different types of objects, but I didn't see one for that. Maybe I just missed it. There is no latex method for summary(lm); contributions welcomed. You might also look at latex.ols, latex.anova.Design, latex.summary.Design. Frank Thanks in advance! R for Windows Version 2.3.1 Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] lmer and mixed effects logistic regression
On Tue, 2006-06-20 at 20:27 +0200, Göran Broström wrote: On 6/19/06, Rick Bilonick [EMAIL PROTECTED] wrote: On Sun, 2006-06-18 at 13:58 +0200, Douglas Bates wrote: If I understand correctly Rick it trying to fit a model with random effects on a binary response when there are either 1 or 2 observations per group. If you look at Rick's examples, it's worse than that; each group contains identical observations (by design?). May I suggest: glm(y ~ x, family = binomial, data = unique(example.df)) I think lmer gives a very sensible answer to this problem. Göran The paired responses happen to be always the same in the data set that I have. My understanding is that they could differ, but rarely do. For the particular single independent variable, it will always be the same for each observation for a given subject. So I essentially have 2n observations where there are n unique results. However, I want to add additional independent variables where the measurements differ within a subject (even though the response within the subject is the same). I ran glm on the n subjects and the 2n for lmer and get similar estimates and se's but not identical. With just one independent variable where the observations are identical in each cluster, lmer gives slightly smaller se's using all 2n. When I include a second independent variable that varies within each subject, lmer gives larger standard errors, about 25% larger for the independent variable that doesn't vary within subjects and just slightly larger for the one that does vary. I could create a data set where I take all subjects with just one observation per subject and then randomly select one observation from each pair for subjects who have both observations. But I'd rather not have to randomly remove observations. I would expect that when the responses and independent variable are the same within each subject for all subjects, the residual error must be zero after you account for a random effect for subjects. Rick B. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] png() or jpeg() in a php script
Angel Roman aroman6 at gmail.com writes: I've got a problem with a PHP script, in which I call the system function (to call another processes). The call is : system(R --slave --vanilla path/to/source/source.R); ... but if I change the lines to: png(file=/path/to/file/file.png); commands dev.off() (or with the jpeg() function) the files are not created. any help? Try the following in your script to find out if you can create jpeg on your operation system. sink(cap.txt) capabilities() sink() Dieter __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] IMSL Wrapper
From: Sundar Dorai-Raj Manoj wrote: Dear All, Is there any Wrapper written around IMSL C libraries that makes it possible to access the IMSL C functions from within R? Any pointers would be greatly appreciated! Cheers Manoj What functions are you looking for? I'd be surprised if IMSL had some functionality that R did not. --sundar Perhaps another alternative is the gsl package, which provides R interface to the GSL (if what Manoj wants is available there). Andy __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] rJava: java.lang.OutOfMemoryError
Hi, Has anybody encountered the following problem? TIA, Gregoire library(rJava) .jinit() Error occurred during initialization of VM java.lang.OutOfMemoryError: unable to create new native thread This would not help: .jinit(parameters=c(-Xmx512m,-Xmx128m)) R and rJava versions are: installed.packages()[rJava,] Package LibPath Version rJava/home/user/lib/R 0.4-3 Priority BundleContains NA NA NA DependsSuggests Imports R (= 2.0.0), methods NA NA Built 2.3.1 R.Version() $platform [...] $system [1] i686, linux-gnu [...] $version.string [1] Version 2.3.1 (2006-06-01) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] hello Excel... (native/Package/BETA)
Hans-Peter, In my office, files are stored on an EMC shared server which is used by both our Windows PC's and our Linux machines. So it is common for us to process spreadsheet data using R on Linux. A Linux version of your package would be very welcome. Thanks! -- David Brahm ([EMAIL PROTECTED]) P.S. No, I'm not volunteering to port it :-) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] expanded dataset and random number
Dear all, Per Jensen, thanks for your great help. All methods are very useful. Best, Muhammad Subianto On this day 20/06/2006 22:28, Per Jensen wrote: A couple of suggestions: #First solution mydatexpanded-mydat[rep(1:5,mydat[,1]),] sampledat-mydatexpanded[sample(1:85,7),-1] #Second solution sampledat-mydat[sample(1:5,size=7,prob=mydat[,1]/85,replace=TRUE),-1] Regards Per Jensen On 6/20/06, Muhammad Subianto [EMAIL PROTECTED] wrote: Dear all R-users, (My apologies if this subject is wrong) I have dataset: mydat - as.data.frame( matrix(c(14,0,1,0,1,1, 25,1,1,0,1,1, 5,0,0,1,1,0, 31,1,1,1,1,1, 10,0,0,0,0,1), nrow=5,ncol=6,byrow=TRUE)) dimnames(mydat)[[2]] -c(size,A,B,C,D,E) mydat size A B C D E 1 14 0 1 0 1 1 2 25 1 1 0 1 1 35 0 0 1 1 0 4 31 1 1 1 1 1 5 10 0 0 0 0 1 sum(mydat$size) [1] 85 where size is number of each row that have this combination of variables. In this dataset I have 85 tuples in expanded dataset. I want to generate random number between 1 and 85. Say, if the first random number is 15, so the number 15 is 1 1 0 1 1 then, if the next random number is 7, then 0 1 0 1 1 then if random number is 79 0 0 0 0 1 random number is 46 1 1 1 1 1 random number is 3 0 1 0 1 1 random number is 28 1 1 0 1 1 So, the result random tuples (order from 6 random number): 0 1 0 1 1 0 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 0 0 0 1 I would be very happy if anyone could help me. Thank you very much in advance. Kindly regards, Muhammad Subianto __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] lmer and mixed effects logistic regression
You could think of 'lmer(..., family=binomial)' as doing a separate glm fit for each subject, with some shrinkage provided by the assumed distribution of the random effect parameters for each subject. Since your data are constant within subject, the intercept in your model without the subject's random effect distribution will be estimated at +/-Inf. Since this occurs for all subjects, the maximum likelihood estimate of the subject variance is Inf, which is what I wrote in an earlier contribution to this thread. What kind of answer do you get from SAS NLMIXED? If it does NOT tell you that there is something strange about the estimation problem you've given it, I would call that a serious infelicity in the code. If it is documented behavior, some might argue that it doesn't deserve the B word (Bug). The warning messages issued by 'lmer' in this case are something I think users would want, even if they are cryptic. Hope this helps. Spencer Graves Rick Bilonick wrote: On Tue, 2006-06-20 at 20:27 +0200, Göran Broström wrote: On 6/19/06, Rick Bilonick [EMAIL PROTECTED] wrote: On Sun, 2006-06-18 at 13:58 +0200, Douglas Bates wrote: If I understand correctly Rick it trying to fit a model with random effects on a binary response when there are either 1 or 2 observations per group. If you look at Rick's examples, it's worse than that; each group contains identical observations (by design?). May I suggest: glm(y ~ x, family = binomial, data = unique(example.df)) I think lmer gives a very sensible answer to this problem. Göran The paired responses happen to be always the same in the data set that I have. My understanding is that they could differ, but rarely do. For the particular single independent variable, it will always be the same for each observation for a given subject. So I essentially have 2n observations where there are n unique results. However, I want to add additional independent variables where the measurements differ within a subject (even though the response within the subject is the same). I ran glm on the n subjects and the 2n for lmer and get similar estimates and se's but not identical. With just one independent variable where the observations are identical in each cluster, lmer gives slightly smaller se's using all 2n. When I include a second independent variable that varies within each subject, lmer gives larger standard errors, about 25% larger for the independent variable that doesn't vary within subjects and just slightly larger for the one that does vary. I could create a data set where I take all subjects with just one observation per subject and then randomly select one observation from each pair for subjects who have both observations. But I'd rather not have to randomly remove observations. I would expect that when the responses and independent variable are the same within each subject for all subjects, the residual error must be zero after you account for a random effect for subjects. Rick B. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R Reference Card and other help (especially useful for Newbies)
Hi all: Happy summer solstice to all northern hemispherics (and winter solstice to the southerners). Newbies (and others!) may find useful the R Reference Card made available by Tom Short and Rpad at http://www.rpad.org/Rpad/Rpad-refcard.pdf or through the Contributed link on CRAN (where some other reference cards are also linked). It categorizes and organizes a bunch of R's basic, most used functions so that they can be easily found. For example, paste() is under the Strings heading and expand.grid() is under Data Creation. For newbies struggling to find the right R function as well as veterans who can't quite remember the function name, it's very handy. Also don't forget R's other Help facilties: help.search(keyword or phrase) to search the **installed man pages ** RSiteSearch(keyword or phrase) to search the CRAN website via Jonathan Baron's search engine. This can also be done directly from CRAN by following the search link there. And, occasionally, find()/apropos() to search **the attached session packages** for functions using rexexp's. Though R certainly can be intimidating, please **do** try these measures first before posting questions to the list. And please **do** read the other basic R reference materials. Better and faster answers can usually be found this way. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] GAM selection error msgs (mgcv gam packages)
My question concerns 2 error messages; one in the gam package and one in the mgcv package (see below). I have read help files and Chambers and Hastie book but am failing to understand how I can solve this problem. Could you please tell me what I must adjust so that the command does not generate error message? I am trying to achieve model selection for a GAM which is required for prediction purposes, thus my focus is on AIC. My data set has 3038 records and 116 predictor variables and a binary response variable [0 or 1]. There is no current understanding of the predictors' relationship to response so I am relying on GAM for selection of appropriate predictors. - I have some worries about using a GAM in this sort of situation - it seems like an odd model to start from to me: you don't know the relationship to the covariates, but do know that it should be additive? Is that really true? If it is then it may still be alot to ask of the model selection methods to find a good model. (I'd certainly consider upping the `gamma' parameter in mgcv:::gam). - General uneasiness apart, the specific warning message relates to the number of distinct covariate values that you have (or number of distinct X,Y,Z triplets). Do any of the covariates for single smooths have fewer than 10 distinct values? There are more than 50 distinct x,y,z triplets, I suppose? If you have distinct fewer covariate points for a smooth than the default k (10), then you need to reduce k to the number of distinct points, or fewer. - Finally, for speed reasons, I'd use the cr basis (see ?s) if doing this. best, Simon - Simon Wood, Mathematical Sciences, University of Bath, Bath BA2 7AY - +44 (0)1225 386603 www.maths.bath.ac.uk/~sw283/ Thanks Savrina *mgcv package 1.3-12: # I start with specifying the full model with 116 predictors including isotropic smooth of 3D location variables (when I specify only the first 14 predictors I get no error message) m0-gam(label~s(x,y,z,k=50),s+(feature4)+s(feature5)+s(feature6)+...+s(feature116),data=k.data, family=binomial) Error in smooth.construct.tp.smooth.spec(object, data, knots): A term has fewer unique covariate combinations than specified maximum degrees of freedom # I was going to follow this with backwards selection by hypothesis testing (remove highest p-val term one at a time) and also AIC comparison of all the models From help file entitled 'Generalised additive models with integrated smoothness estimation' I calculated the following where do I go from here? A) k is the basis dimension of a given term...if k is not specified k=10*3^(d-1) where 'd' is the number of covariates for this term My calculations: for all my terms but the first d=1 thus k=10*3^0=10. B) You must have more unique combinations of covariates than the model has total parameters My calculations: total parameters = sum of basis dimensions(50+10*113) + sum of non-spline terms(0) - number of spline terms(114) = 1066 *gam package: I think stepwise selection provided by gam package would be useful in finding the best predictive model. I follow example on pg 283 from 'Statistical models in S' Chambers and Hastie 1993. # I start with a full model where all predictors enter linearly k.start-gam(label~., data=k.data, family=binomial) # set up scope list with possibilities for each term eg .~1 + x + s(x) # ignore the first column of the data set k.scope-gam.scope(k.data[,-1]) # start step wise selection k.step-step(k.start,k.scope) #condensed output Start: AIC=1549.48 label~s+y+z+feature4+feature5+...+feature116 Df Deviance AIC none 1319.5 1549.5 - feature54 -1 1319.2 1551.2 - feature26 -1 1319.2 1551.2 ... -feature12 -1 1357.4 1589.4 There were 50 or more warnings (use warnings() to see the first 50) # all 50 warnings are the same warnings() Warning messages: 1: fitted probabilities numerically 0 or 1 occurred in: glm.fit(x[, jj, drop = FALSE], y, wt, offset = object$offset, ... # it seems to not get passed the orginal linear model. It should show all the steps taken to the final model k.step$anova Step Df Deviance Resid. Df Resid. Dev AIC 1 NA NA 2922 1317.599 1549.599 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] GARCH
Prof Brian Ripley wrote: Why do you think help.search(garch-methods, package=tseries) finds accessor functions? That is notation for S4 methods, and garch is an S3 class so there will be none. Here there _is_ an accessor, coef(), and you can find that there is by Probably because I used it, found a mention of various extraction functions including coef(), and could not find a way to access Pr(|t|) using coef(). Nor have I had luck with help.search(summary.garch, package=tseries) Possibly also because I have not yet figured out the difference between S4 and S3 methods, but since the result of my help.search call displayed S3 functions I don't see how knowing this difference would have helped. methods(class=garch) [1] coef.garch* fitted.garch*logLik.garch*plot.garch* [5] predict.garch* print.garch* residuals.garch* summary.garch* Non-visible functions are asterisked Note though that inherited methods might be relevant too (e.g. default methods) and indeed it seems that here the default method for coef would work just as well. Given Arun Kumar Saha's question... Now I want to store the value of Pr(|t|) for coefficient a0, a1, and b1, and also values of these coefficients, so that I can use them in future separately. I know that I can do it for coefficients by using the command: coef(garch1)[a0] etc, but not for Pr(|t|). Can anyone please tell me how to do this? ... I don't see how coef() helps because I have yet to figure out how to use coef() (or any other accessor) to find Std. Error of the coefficient, much less Pr(|t|). summary.garch seems to have only a print method, with no accessors at all. Can you offer a solution? -- --- Jeff NewmillerThe . . Go Live... DCN:[EMAIL PROTECTED]Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] latex function with lm
Erin Hodgess skreiv: However, I have a new question regarding that function: is there an option for summary(lm(y~x)), please? There are options for different types of objects, but I didn't see one for that. Maybe I just missed it. FWIW: I find that the following works fairly well for printing the table part of summary.lm: library(Hmisc) library(xtable) latex(xtable(l), booktabs=TRUE, digits=2) -- Karl Ove Hufthammer __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] help on ploting various lines
Dear All, I tried to plot a variety of lines(curves) on same figure. What I did is, plot(x=x1,y=y1) lines(x=x2,y=y2) lines(x=x3,y=y3) ... In my data, the maximum of y1 is much smaller than those maximums of other y vectors. So, in the figure I got, there are some curves which are not complete, I mean, they were cut off at the maximum of y1 at the y axis. Could anybody point out some right commands I need use? Thanks! Best, Cao __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] latex function with lm
Dieter Menne skreiv: I have written one (also form lme) in a library called Dmisc. It passes CRAN tests, but as it's a bit my personal taste, I have not submitted it to CRAN. Main feature is that reduces show number of digits per line by looking at the standard deviation. Too many people loved Excel-type 12 decimals. You may try it as starter. http://www.menne-biomed.de/download I believe that should be http://www.menne-biomed.de/download/download.html -- Karl Ove Hufthammer __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help on ploting various lines
On Wed, 2006-06-21 at 12:22 -0400, Baoqiang Cao wrote: Dear All, I tried to plot a variety of lines(curves) on same figure. What I did is, plot(x=x1,y=y1) lines(x=x2,y=y2) lines(x=x3,y=y3) ... In my data, the maximum of y1 is much smaller than those maximums of other y vectors. So, in the figure I got, there are some curves which are not complete, I mean, they were cut off at the maximum of y1 at the y axis. Could anybody point out some right commands I need use? Thanks! Best, Cao You will want to use the 'xlim' and 'ylim' arguments in plot() to set the initial axis ranges for the scatter plot based upon the ranges of the combined x* or y* vectors. That way, the plot region ranges are set to include all of your values. x.range - range(x1, x2, x3) y.range - range(y1, y2, y3) plot(x1, y1, xlim = x.range, ylim = y.range) lines(x2, y2) lines(x3, y3) See ?plot.default for more information. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help on ploting various lines
On Wed, 2006-06-21 at 11:55 -0500, Marc Schwartz (via MN) wrote: On Wed, 2006-06-21 at 12:22 -0400, Baoqiang Cao wrote: Dear All, I tried to plot a variety of lines(curves) on same figure. What I did is, plot(x=x1,y=y1) lines(x=x2,y=y2) lines(x=x3,y=y3) ... In my data, the maximum of y1 is much smaller than those maximums of other y vectors. So, in the figure I got, there are some curves which are not complete, I mean, they were cut off at the maximum of y1 at the y axis. Could anybody point out some right commands I need use? Thanks! Best, Cao You will want to use the 'xlim' and 'ylim' arguments in plot() to set the initial axis ranges for the scatter plot based upon the ranges of the combined x* or y* vectors. That way, the plot region ranges are set to include all of your values. x.range - range(x1, x2, x3) y.range - range(y1, y2, y3) plot(x1, y1, xlim = x.range, ylim = y.range) lines(x2, y2) lines(x3, y3) See ?plot.default for more information. One other note, which is to review: ?matplot which also has help for matpoints() and matlines(), which will do the common axis range adjustments for you. This will be helpful if you are going to be plotting a larger number of points/lines in a single graphic. HTH, Marc __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help on ploting various lines
Hi. set a ylim equal to the max of your data: #create test data x1 - x2 -x3 -(1:10) y1 -runif(10)/2 #to get a low maximum y1 y2 -runif(10) y3 -runif(10) #plot as you did plot(x=x1,y=y1,type=l) #y-axis is not big enough lines(x=x2,y=y2) lines(x=x3,y=y3) #plot with minimum/maximum y limit plot(x=x1,y=y1,type=l,ylim=c(min(y1,y2,y2),max(y1,y2,y2))) #fixed lines(x=x2,y=y2) lines(x=x3,y=y3) Neuro From: Baoqiang Cao [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: R-help@stat.math.ethz.ch Subject: [R] help on ploting various lines Date: Wed, 21 Jun 2006 12:22:16 -0400 (EDT) Dear All, I tried to plot a variety of lines(curves) on same figure. What I did is, plot(x=x1,y=y1) lines(x=x2,y=y2) lines(x=x3,y=y3) ... In my data, the maximum of y1 is much smaller than those maximums of other y vectors. So, in the figure I got, there are some curves which are not complete, I mean, they were cut off at the maximum of y1 at the y axis. Could anybody point out some right commands I need use? Thanks! Best, Cao __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help on ploting various lines
Sorry, had two y2 in the min/max ylim plot(x=x1,y=y1,type=l,ylim=c(min(y1,y2,y3),max(y1,y2,y3))) #fixed lines(x=x2,y=y2) lines(x=x3,y=y3) From: Baoqiang Cao [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: R-help@stat.math.ethz.ch Subject: [R] help on ploting various lines Date: Wed, 21 Jun 2006 12:22:16 -0400 (EDT) Dear All, I tried to plot a variety of lines(curves) on same figure. What I did is, plot(x=x1,y=y1) lines(x=x2,y=y2) lines(x=x3,y=y3) ... In my data, the maximum of y1 is much smaller than those maximums of other y vectors. So, in the figure I got, there are some curves which are not complete, I mean, they were cut off at the maximum of y1 at the y axis. Could anybody point out some right commands I need use? Thanks! Best, Cao __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] rank(x,y)?
Suppose I have two columns, x,y. I can use order(x,y) to calculate a permutation that puts them into increasing order of x, with ties broken by y. I'd like instead to calculate the rank of each pair under the same ordering, but the rank() function doesn't take multiple values as input. Is there a simple way to get what I want? E.g. x - c(1,2,3,4,1,2,3,4) y - c(1,2,3,1,2,3,1,2) rank(x+y/10) [1] 1 3 6 7 2 4 5 8 gives me the answer I want, but only because I know the range of y and the size of gaps in the x values. What do I do in general? Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] rank(x,y)?
Dear Duncan, How about something like the following? rank2 - function(x, y){ x - (x - min(x))/diff(range(x)) y - (y - min(y))/diff(range(y)) rank(10*(x + 1) + y) } Regards, John On Wed, 21 Jun 2006 13:43:39 -0400 Duncan Murdoch [EMAIL PROTECTED] wrote: Suppose I have two columns, x,y. I can use order(x,y) to calculate a permutation that puts them into increasing order of x, with ties broken by y. I'd like instead to calculate the rank of each pair under the same ordering, but the rank() function doesn't take multiple values as input. Is there a simple way to get what I want? E.g. x - c(1,2,3,4,1,2,3,4) y - c(1,2,3,1,2,3,1,2) rank(x+y/10) [1] 1 3 6 7 2 4 5 8 gives me the answer I want, but only because I know the range of y and the size of gaps in the x values. What do I do in general? Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html John Fox Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] rank(x,y)?
This might work for you: order(order(x, y)) [1] 1 3 6 7 2 4 5 8 Andy From: Duncan Murdoch Suppose I have two columns, x,y. I can use order(x,y) to calculate a permutation that puts them into increasing order of x, with ties broken by y. I'd like instead to calculate the rank of each pair under the same ordering, but the rank() function doesn't take multiple values as input. Is there a simple way to get what I want? E.g. x - c(1,2,3,4,1,2,3,4) y - c(1,2,3,1,2,3,1,2) rank(x+y/10) [1] 1 3 6 7 2 4 5 8 gives me the answer I want, but only because I know the range of y and the size of gaps in the x values. What do I do in general? Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] rank(x,y)?
Duncan Murdoch [EMAIL PROTECTED] writes: Suppose I have two columns, x,y. I can use order(x,y) to calculate a permutation that puts them into increasing order of x, with ties broken by y. I'd like instead to calculate the rank of each pair under the same ordering, but the rank() function doesn't take multiple values as input. Is there a simple way to get what I want? E.g. x - c(1,2,3,4,1,2,3,4) y - c(1,2,3,1,2,3,1,2) rank(x+y/10) [1] 1 3 6 7 2 4 5 8 gives me the answer I want, but only because I know the range of y and the size of gaps in the x values. What do I do in general? Still not quite general, but in the absence of ties: z[order(x,y)]-1:8 z [1] 1 3 6 7 2 4 5 8 -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] help on ploting various lines
Thank you very much Marc Schwartz and Neuro LeSuperHéros! At last I got what I expected, of course, with help of your messages. What a great day! Best, Cao __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Courses - R/Splus Advanced Programming in San Francisco This July ***by the R Development Core Tean Guru
__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] rank(x,y)?
Peter Dalgaard wrote: Duncan Murdoch [EMAIL PROTECTED] writes: Suppose I have two columns, x,y. I can use order(x,y) to calculate a permutation that puts them into increasing order of x, with ties broken by y. I'd like instead to calculate the rank of each pair under the same ordering, but the rank() function doesn't take multiple values as input. Is there a simple way to get what I want? E.g. x - c(1,2,3,4,1,2,3,4) y - c(1,2,3,1,2,3,1,2) rank(x+y/10) [1] 1 3 6 7 2 4 5 8 gives me the answer I want, but only because I know the range of y and the size of gaps in the x values. What do I do in general? Still not quite general, but in the absence of ties: z[order(x,y)]-1:8 z [1] 1 3 6 7 2 4 5 8 Thanks to all who have replied. Unfortunately for me, ties do exist, and I'd like them to get identical ranks. John Fox's suggestion would handle ties properly, but I'm worried about rounding error giving spurious ties. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] rank(x,y)?
Try this: order(order(x,y)) On 6/21/06, Duncan Murdoch [EMAIL PROTECTED] wrote: Suppose I have two columns, x,y. I can use order(x,y) to calculate a permutation that puts them into increasing order of x, with ties broken by y. I'd like instead to calculate the rank of each pair under the same ordering, but the rank() function doesn't take multiple values as input. Is there a simple way to get what I want? E.g. x - c(1,2,3,4,1,2,3,4) y - c(1,2,3,1,2,3,1,2) rank(x+y/10) [1] 1 3 6 7 2 4 5 8 gives me the answer I want, but only because I know the range of y and the size of gaps in the x values. What do I do in general? Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] png() or jpeg() in a php script
Hi, I have created a OOP version of R_PHP Project, developed by Steve Chen, you can download the php script, here: http://www.juanantonio.info/p_research/statistics/r/rphp/RClass.1.0.zip ?php class R{ //Configuration Variables var $temp_dir; var $R_path; var $R_options_1; var $R_options_2; var $graphic; var $bannedCommandConfigFile; var $RCODE; var $Rerror; //Constructor de clase function __construct(){ $this - temp_dir = tmp; $this - R_path = c:/R-2.3.0/bin/Rterm.exe; $this - R_options_1 = --quiet --no-restore --no-save ; $this - R_options_2 = ; $this - graphic = jpeg; $this - bannedCommandConfigFile = security.txt; } //Metodo para establecer valores en propiedades function setProp($PropName, $PropValue){ $this-$PropName = $PropValue; } //Funcion que comprueba el fichero de configuracion function checkBCCFile(){ $lines = file($this - bannedCommandConfigFile); //$lines = file(security.txt); $total = count($lines); $j = 0; for ($i=0;$i $total;$i++){ $line = trim($lines[$i]); if (!strrchr($line,#)){ $j = $j + 1; if (strrchr($line,|)){ $terms = explode(|,$line); $bad_0 = trim($terms[0]); $bad_op = trim($terms[1]); $bad_cmd[$j]= $bad_0; $bad_option[$bad_0] = $bad_op; }else{ $bad_cmd[$j]= $line; } }else{ continue; } } echo(Comprobando el fichero de configuracionbr /); }//End Function //Funcion que comprueba cada linea del codigo R dado, por si emplea un commando prohibido. function check_bad($text,$j){ global $bad_cmd,$bad_option; $is_bad = 0; foreach($bad_cmd as $bad){ $bad1 = str_replace(.,\.,$bad); if(ereg($bad1,$text)){ if(strrchr($bad,.) (strlen($bad) 3)){ $is_bad = 1; }else{ // get remaining string after targer key word $terms = explode($bad,$text); // get rid of spaces before a possible following ( $term1 = ltrim($terms[1]); if($bad_option[$bad] != ){ if(eregi($bad_option[$bad],$term1)){ // if (strstr($term1,$bad_option[$bad])) $is_bad = 1; } }else{ if(substr($term1,0,1) == (){ $is_bad = 1; } } } if($is_bad == 1){ if ($bad_option[$bad] != ){ echo font color=red$bad/font function; echo with font color=red.$bad_option[$bad]./font; echo option is NOT permitted ; }else{ echo font color=red$bad/font function is NOT permitted ; echo in Line font color=red$j/fontBR; echo blockquote$text/blockquote; echo Program Stopped!BR; exit; } } } } }//End function //Funcion que genera un nombre aleatorio a ficheros function random_str($size){ $randoms = array( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z ); srand ((double) microtime() * 100); for($i = 1;
Re: [R] xyplot, type=b
Yes, this does work as long as the data are spaced far enough apart. If you peek inside ./main/plot.c, you will find the function 'do_plot_xy' which provides the functionality I desire for standard graphics. A down-and-dirty implementation for lattice might be along the lines of my.panel - function(x, y, ...){ panel.xyplot(x, y, ...) d - 0.5 # for now, should be half the size of 'cex' xold - NA yold - NA for(i in 1:length(x)){ xx - x[i] yy - y[i] f - d / sqrt(xx * xx + yy * yy) if(f 0.5){ # just a kludge for now, would really want to use grid.lines or some such panel.lines(x = c(xold + f * (xx - xold), xx + f * (xold - xx)), y = c(yold + f * (yy - yold), yy + f * (yold - yy))) } xold - xx yold - yy } } Unfortunately this is not quite right; to do it correctly it seems one has to address two problems: 1. how to get the size of the default 'cex' to use for 'd' (do_xy_plot uses 'GConvertYUnits' to accomplish this) 2. figure out how to achieve the same effect as what 'GConvert(xx, yy, USER, INCHES, dd)' does in do_xy_plot. Otherwise, the gap sizes are not constant. (1) sounds easy but I don't know the answer offhand. (2) seems more subtle. Any suggestions would be greatly appreciated. Ben Sundar Dorai-Raj wrote: I think Paul's suggestion works if you use: panel.points(x, y, col = white, cex = 1.5, pch = 16, ...) instead of the default background color. For me trellis.par.get(background)$col returns transparent. HTH, --sundar __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Eclipse plugin for R code submit to Rserve available (Alpha)
Hello R-users and developers, This is the announce of a new Eclipse plugin for R. It is in its early (alpha) stage. It's GPL, source code is provided with the plugin. The update site is ready for install with eclipse 3.1 at : http://www.alysis.de/Rsubmit/update/ If you're interested, please read the feature list below or go to http://www.alysis.de/Rsubmit/ Thanks, Friedrich Schuster (mail_at_friedrich-schuster.de) -- Introduction The Rsubmit plugin executes selected R source code from within an editor window. The code is passed to a (local or remote) Rserve session and the output is streamed back to eclipse. Features * Submit of selected code segments in opened files or whole text (if nothing is selected) from an editor * Connects to local Rserve sessions or Rserve on a remote host. * Supports different configurations for code submit * Keeps workspace elements, supports incremental code submit * Is able to displays output from a local Rserve session in console window * Is (partially) able to display output from a remote Rserve session in console window * Output of remote sessions is (or should be) displayed incremental and in (near) real-time. Well, at least it worked in the runtime workbench. The writing to the eclipse console window (in normal eclipse mode) seems to be buffered, so there is not always a immediate reacton to new R output. Requires... * eclipse 3.1 (3.0 does / should not work) * An R installation. Get it from: R Project for Statistical Computing (http://www.r-project.org/) * Installed Rserve (http://stats.math.uni-augsburg.de/Rserve/) * Please start the Rserve session before connection from the plugin! (Currently the connection will not restart after an error). * There seems to be an issue with JDK 1.5. It works with 1.4.2. Please try and report errors to me. -- Friedrich Schuster mail_at_friedrich-schuster.de __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Comparing partial response curves from GAM
Can you give a bit more information on exactly what you want to compare? (maybe give example models). There are ways of comparing curves, but it is a bit context dependent. - Simon Wood, Mathematical Sciences, University of Bath, Bath BA2 7AY - +44 (0)1225 386603 www.maths.bath.ac.uk/~sw283/ On Tue, 20 Jun 2006, Solomon Dobrowski wrote: Hello all, I was wondering if anyone is aware of formal approaches and tools for comparing partial response curves produced in GAM? My interest is in determining if two partial response curves are statistically different. I recognize that point-wise standard error estimates can be produced using the GAM package but Im not certain how to translate this into a statistical test for the entire curve. Any feedback is much appreciated. Thanks. Solomon Solomon Dobrowski Tahoe Environmental Research Center (TERC) John Muir Institute of the Environment University of California, Davis 530 754 9354 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] gamm error message
This is a bug. The `prior.weights' element of the the faked `gam' object (i.e. `test$gam$prior.wieghts' below) has been set to the varIdent() variance function, rather than the weights that this eventually represents. I'll fix this for the next patch release, (as soon as I get any time to do research rather than doing dummy runs of describing how good the research might be that I would be doing if I was doing it instead of practicing writing about it). In the meantime if you do something like: test$gam$prior.weights - rep(1,length(Z)) then summary(test.gam) will work, but you should ignore the reported r^2. best, Simon - Simon Wood, Mathematical Sciences, University of Bath, Bath BA2 7AY - +44 (0)1225 386603 www.maths.bath.ac.uk/~sw283/ On Tue, 6 Jun 2006, Highland Statistics Ltd. wrote: Hello, Why would I get an error message with the following code for gamm? I want to fit the a gam with different variances per stratum. library(mgcv) library(nlme) Y-rnorm(100) X-rnorm(100,sd=2) Z-rep(c(T,F),each=50) test-gamm(Y~s(X),weights=varIdent(form=~1|Z)) summary(test$lme) #ok summary(test$gam) Gives an error message: Error in inherits(x, data.frame) : dim- : dims [product 100] do not match the length of object [0] All the other output seems to be ok: summary(test$lme) Linear mixed-effects model fit by maximum likelihood Data: strip.offset(mf) AIC BIClogLik 299.9468 312.9727 -144.9734 Random effects: Formula: ~Xr.1 - 1 | g.1 Structure: pdIdnot Xr.11Xr.12Xr.13Xr.14Xr.15 StdDev: 0.0001073404 0.0001073404 0.0001073404 0.0001073404 0.0001073404 Xr.16Xr.17Xr.18 Residual StdDev: 0.0001073404 0.0001073404 0.0001073404 1.045916 Variance function: Structure: Different standard deviations per stratum Formula: ~1 | Z Parameter estimates: TRUE FALSE 1.000 0.9721987 Fixed effects: y ~ X.0 - 1 Value Std.Error DFt-value p-value X.0(Intercept) 0.04426102 0.1041540 98 0.4249573 0.6718 X.0s(X)Fx1 -0.01053900 0.1039558 98 -0.1013796 0.9195 Correlation: X.0(I) X.0s(X)Fx1 0.002 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.96955692 -0.81101014 0.07004034 0.72528662 2.44244302 Number of Observations: 100 Number of Groups: 1 Kind regards, Alain __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] colClasses
Hi Folks! I'm reading in some data from a .csv file that has a date column. How do I use colClasses to get read.csv to recognize the date column? The documentation on this seems to be nil - And yes, I've read help and R Data Import/Export and can't figure out what the colClasses syntax is. Thanks, john [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] colClasses
Kerpel, John [EMAIL PROTECTED] writes: Hi Folks! I'm reading in some data from a .csv file that has a date column. How do I use colClasses to get read.csv to recognize the date column? The documentation on this seems to be nil - And yes, I've read help and R Data Import/Export and can't figure out what the colClasses syntax is. 1. It may be easier just to read the date field as factor or character and convert using as.Date afterwards. If a format is needed, this is actually the only way. 2. colClasses is a character vector, possibly named, so cls - rep(NA,17) cls[3] - Date read.csv(, colClasses=cls, ) or read.csv(, colClasses=c(mydate=Date), ) should work (assuming that the variable in question is called mydate and is in the 3 of 17 columns). This is documented in ?read.csv. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] colClasses
Peter: Thanks - I'll try both approaches. The examples clear things up a bit. John -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard Sent: Wednesday, June 21, 2006 3:04 PM To: Kerpel, John Cc: r-help@stat.math.ethz.ch Subject: Re: [R] colClasses Kerpel, John [EMAIL PROTECTED] writes: Hi Folks! I'm reading in some data from a .csv file that has a date column. How do I use colClasses to get read.csv to recognize the date column? The documentation on this seems to be nil - And yes, I've read help and R Data Import/Export and can't figure out what the colClasses syntax is. 1. It may be easier just to read the date field as factor or character and convert using as.Date afterwards. If a format is needed, this is actually the only way. 2. colClasses is a character vector, possibly named, so cls - rep(NA,17) cls[3] - Date read.csv(, colClasses=cls, ) or read.csv(, colClasses=c(mydate=Date), ) should work (assuming that the variable in question is called mydate and is in the 3 of 17 columns). This is documented in ?read.csv. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] colClasses
Is this what you want: x - date,value + 2006-5-5,1 + 2006-5-10,2 + 2006-5-20,3 + 2006-5-30,4 y - textConnection(x) z - read.csv(y, colClasses=c(POSIXct, 'integer')) z date value 1 2006-05-05 1 2 2006-05-10 2 3 2006-05-20 3 4 2006-05-30 4 On 6/21/06, Kerpel, John [EMAIL PROTECTED] wrote: Hi Folks! I'm reading in some data from a .csv file that has a date column. How do I use colClasses to get read.csv to recognize the date column? The documentation on this seems to be nil - And yes, I've read help and R Data Import/Export and can't figure out what the colClasses syntax is. Thanks, john [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Jim Holtman Cincinnati, OH +1 513 646 9390 (Cell) +1 513 247 0281 (Home) What is the problem you are trying to solve? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] colClasses
Peter has already directly answered your question but in case what you really want is a zoo time series object (applicable if this is a time series) then see the example in ?read.zoo in the zoo package. Also, library(zoo); vignette(zoo) gives info on zoo package. On 6/21/06, Kerpel, John [EMAIL PROTECTED] wrote: Hi Folks! I'm reading in some data from a .csv file that has a date column. How do I use colClasses to get read.csv to recognize the date column? The documentation on this seems to be nil - And yes, I've read help and R Data Import/Export and can't figure out what the colClasses syntax is. Thanks, john [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] colClasses
Read.zoo did it! Thanks! -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 21, 2006 3:15 PM To: Kerpel, John Cc: r-help@stat.math.ethz.ch Subject: Re: [R] colClasses Peter has already directly answered your question but in case what you really want is a zoo time series object (applicable if this is a time series) then see the example in ?read.zoo in the zoo package. Also, library(zoo); vignette(zoo) gives info on zoo package. On 6/21/06, Kerpel, John [EMAIL PROTECTED] wrote: Hi Folks! I'm reading in some data from a .csv file that has a date column. How do I use colClasses to get read.csv to recognize the date column? The documentation on this seems to be nil - And yes, I've read help and R Data Import/Export and can't figure out what the colClasses syntax is. Thanks, john [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Some R-Tcl/Tk-BWidget newbie questions.
Dear list, Could somebody who is more experienced with the Tcl/Tk interface from R please help me clarify the issues I've put below with ### -- tags? Several things go wrong, and it's probably because of messy code, but I have a difficult time finding out what is the cause. Thanks very much, JeeBee. require(tcltk) || stop(Package tcltk is not available.) # Add path to BWidgets addTclPath(.) version.BWidget - tclvalue(tclRequire(BWidget)) start.gui - function() { # Toplevel tt - tktoplevel() tkwm.title(tt, MyTitle) # Notebook ### -- The following line makes R hang with 100% cpu forever #tkpack(tn - tkwidget(tt, NoteBook), fill=both, expand=TRUE) ### -- This works, but not sticky=news, ### -- the notebook does not resize together with the window tn - tkwidget(tt, NoteBook) tkgrid(tn, sticky=news) ### -- I guess there is a simpler way to do this ... tbn - tclvalue(tkinsert(tn, end, Algemeen, -text, Algemeen)) tkpack(tbw.algemeen - .Tk.newwin(tbn)) tkpack(tab.algemeen - tkframe(tbw.algemeen)) tbn - tclvalue(tkinsert(tn, end, Relaties, -text, Relaties)) tkpack(tbw.relaties - .Tk.newwin(tbn)) tkpack(tab.relaties - tkframe(tbw.relaties)) tbn - tclvalue(tkinsert(tn, end, Posten, -text, Posten)) tkpack(tbw.posten - .Tk.newwin(tbn)) tkpack(tab.posten - tkframe(tbw.posten)) tbn - tclvalue(tkinsert(tn, end, Instellingen, -text, Instellingen)) tkpack(tbw.instellingen - .Tk.newwin(tbn)) tkpack(tab.instellingen - tkframe(tbw.instellingen)) gui.maak.tab(tab.algemeen) gui.maak.tab(tab.relaties) gui.maak.tab(tab.posten) gui.maak.tab(tab.instellingen) tkgrid(tkbutton(tt, text=GUI bijwerken, command=function() verwerk.button(GUIBijwerken, tt))) # FIXME: add cleanup handler? #tkbind(tt, Destroy, function() tkdestroy(tn)) ### -- Don't understand this ... if I do the last raise only, ### -- then I see all tabs in the first tab, until I go to another ### -- tab and back. With all these raises, it works tcl(tn, raise, Instellingen) tcl(tn, raise, Posten) tcl(tn, raise, Relaties) tcl(tn, raise, Algemeen) } gui.maak.tab - function(tt) { tkgrid(tklabel(tt, text=Instellingen), sticky=news) test.button - tclVar(one two) tkgrid(tkcheckbutton(tt,variable=test.button)) } __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] effect size
Does anyone know a simple way of calculating effect sizes? Thanks MB __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] effect size
Matthew Bridgman wrote: Does anyone know a simple way of calculating effect sizes? Thanks MB Yes - the following formula is simple and fairly universal: 2 :-) -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] effect size
For ANOVA one option is the partial eta squared \eta^2_p: \eta^2_p=SSeffect/(SSeffect+SSerror) For multiple regression (continuous predictors) you might use the standardized parameter estimate, the regression coefficient you obtain standardizing the predictor: the larger the absolute value, the larger the size of the effect. You might take a look at: S. Olejnik and J. Algina, (2003), Generalized eta and omega squared statistics: measures of effect size for some common research designs, Psychol Methods. 8(4):434-47. and, if you have repeated measures: R. Bakeman (2005), Recommended effect size statistics for repeated measures designs, Behavior Research Methods, 37 (3), 379-384. Bruno - Original Message - From: Matthew Bridgman [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Wednesday, June 21, 2006 5:01 PM Subject: [R] effect size Does anyone know a simple way of calculating effect sizes? Thanks MB __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] eliminating a do loop
Using a by() statement, I am preparing ANOVA's for multiple experiments, and using simint() to generate confidence intervals. This works fine. simint.by.fit - by(analytes.dfr, list(Assay = analytes.dfr$analyte ), function(data) (simint(value ~ tx, data = data,type='Tukey' ) ) ) I can separately prepare plots of the confidence intervals, and I can prepare separate plots or use for/do loop e.g. plot( simint.by.fit$Assay 1 ) plot( simint.by.fit$Assay 2) Is there a way to generate and save multiple -separate- plots without using a do loop, e.g. using lapply?. I tried a couple variations using lapply, lapply(simint.by.fit,plot) not surprising, I only get the last plot, the other plots seem to get overwritten. Thanks in advance [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] lmer and mixed effects logistic regression
On Wed, 2006-06-21 at 08:35 -0700, Spencer Graves wrote: You could think of 'lmer(..., family=binomial)' as doing a separate glm fit for each subject, with some shrinkage provided by the assumed distribution of the random effect parameters for each subject. Since your data are constant within subject, the intercept in your model without the subject's random effect distribution will be estimated at +/-Inf. Since this occurs for all subjects, the maximum likelihood estimate of the subject variance is Inf, which is what I wrote in an earlier contribution to this thread. What kind of answer do you get from SAS NLMIXED? If it does NOT tell you that there is something strange about the estimation problem you've given it, I would call that a serious infelicity in the code. If it is documented behavior, some might argue that it doesn't deserve the B word (Bug). The warning messages issued by 'lmer' in this case are something I think users would want, even if they are cryptic. Hope this helps. Spencer Graves I did send in an example with data set that duplicates the problem. Changing the control parameters allowed lmer to produce what seem like reasonable estimates. Even for the case with essentially duplicate pairs, lmer and NLMIXED produce similar estimates (finite intercepts also) although lmer's coefficient estimates are as far as I can tell the same as glm but the standard errors are larger. The problem I really want estimates for is different from this one explanatory factor example. The model I estimate will have several explanatory factors, including factors that differ within each subject (although the responses within each subject are the same). BTW, as far as I know, the responses could be different within a subject but it seems to be very rare. Possibly the example I thought I sent never made it to the list. The example is below. Rick B. ### # Example of lmer error message I made an example data set that exhibits the error. There is a dump of the data frame at the end. First, I updated all my packages: sessionInfo() Version 2.3.1 (2006-06-01) i686-redhat-linux-gnu attached base packages: [1] methods stats graphics grDevices utils datasets [7] base other attached packages: chron lme4 Matrixlattice 2.3-3 0.995-2 0.995-11 0.13-8 But I still get the error. For comparison, here is what glm gives: summary(glm(y~x,data=example.df,family=binomial)) Call: glm(formula = y ~ x, family = binomial, data = example.df) Deviance Residuals: Min 1Q Median 3Q Max -1.6747 -0.9087 -0.6125 1.1447 2.0017 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) -0.4786 0.1227 -3.901 9.59e-05 *** x 0.7951 0.1311 6.067 1.31e-09 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 436.63 on 324 degrees of freedom Residual deviance: 394.15 on 323 degrees of freedom AIC: 398.15 Number of Fisher Scoring iterations: 4 Running lmer without any tweaks: (lmer(y~(1|id)+x,data=example.df,family=binomial)) Error in lmer(y ~ (1 | id) + x, data = example.df, family = binomial) : Leading minor of order 2 in downdated X'X is not positive definite In addition: Warning message: nlminb returned message singular convergence (7) in: LMEopt(x = mer, value = cv) Running lmer with list(msVerbose=TRUE): (lmer(y~(1| id)+x,data=example.df,family=binomial,control=list(msVerbose=TRUE))) 0 -545.002: 44801.6 1 -545.002: 44801.6 2 -545.002: 44801.6 3 -545.003: 44801.9 4 -545.014: 44805.2 5 -545.123: 44838.3 6 -546.208: 45168.3 7 -556.572: 48444.8 8 -628.932: 78993.4 9 -699.716: 127441. 10 -771.102: 206437. 11 -842.258: 333880. 12 -913.501: 540319. 13 -984.712: 874202. 14 -1055.93: 1.41452e+06 15 -1127.15: 2.28873e+06 16 -1198.37: 3.70326e+06 17 -1269.59: 5.99199e+06 18 -1340.81: 9.69524e+06 19 -1412.03: 1.56872e+07 20 -1483.25: 2.53825e+07 21 -1554.47: 4.10697e+07 22 -1625.69: 6.64522e+07 23 -1696.91: 1.07522e+08 24 -1768.13: 1.73974e+08 25 -1839.35: 2.81496e+08 26 -1910.57: 4.55470e+08 27 -1981.78: 7.36966e+08 28 -2053.00: 1.19244e+09 29 -2124.22: 1.92940e+09 30 -2195.44: 3.12184e+09 31 -2266.66: 5.05124e+09 32 -2337.88: 8.17308e+09 33 -2409.10: 1.32243e+10 34 -2480.32: 2.13974e+10 35 -2551.54: 3.46217e+10 36 -2622.76: 5.60190e+10 37 -2693.98: 9.06405e+10 38 -2765.20: 1.46659e+11 39 -2836.42: 2.37299e+11 40 -2907.64: 3.83962e+11 41 -2978.85: 6.21253e+11 42 -3050.07: 1.00521e+12 43 -3121.28: 1.62645e+12 44 -3192.47: 2.63147e+12
Re: [R] IMSL Wrapper
On 21 June 2006 at 09:36, Liaw, Andy wrote: | From: Sundar Dorai-Raj | Manoj wrote: | Dear All, | Is there any Wrapper written around IMSL C libraries | that makes | it possible to access the IMSL C functions from within R? | | Any pointers would be greatly appreciated! | | What functions are you looking for? I'd be surprised if IMSL | had some functionality that R did not. | | --sundar | | Perhaps another alternative is the gsl package, which provides R interface | to the GSL (if what Manoj wants is available there). But AFAIK the gsl package only wraps the GSL special functions. Dirk -- Hell, there are no rules here - we're trying to accomplish something. -- Thomas A. Edison __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Suggestion for ?split
Hi all, I noticed an undocumented feature for split. It sorts the resulting list according to the grouping factor. An example: test - data.frame(x=rnorm(48), f=letters[sample(1:8)]) split(test, test$f) I wasn't expecting this behaviour, although I was pleasantly surprised. I suggest that the help page for split be amended to include this feature. I know it's a small thing, but someone else may also find it useful to know. Cheers, Simon. -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] IMSL Wrapper
I'd be extremely interested to know what Manoj wants from the IMSL library and how it compares with open source software available in R and elsewhere. Best Wishes, Spencer Graves Dirk Eddelbuettel wrote: On 21 June 2006 at 09:36, Liaw, Andy wrote: | From: Sundar Dorai-Raj | Manoj wrote: | Dear All, | Is there any Wrapper written around IMSL C libraries | that makes | it possible to access the IMSL C functions from within R? | | Any pointers would be greatly appreciated! | | What functions are you looking for? I'd be surprised if IMSL | had some functionality that R did not. | | --sundar | | Perhaps another alternative is the gsl package, which provides R interface | to the GSL (if what Manoj wants is available there). But AFAIK the gsl package only wraps the GSL special functions. Dirk __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] eliminating a do loop
Have you tried these: png() lapply(simint.by.fit,plot) dev.off() 2006/6/22, Barker, Chris [SCIUS] [EMAIL PROTECTED]: Using a by() statement, I am preparing ANOVA's for multiple experiments, and using simint() to generate confidence intervals. This works fine. simint.by.fit - by(analytes.dfr, list(Assay = analytes.dfr$analyte ), function(data) (simint(value ~ tx, data = data,type='Tukey' ) ) ) I can separately prepare plots of the confidence intervals, and I can prepare separate plots or use for/do loop e.g. plot( simint.by.fit$Assay 1 ) plot( simint.by.fit$Assay 2) Is there a way to generate and save multiple -separate- plots without using a do loop, e.g. using lapply?. I tried a couple variations using lapply, lapply(simint.by.fit,plot) not surprising, I only get the last plot, the other plots seem to get overwritten. Thanks in advance [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- 黄荣贵 Department of Sociology Fudan University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] IMSL Wrapper
Dear All, Thanks for your replies and interest so far. I guess R pretty much covers most of what imsl offers but the area that I really wanted to test imsl out was in the optimization functions. Though the imsl functions are not as rich as NUOPT (which is quite expensive) , imsl c v6 claims that it's much faster and solves a broader range of problems hence the need for a wrapper. Cheers Manoj On 6/22/06, Spencer Graves [EMAIL PROTECTED] wrote: I'd be extremely interested to know what Manoj wants from the IMSL library and how it compares with open source software available in R and elsewhere. Best Wishes, Spencer Graves Dirk Eddelbuettel wrote: On 21 June 2006 at 09:36, Liaw, Andy wrote: | From: Sundar Dorai-Raj | Manoj wrote: | Dear All, | Is there any Wrapper written around IMSL C libraries | that makes | it possible to access the IMSL C functions from within R? | | Any pointers would be greatly appreciated! | | What functions are you looking for? I'd be surprised if IMSL | had some functionality that R did not. | | --sundar | | Perhaps another alternative is the gsl package, which provides R interface | to the GSL (if what Manoj wants is available there). But AFAIK the gsl package only wraps the GSL special functions. Dirk __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How to plot a image with restrictions?
Hello All! How to plot a image ( image function ) with restrictions, like a polygon?? Thanks in advance! Cleber N. Borges # problem example x - y - seq(-4*pi, 4*pi, len=27) r - sqrt(outer(x^2, y^2, +)) image( z ) contour(z, add = TRUE, drawlabels = FALSE) m=scan() 0.2 0.2 0.8 0.2 0.5 0.8 m = matrix(m,nr=3,byrow=T) polygon( m, lwd=5 ) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] rank(x,y)?
On 6/21/06, Duncan Murdoch [EMAIL PROTECTED] wrote: Peter Dalgaard wrote: Duncan Murdoch [EMAIL PROTECTED] writes: Suppose I have two columns, x,y. I can use order(x,y) to calculate a permutation that puts them into increasing order of x, with ties broken by y. I'd like instead to calculate the rank of each pair under the same ordering, but the rank() function doesn't take multiple values as input. Is there a simple way to get what I want? E.g. x - c(1,2,3,4,1,2,3,4) y - c(1,2,3,1,2,3,1,2) rank(x+y/10) [1] 1 3 6 7 2 4 5 8 gives me the answer I want, but only because I know the range of y and the size of gaps in the x values. What do I do in general? Still not quite general, but in the absence of ties: z[order(x,y)]-1:8 z [1] 1 3 6 7 2 4 5 8 Thanks to all who have replied. Unfortunately for me, ties do exist, and I'd like them to get identical ranks. John Fox's suggestion would handle ties properly, but I'm worried about rounding error giving spurious ties. Try this variant of my prior solution: (order(order(x,y)) + rev(order(order(rev(x), rev(y)/2 Note that no arithmetic is done on the original data, only on the output of order, so there should not be any worry about rounding -- in fact its sufficiently general that the data do not have to be numeric, e.g. x - c(a, a, b, a, c, d) y - c(b, a, b, b, a, a) (order(order(x,y)) + rev(order(order(rev(x), rev(y)/2 [1] 2.5 1.0 4.0 2.5 5.0 6.0 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html