[R] Question about cochran test in R
Dear R Experts, May be this is a basic question for you, but it is something I need really urgently. I need to perform a Chi Square analysis for more than two groups of paired observations. It seems to be ok For Cochran test. Unfortunately I have not found info about this test in R, except for dealing with outliers which is not my aim. I am looking for something like this https://www.medcalc.org/manual/cochranq.php I found a video to perform this analysis in R, but was not specially useful. Does some of you know have some info about how to make this analysis in R? Thanks in advance! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] Question about cochran test in R
Hi Luis, Try this page: http://www.r-bloggers.com/cochran-q-test-for-k-related-samples-in-r/ Jim On Thu, May 7, 2015 at 4:59 PM, Luis Fernando García luysgar...@gmail.com wrote: Dear R Experts, May be this is a basic question for you, but it is something I need really urgently. I need to perform a Chi Square analysis for more than two groups of paired observations. It seems to be ok For Cochran test. Unfortunately I have not found info about this test in R, except for dealing with outliers which is not my aim. I am looking for something like this https://www.medcalc.org/manual/cochranq.php I found a video to perform this analysis in R, but was not specially useful. Does some of you know have some info about how to make this analysis in R? Thanks in advance! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] Sort data and symbol change in Jitter plot (ggplot2)
Thanks all of you guys! Your answers were very useful! Thanks for the answer John, but I will try to keep the dotplot, but it is very useful to know both techniques anyway :) Petr, many thanks for your help, it was just what I needed, btw, the arrangment based on the median was a headache for me! again, thanks!!! 2015-05-05 4:34 GMT-03:00 Luis Fernando García luysgar...@gmail.com: Dear R experts, First than all I want to thank your expertise and for sharing your knowledge with the people who are starting. Recently I have been working on a new plot style (Jitterplot) but have still some issues when making two basic functions. First than all I want to change the symbol according to the prey type (presa) and not the color, I tried making, geom_dotplot(aes(fill = PRESA) but it did not work On a second hand I want to sort the plots from the highest to the lowest value, I tried by using reorder, but it did not work. Please find attached the dataset and the script. Thanks in advance! script## the dataset is attached library(ggplot2) p=read.table(paratropis.txt,header=T) attach(p) ggplot( data = p, aes(y = Tiempo, x = PRESA, reorder(PRESA, Tiempo, mean))) + # Move y and x here so than they can be used in stat_* geom_dotplot(aes(shape = PRESA), binaxis = y, # which axis to bin along binwidth = 0.1,# Minimal difference considered diffeerent stackdir = center# Centered ) + stat_summary(fun.y = mean, fun.ymin = mean, fun.ymax = mean, geom = crossbar, width = 0.5) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
[R] Problem with using flexmix for regression mixtures
Hi there, I would like to conduct a mixture regression analysis with the flexmix Package. Was just playing around with the function stepFlexmix() and did not get a foot into the door. When I run the stepFlexmix-function, I get the following error (actually a list of errors that repeats this sentence: Error in FLXfit(model = model, concomitant = concomitant, control = control, : 26 Log-likelihood: Inf The X-Variable is very skewed (percentages of females in top management teams; many zeros); missing data were omitted. The code was: M1 - stepFlexmix(rel_perf ~ prozfem, data = cdata2, k = 1:5, nrep = 5) I would appreciate any hint what the problem might be. Thanks in advance, Holger __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] MOnth over Month Variance in %
Sorry, I see that I forgot the link: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example John Kane Kingston ON Canada -Original Message- From: shivibha...@ymail.com Sent: Wed, 6 May 2015 22:32:37 -0700 (PDT) To: r-help@r-project.org Subject: Re: [R] MOnth over Month Variance in % Thanks John for the tip. I will use it and see what is the output. Also I will share my analysis on R then you can advice accordingly. -- View this message in context: http://r.789695.n4.nabble.com/MOnth-over-Month-Variance-in-tp4706873p4706923.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. GET FREE 5GB EMAIL - Check out spam free email with many cool features! Visit http://www.inbox.com/email to find out more! __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] How does ARules in R decide on LHS and RHS??
This is pretty sketchy. Perhaps some details might help. arules is in what package? Any code ? Any data? http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example John Kane Kingston ON Canada -Original Message- From: krishnakanth...@outlook.com Sent: Thu, 7 May 2015 11:45:29 +0530 To: r-help@r-project.org Subject: [R] How does ARules in R decide on LHS and RHS?? I was trying to study arules in R and got stuck on this doubt: How does arules code decide which column to be in LHS and which in RHS?? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. Can't remember your password? Do you need a strong and secure password? Use Password manager! It stores your passwords protects your account. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] Identifying matched groups based on a rule
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example You have not supplied anywhere near enough information. See the link above for some suggestions. John Kane Kingston ON Canada -Original Message- From: ajao...@gmail.com Sent: Thu, 7 May 2015 10:52:03 +0300 To: r-help@r-project.org Subject: [R] Identifying matched groups based on a rule Hello, I'm trying to create a table like below for a data set representing one test and indexed by five categories. Categories are grouped into a number of buckets (three in this case: A, B, C) based on the level at which the difference between groups is significant (0.05). Category, Group, Mean 1, A, 94.9 2, A, 94.8 3, A+B, 93.4 4, B+C, 91.4 5, C, 91.1 Is there a way to do this in R? Thanks. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks orcas on your desktop! __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
[R] About categorical explanatory variables
When you want to get the individual impact of each level of a single categorical explanatory variable on a variable continuous quantitative response, simply add the value of the estimated coefficient to the intercept or, more directly, just consider all levels of the categorical variable in the regression and omit the intercept, thereby obtaining in each coefficient estimated the individual effect of that particular category. But with 2 or more categorical variables, the intercept becomes the value of a reference group, jointly considering several categories, one for each qualitative variable. The coefficients in turn will be the difference between a specific group and the reference group. But I like to get the individual effects of each category and no effect of group categories. My question is: is there any way to get the individual effects in this case, where there are two or more categorical explanatory variables (these may be ordered, unordered, or both types)? If so, how to proceed in R? I have been looked, but I found nothing about it. Any help will be appreciated. Thanks for listening. Yours sincerely, Rafael Costa [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] package implementing continuous binomial?
On May 6, 2015, at 7:00 PM, Benjamin Tyner wrote: Hi I'm wondering if anyone is aware of an R package implementing (i.e., providing a pdf, cdf, and/or quantile function) for the continuous binomial distribution? Specifically the one characterized here: http://www2.math.uni-paderborn.de/fileadmin/Mathematik/AG-Indlekofer/Workshop/Satellite_meeting/ilenko.pdf Figured I would check here first, before attempting to code it up myself. I found that reading the ArXiv version of that material was easier to understand: http://arxiv.org/abs/1303.5990 zipfR package has an implementation of the incomplete beta function that might make some of the coding of the pdf and cdf more simple. Searching done with Graves' very useful utility package: library('sos') findFn(incomplete beta function) (I did't think that doing a search on continuous Binomial was likely to be helpful, but I tried it anyway and did not find any functions named continuous binomial in their help page titles.) -- David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R-es] Resumen de R-help-es, Vol 75, Envío 7
Hola Pedro, Rdocumentation recoge ya 7393 paquetes entre CRAN, Bioconductor y GitHub: http://www.rdocumentation.org/. De GitHub hay 260, pero sólo incluyen repos con 3 o más estrellas (o sea que hay muchos más). Hadley Wickham escribió código para estimar el número de repos de R en GitHub, pero no sé si ha quedado obsoleto (tiene 2 años): https://github.com/hadley/r-on-github. Lo que está claro es que el número de repositorios de R en GitHub crece a velocidad de vértigo... Saludos Paco El 06/05/2015 a las 16:16, Pedro Concejero Cerezo escribió: Y nadie sabe bien cuántos hay en github. Por cierto, ¿alguno conoce un código para hacer una estimación? -- Dr Francisco Rodriguez-Sanchez Integrative Ecology Group Estacion Biologica de Doñana - CSIC Avda. Americo Vespucio s/n 41092 Sevilla (Spain) http://bit.ly/frod_san ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es
[R] Getting INDIVIDUAL effects of multiple qualitative variables (ordered and unordered factors)
Dear R users, I have data from a questionnaire and I want to estimate the individual effect of each explanatory variable (all are qualitative) on the dependent variable (continuous). However, the default is to consider the estimated coefficients as the difference between the reference group (estimated value of the intercept) and the coefficient of the group. Each qualitative variable relates to a characteristic of a particular activity and the continuous variable is the time taken to perform this activity. I emphasize that the reference level of each factor relates to the case where none of the options for that factor was marked. The data is in http://www.datafilehost.com/d/c7f0d342;. I did not put them in the script, because I still do not know how to do this, but I hope this is not a problem (and I ask my sincere apologies). I do not put just a sample of the data, since there was singular matrix problems. First (and main) issue - In order to obtain the individual effect of the levels of each factor, I considered that the reference group has zero effect and I did the following steps: # Since the file was not loaded in the script, it is assumed here that it was downloaded from the internet and is already loaded in R. # I will make a quantile regression, so the package follows. install.packages (quantreg) library (quantreg) # Transforming factors into individual objects: p_1 = table (1: length (tabela1.1 $ p1), as.factor (tabela1.1 $ p1)) p_21 = table (1: length (tabela1.1 $ p21), as.factor (tabela1.1 $ p21)) p_22 = table (1: length (tabela1.1 $ p22), as.factor (tabela1.1 $ p22)) p_23 = table (1: length (tabela1.1 $ p23), as.factor (tabela1.1 $ p23)) p_24 = table (1: length (tabela1.1 $ p24), as.factor (tabela1.1 $ p24)) p_25 = table (1: length (tabela1.1 $ p25), as.factor (tabela1.1 $ p25)) p_34 = table (1: length (tabela1.1 $ p34), as.ordered (tabela1.1 $ p34)) p_5 = table (1: length (tabela1.1 $ p5), as.ordered (tabela1.1 $ p5)) p_6 = table (1: length (tabela1.1 $ p6), as.ordered (tabela1.1 $ p6)) p_7 = table (1: length (tabela1.1 $ p7), as.ordered (tabela1.1 $ p7)) p_8 = table (1: length (tabela1.1 $ p8), as.ordered (tabela1.1 $ p8)) p_9 = table (1: length (tabela1.1 $ p9), as.ordered (tabela1.1 $ p9)) # Regressing the model without intercept, but considering that the reference group = 0, considering that the reference group means that none of the factors has been marked (if any was marked, I believe that the time taken to perform the activity is practically zero). qrModel=rq(data=tabela1.1, pontoefetivo ~ 0 + p_1[,-1] + p_21[,-1] + p_22[,-1] + p_23[,-1] + p_24[,-1] + p_25[,-1] + p_34[,-1] + p_5[,-1] + p_6[,-1] + p_7[,-1] + p_8[,-1] + p_9[,-1], tau=0.5) summary(qrModel) My idea was that since the effect of the reference group is zero, the estimated coefficient of each level is precisely the individual effect of the chosen variable level. My idea is right? If not, what do I do to get these individual effects? Problem 2 - Assuming all is right above, ordered factors not have increasing effects [See summary (qrModel)]. But should not they have? If so, what do I do to ensure such an effect? Problem 3 - Again assuming that everything is correct, I hope that any estimated coefficients (individual effects on the runtime of the activity) are not negative values. Am I right about that? If so, what do I do to ensure that all values are not negative? I am looking forward any help. Thanks in advance , Rafael Costa. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] Convert csv to xpt file in R?
Dear Rxperts.. Thanks for your response. Below is the version on Windows 7 Enterprise (64-bit) OS machine..Yes, I tried SASxport, foreign and Hmisc.. have used SASxport before (not for writing to xpt though) and continue to have the same write to sas transport file issue.. version _ platform x86_64-w64-mingw32 arch x86_64 os mingw32 system x86_64, mingw32 status major 3 minor 0.2 year 2013 month 09 day25 svn rev63987 language R version.string R version 3.0.2 (2013-09-25) Thanks and regards, Santosh On Thu, May 7, 2015 at 8:51 AM, Nordlund, Dan (DSHS/RDA) nord...@dshs.wa.gov wrote: -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Santosh Sent: Wednesday, May 06, 2015 8:04 PM To: r-help Subject: [R] Convert csv to xpt file in R? Dear Rxperts.. Was wondering if there is a way in R to read a csv file and generate an XPT file? For some reason the function write.xport() does not seem to work for me i get the following error... error in label.data.frame(df,default=): length of default same as x A sample dataframe is given below xg2 - data.frame(aa=runif(10),bb=sample(runif(100),10)) SASformat(xg2$aa) - 'Numeric2' SASformat(xg2$bb) - 'Numeric2' label(xg2$aa) - test aa label(xg2$bb) - test bb label(xg2) - testa SAStype(xg2) - TestXge write.xport(xg2,file=A1.xpt) Error in label.data.frame(df, default = ) : length of default must same as x Any suggestions/tips are welcome.. Thanks and regards Santosh The code above runs without error and produces an xport file on my Win7 64-bit system running R-3.2.0. You haven't told us anything about your OS, version of R, and packages loaded. Have you tried running the code from a fresh start of R after only loading the SASxport package? Dan Daniel J. Nordlund Research and Data Analysis Division Services Enterprise Support Administration Washington State Department of Social and Health Services [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] Calling Function With Arguments In a Script
See e.g. Chapter 10.4 in the Intro to R Tutorial on the ... argument. The general idea is to define your function as: myfun - function (named_arguments,...) { # Some code ## now call your function as pairwisePlot(some_named_arguments,...) } You would then call myfun with the ...'s replaced by name=value argument pairs for your pairwisePlot function. e.g. myfun(named_arguments, arg1= value1, arg2=value2, etc.) where the arg1, arg2, etc. arguments would be arguments for pairwisePlot() passed down to it as ... arguments. Not hard, really, once you see how it works. (I suppose that's a tautology, though -- probably what physicists say about General Relativity). Incidentally, you could even have functions as arbitrary arguments to myfun and ... contain the argument lists for the function, something like: myfunc - function(fun,...) {fun(...) } Think of the flexibility this gives! One of the glories of functional programming -- functions are first class objects that can be used as arguments just like anything else. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. Clifford Stoll On Thu, May 7, 2015 at 1:50 PM, Rich Shepard rshep...@appl-ecosys.com wrote: I'm starting to put code in multi-use functions rather than in individual scripts and have not learned how to invoke the function from the command line. If this information is in Norman Matloff's 'The Art of R Programming' or Hadley Wickham's 'Advanced R' please point me to the proper place. Here's an example, the script 'pairwise-plots-continuous-vars.R' consists of this function: plotpairs - function(x1,x2,x3,y,plotmain) { require(compositions) opar - par(mar=c(4,4,3,1)) NO3 - x1 SO4 - x2 pH - x3 pairwisePlot(cbind(NO3,SO4,pH),clr(y),add.line=T) title(main=plotmain) par(opar) detach('package:compositions') return() } (I suppose the return statement is superfluous since there is no value returned to a calling function.) What I want to do is call plotpairs() with appropriate arguments for each plot as needed. TIA, Rich __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] nlminb supplying NaN parameters to objective function
Your immediate problem may be solved, but the exact value of that limiting value affects the parameter estimates a fair bit. I have not really looked at your function, but the ledge around it puts a kink (discontinuous first derivative) into it, which can mess up optimizers. Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, May 7, 2015 at 4:46 PM, Jean Marchal jean.d.marc...@gmail.com wrote: Yes, indeed! Problem solved! Thanks a lot! Jean 2015-05-07 14:06 GMT-07:00 William Dunlap wdun...@tibco.com: Your nLL function returns 1e+308 in near-boundary cases. Since 1e+308 is so close to machine infinity, it is easy to get into Inf-Inf (=NaN) or Inf/Inf (=NaN) situations when working with it. Try making that limiting value something smaller, like 1e+30, and you may have better luck. Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, May 7, 2015 at 1:14 PM, Jean Marchal jean.d.marc...@gmail.com wrote: A follow-up to my yesterday's email. I was able to make a reproducible example. All you will have to do is load the .RData file that you can download here: https://drive.google.com/file/d/0B0DKwRjF11x4dG1uRWhwb1pfQ2s/view?usp=sharing and run this line of code: nlminb(start=sv, objective = nLL, lower = 0, upper = Inf, control=list(trace=TRUE)) which output the following: 0: 12523.401: 0.0328502 0.0744493 0.00205298 0.0248628 0.0881807 0.0148887 0.0244485 0.0385922 0.0714495 0.0161784 0.0617551 0.0244901 0.0784038 1: 12421.888: 0.0282245 0.0697934 0.0 0.0199076 0.0833634 0.0101135 0.0189494 0.0336236 0.0712130 0.0160687 0.0616015 0.0244689 0.0660129 2: 12050.535: 0.00371847 0.0451786 0.0 0.0 0.0575667 0.0 0.0 0.00697067 0.0697205 0.0156250 0.0608550 0.0243431 0.0994355 3: 12037.682: 0.00303460 0.0445012 0.0 0.0 0.0568530 0.0 0.0 0.00636016 0.0696959 0.0156250 0.0608550 0.0243419 0.0988824 4: 12012.684: 0.00164710 0.0431313 0.0 0.0 0.0554032 0.0 0.0 0.00515500 0.0696451 0.0156250 0.0608550 0.0243395 0.0978328 5: 12003.017: 0.00107848 0.0425739 0.0 0.0 0.0548073 0.0 0.0 0.00469592 0.0696233 0.0156250 0.0608550 0.0243386 0.0974616 6: 11984.372: 0.0 0.0414397 0.0 0.0 0.0535899 0.0 0.0 0.00378996 0.0695782 0.0156250 0.0608550 0.0243370 0.0967449 7: 11978.154: 0.0 0.0409106 0.0 0.0 0.0530158 0.0 0.0 0.00340746 0.0695560 0.0156250 0.0608550 0.0243363 0.0964537 8:-0.000: 0.0 nan 0.0 0.0 nan 0.0 0.0 nan nan nan nan nan nan Regards, Jean 2015-05-06 17:43 GMT-07:00 Jean Marchal jean.d.marc...@gmail.com: Dear list, I am doing some maximum likelihood estimation using nlminb() with box-constraints to ensure that all parameters are positive. However, nlminb() is behaving strangely and seems to supply NaN as parameters to my objective function (confirmed using browser()) and output the following: $par [1] NaN NaN NaN 0 NaN 0 NaN NaN NaN NaN NaN NaN NaN $objective [1] 0 $convergence [1] 1 $iterations [1] 19 $evaluations function gradient 87 542 $message [1] gr cannot be computed at initial par (65) When I use trace = TRUE, I can see the following: 0: 32495.488: 0.0917404 0.703453 1.89661 1.11022e-16 1.11022e-16 0.107479 1.11022e-16 1.11022e-16 1.11022e-16 0.472377 0.894128 1.86743 1.11022e-16 1: 4035.3900: 0.0917404 0.703453 1.89661 1.11022e-16 1.11022e-16 0.107479 1.11022e-16 1.11022e-16 1.11022e-16 0.472377 0.894128 1.86743 0.25 2: 3955.8801: 0.0948452 0.704168 1.89651 0.000135456 0.0310485 0.107991 0.00138902 0.000427631 1.11022e-16 0.472331 0.894128 1.86743 0.25 3: 3951.4141: 0.0948926 0.703906 1.89640 2.99167e-05 0.0315288 0.109692 0.00242572 0.00272185 7.96814e-05 0.472780 0.894130 1.86744 0.249998 17: 3937.3923: 0.0947470 0.703030 1.89605 1.11022e-16 0.0300763 0.115081 0.00562496 0.00989997 0.000323268 0.474247 0.894142 1.86745 0.249737 18: 3937.3923: 0.0947470 0.703030 1.89605 1.11022e-16 0.0300763 0.115081 0.00562496 0.00989997 0.000323268 0.474247 0.894142 1.86745 0.249737 19:-0.000: -nan -nan -nan 1.11022e-16 -nan -nan -nan -nan -nan -nan -nan -nan nan my objective function looks like: nLL - function(params){ mu - drop(model.matrix(modelTermsObj) %*% params) if(any(mu 0) || anyNA(mu) || any(is.infinite(mu))){ return(.Machine$double.xmax) } else { return(-sum(dnbinom(x=args$data[,response], mu = mu, size = params[length(params)], log = TRUE))) } } I tried different starting values, different
Re: [R] nlminb supplying NaN parameters to objective function
Thanks for the advice! I will continue to monitor the optimizer behaviour. Jean 2015-05-07 17:03 GMT-07:00 William Dunlap wdun...@tibco.com: Your immediate problem may be solved, but the exact value of that limiting value affects the parameter estimates a fair bit. I have not really looked at your function, but the ledge around it puts a kink (discontinuous first derivative) into it, which can mess up optimizers. Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, May 7, 2015 at 4:46 PM, Jean Marchal jean.d.marc...@gmail.com wrote: Yes, indeed! Problem solved! Thanks a lot! Jean 2015-05-07 14:06 GMT-07:00 William Dunlap wdun...@tibco.com: Your nLL function returns 1e+308 in near-boundary cases. Since 1e+308 is so close to machine infinity, it is easy to get into Inf-Inf (=NaN) or Inf/Inf (=NaN) situations when working with it. Try making that limiting value something smaller, like 1e+30, and you may have better luck. Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, May 7, 2015 at 1:14 PM, Jean Marchal jean.d.marc...@gmail.com wrote: A follow-up to my yesterday's email. I was able to make a reproducible example. All you will have to do is load the .RData file that you can download here: https://drive.google.com/file/d/0B0DKwRjF11x4dG1uRWhwb1pfQ2s/view?usp=sharing and run this line of code: nlminb(start=sv, objective = nLL, lower = 0, upper = Inf, control=list(trace=TRUE)) which output the following: 0: 12523.401: 0.0328502 0.0744493 0.00205298 0.0248628 0.0881807 0.0148887 0.0244485 0.0385922 0.0714495 0.0161784 0.0617551 0.0244901 0.0784038 1: 12421.888: 0.0282245 0.0697934 0.0 0.0199076 0.0833634 0.0101135 0.0189494 0.0336236 0.0712130 0.0160687 0.0616015 0.0244689 0.0660129 2: 12050.535: 0.00371847 0.0451786 0.0 0.0 0.0575667 0.0 0.0 0.00697067 0.0697205 0.0156250 0.0608550 0.0243431 0.0994355 3: 12037.682: 0.00303460 0.0445012 0.0 0.0 0.0568530 0.0 0.0 0.00636016 0.0696959 0.0156250 0.0608550 0.0243419 0.0988824 4: 12012.684: 0.00164710 0.0431313 0.0 0.0 0.0554032 0.0 0.0 0.00515500 0.0696451 0.0156250 0.0608550 0.0243395 0.0978328 5: 12003.017: 0.00107848 0.0425739 0.0 0.0 0.0548073 0.0 0.0 0.00469592 0.0696233 0.0156250 0.0608550 0.0243386 0.0974616 6: 11984.372: 0.0 0.0414397 0.0 0.0 0.0535899 0.0 0.0 0.00378996 0.0695782 0.0156250 0.0608550 0.0243370 0.0967449 7: 11978.154: 0.0 0.0409106 0.0 0.0 0.0530158 0.0 0.0 0.00340746 0.0695560 0.0156250 0.0608550 0.0243363 0.0964537 8:-0.000: 0.0 nan 0.0 0.0 nan 0.0 0.0 nan nan nan nan nan nan Regards, Jean 2015-05-06 17:43 GMT-07:00 Jean Marchal jean.d.marc...@gmail.com: Dear list, I am doing some maximum likelihood estimation using nlminb() with box-constraints to ensure that all parameters are positive. However, nlminb() is behaving strangely and seems to supply NaN as parameters to my objective function (confirmed using browser()) and output the following: $par [1] NaN NaN NaN 0 NaN 0 NaN NaN NaN NaN NaN NaN NaN $objective [1] 0 $convergence [1] 1 $iterations [1] 19 $evaluations function gradient 87 542 $message [1] gr cannot be computed at initial par (65) When I use trace = TRUE, I can see the following: 0: 32495.488: 0.0917404 0.703453 1.89661 1.11022e-16 1.11022e-16 0.107479 1.11022e-16 1.11022e-16 1.11022e-16 0.472377 0.894128 1.86743 1.11022e-16 1: 4035.3900: 0.0917404 0.703453 1.89661 1.11022e-16 1.11022e-16 0.107479 1.11022e-16 1.11022e-16 1.11022e-16 0.472377 0.894128 1.86743 0.25 2: 3955.8801: 0.0948452 0.704168 1.89651 0.000135456 0.0310485 0.107991 0.00138902 0.000427631 1.11022e-16 0.472331 0.894128 1.86743 0.25 3: 3951.4141: 0.0948926 0.703906 1.89640 2.99167e-05 0.0315288 0.109692 0.00242572 0.00272185 7.96814e-05 0.472780 0.894130 1.86744 0.249998 17: 3937.3923: 0.0947470 0.703030 1.89605 1.11022e-16 0.0300763 0.115081 0.00562496 0.00989997 0.000323268 0.474247 0.894142 1.86745 0.249737 18: 3937.3923: 0.0947470 0.703030 1.89605 1.11022e-16 0.0300763 0.115081 0.00562496 0.00989997 0.000323268 0.474247 0.894142 1.86745 0.249737 19:-0.000: -nan -nan -nan 1.11022e-16 -nan -nan -nan -nan -nan -nan -nan -nan nan my objective function looks like: nLL - function(params){ mu - drop(model.matrix(modelTermsObj) %*% params) if(any(mu 0) || anyNA(mu) || any(is.infinite(mu))){ return(.Machine$double.xmax) } else {
Re: [R] Calling Function With Arguments In a Script
I don't know what your work flow looks like, but I certainly do not equate writing R with functions to passing parameters at the command line. Rather, these seem quite orthogonal to me. I often have one R file of functions, and another R file where I source the first file and keep a record of various invocations of those functions as I identify which parameter values answer questions I have, and I copy those to an interactive R console session for testing. I would find the operating system command line an uncomfortable place to experiment with those parameter values because I often want to use R to repeatedly invoke those functions with range of values and then plot those results. In fact, I can hardly imagine a scenario where I wanted to specify arguments when invoking my R script from the command line, since I can examine the status of the system clock, files and databases from inside R to determine what needed to be done next if I wanted to invoke a script automatically. I would only want to do that if I planned to call R from another scripting language, and I haven't needed to do that yet. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. On May 7, 2015 2:50:46 PM PDT, Rich Shepard rshep...@appl-ecosys.com wrote: On Thu, 7 May 2015, Clint Bowman wrote: as in source(pairwise-plots-continuous-vars.R) Clint, I did this before converting it to a function, when I modified the variables in the script. Did not try it as a function, should have. Thanks, Rich __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] nlminb supplying NaN parameters to objective function
Yes, indeed! Problem solved! Thanks a lot! Jean 2015-05-07 14:06 GMT-07:00 William Dunlap wdun...@tibco.com: Your nLL function returns 1e+308 in near-boundary cases. Since 1e+308 is so close to machine infinity, it is easy to get into Inf-Inf (=NaN) or Inf/Inf (=NaN) situations when working with it. Try making that limiting value something smaller, like 1e+30, and you may have better luck. Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, May 7, 2015 at 1:14 PM, Jean Marchal jean.d.marc...@gmail.com wrote: A follow-up to my yesterday's email. I was able to make a reproducible example. All you will have to do is load the .RData file that you can download here: https://drive.google.com/file/d/0B0DKwRjF11x4dG1uRWhwb1pfQ2s/view?usp=sharing and run this line of code: nlminb(start=sv, objective = nLL, lower = 0, upper = Inf, control=list(trace=TRUE)) which output the following: 0: 12523.401: 0.0328502 0.0744493 0.00205298 0.0248628 0.0881807 0.0148887 0.0244485 0.0385922 0.0714495 0.0161784 0.0617551 0.0244901 0.0784038 1: 12421.888: 0.0282245 0.0697934 0.0 0.0199076 0.0833634 0.0101135 0.0189494 0.0336236 0.0712130 0.0160687 0.0616015 0.0244689 0.0660129 2: 12050.535: 0.00371847 0.0451786 0.0 0.0 0.0575667 0.0 0.0 0.00697067 0.0697205 0.0156250 0.0608550 0.0243431 0.0994355 3: 12037.682: 0.00303460 0.0445012 0.0 0.0 0.0568530 0.0 0.0 0.00636016 0.0696959 0.0156250 0.0608550 0.0243419 0.0988824 4: 12012.684: 0.00164710 0.0431313 0.0 0.0 0.0554032 0.0 0.0 0.00515500 0.0696451 0.0156250 0.0608550 0.0243395 0.0978328 5: 12003.017: 0.00107848 0.0425739 0.0 0.0 0.0548073 0.0 0.0 0.00469592 0.0696233 0.0156250 0.0608550 0.0243386 0.0974616 6: 11984.372: 0.0 0.0414397 0.0 0.0 0.0535899 0.0 0.0 0.00378996 0.0695782 0.0156250 0.0608550 0.0243370 0.0967449 7: 11978.154: 0.0 0.0409106 0.0 0.0 0.0530158 0.0 0.0 0.00340746 0.0695560 0.0156250 0.0608550 0.0243363 0.0964537 8:-0.000: 0.0 nan 0.0 0.0 nan 0.0 0.0 nan nan nan nan nan nan Regards, Jean 2015-05-06 17:43 GMT-07:00 Jean Marchal jean.d.marc...@gmail.com: Dear list, I am doing some maximum likelihood estimation using nlminb() with box-constraints to ensure that all parameters are positive. However, nlminb() is behaving strangely and seems to supply NaN as parameters to my objective function (confirmed using browser()) and output the following: $par [1] NaN NaN NaN 0 NaN 0 NaN NaN NaN NaN NaN NaN NaN $objective [1] 0 $convergence [1] 1 $iterations [1] 19 $evaluations function gradient 87 542 $message [1] gr cannot be computed at initial par (65) When I use trace = TRUE, I can see the following: 0: 32495.488: 0.0917404 0.703453 1.89661 1.11022e-16 1.11022e-16 0.107479 1.11022e-16 1.11022e-16 1.11022e-16 0.472377 0.894128 1.86743 1.11022e-16 1: 4035.3900: 0.0917404 0.703453 1.89661 1.11022e-16 1.11022e-16 0.107479 1.11022e-16 1.11022e-16 1.11022e-16 0.472377 0.894128 1.86743 0.25 2: 3955.8801: 0.0948452 0.704168 1.89651 0.000135456 0.0310485 0.107991 0.00138902 0.000427631 1.11022e-16 0.472331 0.894128 1.86743 0.25 3: 3951.4141: 0.0948926 0.703906 1.89640 2.99167e-05 0.0315288 0.109692 0.00242572 0.00272185 7.96814e-05 0.472780 0.894130 1.86744 0.249998 17: 3937.3923: 0.0947470 0.703030 1.89605 1.11022e-16 0.0300763 0.115081 0.00562496 0.00989997 0.000323268 0.474247 0.894142 1.86745 0.249737 18: 3937.3923: 0.0947470 0.703030 1.89605 1.11022e-16 0.0300763 0.115081 0.00562496 0.00989997 0.000323268 0.474247 0.894142 1.86745 0.249737 19:-0.000: -nan -nan -nan 1.11022e-16 -nan -nan -nan -nan -nan -nan -nan -nan nan my objective function looks like: nLL - function(params){ mu - drop(model.matrix(modelTermsObj) %*% params) if(any(mu 0) || anyNA(mu) || any(is.infinite(mu))){ return(.Machine$double.xmax) } else { return(-sum(dnbinom(x=args$data[,response], mu = mu, size = params[length(params)], log = TRUE))) } } I tried different starting values, different bounds but without success so far. Is this a bug? PS after trying to make a reproducible example that I gracefully failed to do... I change my objective function so instead of using model.matrix(), I did the maths (e.g. Y ~ A + B * C). Thus, mu is now a bunch of NaN, and my objective function return .Machine$double.xmax which is fine. Then nlminb stops and returns (like if nothing happened): $par [1] 1.11022e-16 1.11022e-16 2.69205e-04 1.11022e-16 1.68161e-03 1.06027e-03 1.16969e-05 1.11022e-16 8.51669e+01
Re: [R] How to finding a given length of runs in a series of data?
Two libraries are needed to run the code you submitted ... library(dplyr) library(sqldf) Your IsHigh() function and its use can be replaced by a single line of code isHighFlow - as.numeric(Flow=1600) You are getting the additional hour by using cumsum(). One date element which you seem to characterize as zero hours returns a one in cumsum, two returns two, etc. cumsum(c(1, 0, 1, 1, 0, 1, 1, 1, 0)) If everything is off by one hour, just subtract a 1. Problem solved. Jean On Wed, May 6, 2015 at 5:55 PM, jcrosbie ja...@crosb.ie wrote: I'm trying to study times in which flow was operating at a given level or greater. To do so I have created a way to see how long the series has operated at a high level. But for some reason the data is calculating the runs one hour to long. Any ideas on why? Code: Date-format(seq(as.POSIXct(2014-01-01 01:00), as.POSIXct(2015-01-01 00:00), by=hour), %Y-%m-%d %H:%M, usetz = FALSE) Flow-runif(8760, 0, 2300) IsHigh- function(x ){ if (x 1600) return(0) if (1600 = x) return(1) } isHighFlow = unlist(lapply(Flow, IsHigh)) df = data.frame(Date, Flow, isHighFlow ) temp - df %% mutate(highFlowInterval = cumsum(isHighFlow==0)) %% group_by(highFlowInterval) %% summarise(hoursHighFlow = n(), minDate = min(as.character(Date)), maxDate = max(as.character(Date))) #Then join the two tables together. temp2-sqldf(SELECT * FROM temp LEFT JOIN df ON df.Date BETWEEN temp.minDate AND temp.maxDate) -- View this message in context: http://r.789695.n4.nabble.com/How-to-finding-a-given-length-of-runs-in-a-series-of-data-tp4706915.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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.
Re: [R] MOnth over Month Variance in %
Thanks John for the tip. I will use it and see what is the output. Also I will share my analysis on R then you can advice accordingly. -- View this message in context: http://r.789695.n4.nabble.com/MOnth-over-Month-Variance-in-tp4706873p4706923.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
[R] Identifying matched groups based on a rule
Hello, I'm trying to create a table like below for a data set representing one test and indexed by five categories. Categories are grouped into a number of buckets (three in this case: A, B, C) based on the level at which the difference between groups is significant (0.05). Category, Group, Mean 1, A, 94.9 2, A, 94.8 3, A+B, 93.4 4, B+C, 91.4 5, C, 91.1 Is there a way to do this in R? Thanks. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] Question about cochran test in R
On 2015-05-07 09:15, Jim Lemon wrote: Hi Luis, Try this page: http://www.r-bloggers.com/cochran-q-test-for-k-related-samples-in-r/ Jim Cochran's Q test is a marginal homogeneity test, and such tests can be performed by the 'mh_test' function in the 'coin' package. The following replicates the result in the blog post library(coin) dta - data.frame( + method= factor(rep(LETTERS[1:4], 6)), + repellent = factor(c(1, 1, 0, 0, + 1, 1, 0, 1, + 1, 0, 0, 0, + 1, 1, 1, 0, + 1, 1, 0, 1, + 1, 1, 0, 1)), + fabric= gl(6, 4, labels = as.roman(1:6)) + ) mh_test(repellent ~ method | fabric, data = dta) Asymptotic Marginal-Homogeneity Test data: repellent by method (A, B, C, D) stratified by fabric chi-squared = 9.3158, df = 3, p-value = 0.02537 and uses the asymptotic approximation to compute the p-value. The 'coin' package also allows you to approximate the exact null distribution using Monte Carlo methods: set.seed(123) mh_test(repellent ~ method | fabric, data = dta, + distribution = approximate(B = 1L)) Approximative Marginal-Homogeneity Test data: repellent by method (A, B, C, D) stratified by fabric chi-squared = 9.3158, p-value = 0.0202 For future reference, 'mh_test' is fairly general and handles both matched pairs or matched sets. So, the well-known tests due McNemar, Cochran, Stuart(-Maxwell) and Madansky are just special cases. For more general symmetry test problems, the 'coin' package offers the 'symmetry_test' function and this can be used to perform, e.g., multivariate marginal homogeneity tests like the multivariate McNemar test (Klingenberg and Agresti, 2006) or the multivariate Friedman test (Gerig, 1969). Henric On Thu, May 7, 2015 at 4:59 PM, Luis Fernando García luysgar...@gmail.com wrote: Dear R Experts, May be this is a basic question for you, but it is something I need really urgently. I need to perform a Chi Square analysis for more than two groups of paired observations. It seems to be ok For Cochran test. Unfortunately I have not found info about this test in R, except for dealing with outliers which is not my aim. I am looking for something like this https://www.medcalc.org/manual/cochranq.php I found a video to perform this analysis in R, but was not specially useful. Does some of you know have some info about how to make this analysis in R? Thanks in advance! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
[R] How does ARules in R decide on LHS and RHS??
I was trying to study arules in R and got stuck on this doubt: How does arules code decide which column to be in LHS and which in RHS?? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] package implementing continuous binomial?
Thanks David! I'll take a look at zipfR. Regards Ben On 05/07/2015 03:10 PM, David Winsemius wrote: On May 6, 2015, at 7:00 PM, Benjamin Tyner wrote: Hi I'm wondering if anyone is aware of an R package implementing (i.e., providing a pdf, cdf, and/or quantile function) for the continuous binomial distribution? Specifically the one characterized here: http://www2.math.uni-paderborn.de/fileadmin/Mathematik/AG-Indlekofer/Workshop/Satellite_meeting/ilenko.pdf Figured I would check here first, before attempting to code it up myself. I found that reading the ArXiv version of that material was easier to understand: http://arxiv.org/abs/1303.5990 zipfR package has an implementation of the incomplete beta function that might make some of the coding of the pdf and cdf more simple. Searching done with Graves' very useful utility package: library('sos') findFn(incomplete beta function) (I did't think that doing a search on continuous Binomial was likely to be helpful, but I tried it anyway and did not find any functions named continuous binomial in their help page titles.) __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
[R-es] Nueva publicación en blog en r-es.org
Nueva publicación en blog: Cursos, Cursos sobre R y otros en Barcelona, por gricoc en 07/05/15 15:52h Ver el blog en: http://r-es.org/tiki-view_blog_post.php?blogId=4postId=101 Si no desea recibir estas notificaciones siga este enlace: http://r-es.org/tiki-user_watches.php?id=49 ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es
Re: [R-es] Resumen de R-help-es, Vol 75, Envío 7
El detalle sobre la actividad de R en GitHub...: http://blog.revolutionanalytics.com/2015/02/r-among-top-languages-on-github.html http://githut.info/ Saludos, Carlos Ortega www.qualityexcellence.es El 7 de mayo de 2015, 21:40, Francisco Rodriguez Sanchez f.rodriguez.s...@gmail.com escribió: Hola Pedro, Rdocumentation recoge ya 7393 paquetes entre CRAN, Bioconductor y GitHub: http://www.rdocumentation.org/. De GitHub hay 260, pero sólo incluyen repos con 3 o más estrellas (o sea que hay muchos más). Hadley Wickham escribió código para estimar el número de repos de R en GitHub, pero no sé si ha quedado obsoleto (tiene 2 años): https://github.com/hadley/r-on-github. Lo que está claro es que el número de repositorios de R en GitHub crece a velocidad de vértigo... Saludos Paco El 06/05/2015 a las 16:16, Pedro Concejero Cerezo escribió: Y nadie sabe bien cuántos hay en github. Por cierto, ¿alguno conoce un código para hacer una estimación? -- Dr Francisco Rodriguez-Sanchez Integrative Ecology Group Estacion Biologica de Doñana - CSIC Avda. Americo Vespucio s/n 41092 Sevilla (Spain) http://bit.ly/frod_san ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es -- Saludos, Carlos Ortega www.qualityexcellence.es [[alternative HTML version deleted]] ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es
[R] Calling Function With Arguments In a Script
I'm starting to put code in multi-use functions rather than in individual scripts and have not learned how to invoke the function from the command line. If this information is in Norman Matloff's 'The Art of R Programming' or Hadley Wickham's 'Advanced R' please point me to the proper place. Here's an example, the script 'pairwise-plots-continuous-vars.R' consists of this function: plotpairs - function(x1,x2,x3,y,plotmain) { require(compositions) opar - par(mar=c(4,4,3,1)) NO3 - x1 SO4 - x2 pH - x3 pairwisePlot(cbind(NO3,SO4,pH),clr(y),add.line=T) title(main=plotmain) par(opar) detach('package:compositions') return() } (I suppose the return statement is superfluous since there is no value returned to a calling function.) What I want to do is call plotpairs() with appropriate arguments for each plot as needed. TIA, Rich __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] nlminb supplying NaN parameters to objective function
Your nLL function returns 1e+308 in near-boundary cases. Since 1e+308 is so close to machine infinity, it is easy to get into Inf-Inf (=NaN) or Inf/Inf (=NaN) situations when working with it. Try making that limiting value something smaller, like 1e+30, and you may have better luck. Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, May 7, 2015 at 1:14 PM, Jean Marchal jean.d.marc...@gmail.com wrote: A follow-up to my yesterday's email. I was able to make a reproducible example. All you will have to do is load the .RData file that you can download here: https://drive.google.com/file/d/0B0DKwRjF11x4dG1uRWhwb1pfQ2s/view?usp=sharing and run this line of code: nlminb(start=sv, objective = nLL, lower = 0, upper = Inf, control=list(trace=TRUE)) which output the following: 0: 12523.401: 0.0328502 0.0744493 0.00205298 0.0248628 0.0881807 0.0148887 0.0244485 0.0385922 0.0714495 0.0161784 0.0617551 0.0244901 0.0784038 1: 12421.888: 0.0282245 0.0697934 0.0 0.0199076 0.0833634 0.0101135 0.0189494 0.0336236 0.0712130 0.0160687 0.0616015 0.0244689 0.0660129 2: 12050.535: 0.00371847 0.0451786 0.0 0.0 0.0575667 0.0 0.0 0.00697067 0.0697205 0.0156250 0.0608550 0.0243431 0.0994355 3: 12037.682: 0.00303460 0.0445012 0.0 0.0 0.0568530 0.0 0.0 0.00636016 0.0696959 0.0156250 0.0608550 0.0243419 0.0988824 4: 12012.684: 0.00164710 0.0431313 0.0 0.0 0.0554032 0.0 0.0 0.00515500 0.0696451 0.0156250 0.0608550 0.0243395 0.0978328 5: 12003.017: 0.00107848 0.0425739 0.0 0.0 0.0548073 0.0 0.0 0.00469592 0.0696233 0.0156250 0.0608550 0.0243386 0.0974616 6: 11984.372: 0.0 0.0414397 0.0 0.0 0.0535899 0.0 0.0 0.00378996 0.0695782 0.0156250 0.0608550 0.0243370 0.0967449 7: 11978.154: 0.0 0.0409106 0.0 0.0 0.0530158 0.0 0.0 0.00340746 0.0695560 0.0156250 0.0608550 0.0243363 0.0964537 8:-0.000: 0.0 nan 0.0 0.0 nan 0.0 0.0 nan nan nan nan nan nan Regards, Jean 2015-05-06 17:43 GMT-07:00 Jean Marchal jean.d.marc...@gmail.com: Dear list, I am doing some maximum likelihood estimation using nlminb() with box-constraints to ensure that all parameters are positive. However, nlminb() is behaving strangely and seems to supply NaN as parameters to my objective function (confirmed using browser()) and output the following: $par [1] NaN NaN NaN 0 NaN 0 NaN NaN NaN NaN NaN NaN NaN $objective [1] 0 $convergence [1] 1 $iterations [1] 19 $evaluations function gradient 87 542 $message [1] gr cannot be computed at initial par (65) When I use trace = TRUE, I can see the following: 0: 32495.488: 0.0917404 0.703453 1.89661 1.11022e-16 1.11022e-16 0.107479 1.11022e-16 1.11022e-16 1.11022e-16 0.472377 0.894128 1.86743 1.11022e-16 1: 4035.3900: 0.0917404 0.703453 1.89661 1.11022e-16 1.11022e-16 0.107479 1.11022e-16 1.11022e-16 1.11022e-16 0.472377 0.894128 1.86743 0.25 2: 3955.8801: 0.0948452 0.704168 1.89651 0.000135456 0.0310485 0.107991 0.00138902 0.000427631 1.11022e-16 0.472331 0.894128 1.86743 0.25 3: 3951.4141: 0.0948926 0.703906 1.89640 2.99167e-05 0.0315288 0.109692 0.00242572 0.00272185 7.96814e-05 0.472780 0.894130 1.86744 0.249998 17: 3937.3923: 0.0947470 0.703030 1.89605 1.11022e-16 0.0300763 0.115081 0.00562496 0.00989997 0.000323268 0.474247 0.894142 1.86745 0.249737 18: 3937.3923: 0.0947470 0.703030 1.89605 1.11022e-16 0.0300763 0.115081 0.00562496 0.00989997 0.000323268 0.474247 0.894142 1.86745 0.249737 19:-0.000: -nan -nan -nan 1.11022e-16 -nan -nan -nan -nan -nan -nan -nan -nan nan my objective function looks like: nLL - function(params){ mu - drop(model.matrix(modelTermsObj) %*% params) if(any(mu 0) || anyNA(mu) || any(is.infinite(mu))){ return(.Machine$double.xmax) } else { return(-sum(dnbinom(x=args$data[,response], mu = mu, size = params[length(params)], log = TRUE))) } } I tried different starting values, different bounds but without success so far. Is this a bug? PS after trying to make a reproducible example that I gracefully failed to do... I change my objective function so instead of using model.matrix(), I did the maths (e.g. Y ~ A + B * C). Thus, mu is now a bunch of NaN, and my objective function return .Machine$double.xmax which is fine. Then nlminb stops and returns (like if nothing happened): $par [1] 1.11022e-16 1.11022e-16 2.69205e-04 1.11022e-16 1.68161e-03 1.06027e-03 1.16969e-05 1.11022e-16 8.51669e+01 7.31162e+01 5.04748e+00 5.28373e+00 1.23992e-01 $objective [1] 3823.567 $convergence [1] 0 $iterations [1]
Re: [R] nlminb supplying NaN parameters to objective function
A follow-up to my yesterday's email. I was able to make a reproducible example. All you will have to do is load the .RData file that you can download here: https://drive.google.com/file/d/0B0DKwRjF11x4dG1uRWhwb1pfQ2s/view?usp=sharing and run this line of code: nlminb(start=sv, objective = nLL, lower = 0, upper = Inf, control=list(trace=TRUE)) which output the following: 0: 12523.401: 0.0328502 0.0744493 0.00205298 0.0248628 0.0881807 0.0148887 0.0244485 0.0385922 0.0714495 0.0161784 0.0617551 0.0244901 0.0784038 1: 12421.888: 0.0282245 0.0697934 0.0 0.0199076 0.0833634 0.0101135 0.0189494 0.0336236 0.0712130 0.0160687 0.0616015 0.0244689 0.0660129 2: 12050.535: 0.00371847 0.0451786 0.0 0.0 0.0575667 0.0 0.0 0.00697067 0.0697205 0.0156250 0.0608550 0.0243431 0.0994355 3: 12037.682: 0.00303460 0.0445012 0.0 0.0 0.0568530 0.0 0.0 0.00636016 0.0696959 0.0156250 0.0608550 0.0243419 0.0988824 4: 12012.684: 0.00164710 0.0431313 0.0 0.0 0.0554032 0.0 0.0 0.00515500 0.0696451 0.0156250 0.0608550 0.0243395 0.0978328 5: 12003.017: 0.00107848 0.0425739 0.0 0.0 0.0548073 0.0 0.0 0.00469592 0.0696233 0.0156250 0.0608550 0.0243386 0.0974616 6: 11984.372: 0.0 0.0414397 0.0 0.0 0.0535899 0.0 0.0 0.00378996 0.0695782 0.0156250 0.0608550 0.0243370 0.0967449 7: 11978.154: 0.0 0.0409106 0.0 0.0 0.0530158 0.0 0.0 0.00340746 0.0695560 0.0156250 0.0608550 0.0243363 0.0964537 8:-0.000: 0.0 nan 0.0 0.0 nan 0.0 0.0 nan nan nan nan nan nan Regards, Jean 2015-05-06 17:43 GMT-07:00 Jean Marchal jean.d.marc...@gmail.com: Dear list, I am doing some maximum likelihood estimation using nlminb() with box-constraints to ensure that all parameters are positive. However, nlminb() is behaving strangely and seems to supply NaN as parameters to my objective function (confirmed using browser()) and output the following: $par [1] NaN NaN NaN 0 NaN 0 NaN NaN NaN NaN NaN NaN NaN $objective [1] 0 $convergence [1] 1 $iterations [1] 19 $evaluations function gradient 87 542 $message [1] gr cannot be computed at initial par (65) When I use trace = TRUE, I can see the following: 0: 32495.488: 0.0917404 0.703453 1.89661 1.11022e-16 1.11022e-16 0.107479 1.11022e-16 1.11022e-16 1.11022e-16 0.472377 0.894128 1.86743 1.11022e-16 1: 4035.3900: 0.0917404 0.703453 1.89661 1.11022e-16 1.11022e-16 0.107479 1.11022e-16 1.11022e-16 1.11022e-16 0.472377 0.894128 1.86743 0.25 2: 3955.8801: 0.0948452 0.704168 1.89651 0.000135456 0.0310485 0.107991 0.00138902 0.000427631 1.11022e-16 0.472331 0.894128 1.86743 0.25 3: 3951.4141: 0.0948926 0.703906 1.89640 2.99167e-05 0.0315288 0.109692 0.00242572 0.00272185 7.96814e-05 0.472780 0.894130 1.86744 0.249998 17: 3937.3923: 0.0947470 0.703030 1.89605 1.11022e-16 0.0300763 0.115081 0.00562496 0.00989997 0.000323268 0.474247 0.894142 1.86745 0.249737 18: 3937.3923: 0.0947470 0.703030 1.89605 1.11022e-16 0.0300763 0.115081 0.00562496 0.00989997 0.000323268 0.474247 0.894142 1.86745 0.249737 19:-0.000: -nan -nan -nan 1.11022e-16 -nan -nan -nan -nan -nan -nan -nan -nan nan my objective function looks like: nLL - function(params){ mu - drop(model.matrix(modelTermsObj) %*% params) if(any(mu 0) || anyNA(mu) || any(is.infinite(mu))){ return(.Machine$double.xmax) } else { return(-sum(dnbinom(x=args$data[,response], mu = mu, size = params[length(params)], log = TRUE))) } } I tried different starting values, different bounds but without success so far. Is this a bug? PS after trying to make a reproducible example that I gracefully failed to do... I change my objective function so instead of using model.matrix(), I did the maths (e.g. Y ~ A + B * C). Thus, mu is now a bunch of NaN, and my objective function return .Machine$double.xmax which is fine. Then nlminb stops and returns (like if nothing happened): $par [1] 1.11022e-16 1.11022e-16 2.69205e-04 1.11022e-16 1.68161e-03 1.06027e-03 1.16969e-05 1.11022e-16 8.51669e+01 7.31162e+01 5.04748e+00 5.28373e+00 1.23992e-01 $objective [1] 3823.567 $convergence [1] 0 $iterations [1] 1 $evaluations function gradient 2 13 $message [1] X-convergence (3) I can provide the data and model if necessary but cannot make them publicly available (yet). Thank you, Jean __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] Getting INDIVIDUAL effects of multiple qualitative variables (ordered and unordered factors)
## I think this is what you are looking for. ## Your download host seems to want to give me software, so I am not taking it. tmp - data.frame(y=rnorm(20), a=factor(rep(letters[1:4], each=5))) tmp.aov - aov(y ~ a, data=tmp) summary(tmp.aov) summary(tmp.aov, split=list(a=list(b=1, c=2, d=3))) summary.lm(tmp.aov) Rich On Thu, May 7, 2015 at 2:43 PM, Rafael Costa rafaelcarneirocosta...@gmail.com wrote: Dear R users, I have data from a questionnaire and I want to estimate the individual effect of each explanatory variable (all are qualitative) on the dependent variable (continuous). However, the default is to consider the estimated coefficients as the difference between the reference group (estimated value of the intercept) and the coefficient of the group. Each qualitative variable relates to a characteristic of a particular activity and the continuous variable is the time taken to perform this activity. I emphasize that the reference level of each factor relates to the case where none of the options for that factor was marked. The data is in http://www.datafilehost.com/d/c7f0d342;. I did not put them in the script, because I still do not know how to do this, but I hope this is not a problem (and I ask my sincere apologies). I do not put just a sample of the data, since there was singular matrix problems. First (and main) issue - In order to obtain the individual effect of the levels of each factor, I considered that the reference group has zero effect and I did the following steps: # Since the file was not loaded in the script, it is assumed here that it was downloaded from the internet and is already loaded in R. # I will make a quantile regression, so the package follows. install.packages (quantreg) library (quantreg) # Transforming factors into individual objects: p_1 = table (1: length (tabela1.1 $ p1), as.factor (tabela1.1 $ p1)) p_21 = table (1: length (tabela1.1 $ p21), as.factor (tabela1.1 $ p21)) p_22 = table (1: length (tabela1.1 $ p22), as.factor (tabela1.1 $ p22)) p_23 = table (1: length (tabela1.1 $ p23), as.factor (tabela1.1 $ p23)) p_24 = table (1: length (tabela1.1 $ p24), as.factor (tabela1.1 $ p24)) p_25 = table (1: length (tabela1.1 $ p25), as.factor (tabela1.1 $ p25)) p_34 = table (1: length (tabela1.1 $ p34), as.ordered (tabela1.1 $ p34)) p_5 = table (1: length (tabela1.1 $ p5), as.ordered (tabela1.1 $ p5)) p_6 = table (1: length (tabela1.1 $ p6), as.ordered (tabela1.1 $ p6)) p_7 = table (1: length (tabela1.1 $ p7), as.ordered (tabela1.1 $ p7)) p_8 = table (1: length (tabela1.1 $ p8), as.ordered (tabela1.1 $ p8)) p_9 = table (1: length (tabela1.1 $ p9), as.ordered (tabela1.1 $ p9)) # Regressing the model without intercept, but considering that the reference group = 0, considering that the reference group means that none of the factors has been marked (if any was marked, I believe that the time taken to perform the activity is practically zero). qrModel=rq(data=tabela1.1, pontoefetivo ~ 0 + p_1[,-1] + p_21[,-1] + p_22[,-1] + p_23[,-1] + p_24[,-1] + p_25[,-1] + p_34[,-1] + p_5[,-1] + p_6[,-1] + p_7[,-1] + p_8[,-1] + p_9[,-1], tau=0.5) summary(qrModel) My idea was that since the effect of the reference group is zero, the estimated coefficient of each level is precisely the individual effect of the chosen variable level. My idea is right? If not, what do I do to get these individual effects? Problem 2 - Assuming all is right above, ordered factors not have increasing effects [See summary (qrModel)]. But should not they have? If so, what do I do to ensure such an effect? Problem 3 - Again assuming that everything is correct, I hope that any estimated coefficients (individual effects on the runtime of the activity) are not negative values. Am I right about that? If so, what do I do to ensure that all values are not negative? I am looking forward any help. Thanks in advance , Rafael Costa. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] Calling Function With Arguments In a Script
On Thu, 7 May 2015, Bert Gunter wrote: See e.g. Chapter 10.4 in the Intro to R Tutorial on the ... argument. Bert, Thanks. That was going to be my next step. Much appreciated, Rich __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] Calling Function With Arguments In a Script
On Thu, 7 May 2015, Clint Bowman wrote: as in source(pairwise-plots-continuous-vars.R) Clint, I did this before converting it to a function, when I modified the variables in the script. Did not try it as a function, should have. Thanks, Rich __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] Calling Function With Arguments In a Script
?source as in source(pairwise-plots-continuous-vars.R) then plotpairs(first,second,third,wise,title) should get you going Clint BowmanINTERNET: cl...@ecy.wa.gov Air Quality Modeler INTERNET: cl...@math.utah.edu Department of Ecology VOICE: (360) 407-6815 PO Box 47600FAX:(360) 407-7534 Olympia, WA 98504-7600 USPS: PO Box 47600, Olympia, WA 98504-7600 Parcels:300 Desmond Drive, Lacey, WA 98503-1274 On Thu, 7 May 2015, Rich Shepard wrote: I'm starting to put code in multi-use functions rather than in individual scripts and have not learned how to invoke the function from the command line. If this information is in Norman Matloff's 'The Art of R Programming' or Hadley Wickham's 'Advanced R' please point me to the proper place. Here's an example, the script 'pairwise-plots-continuous-vars.R' consists of this function: plotpairs - function(x1,x2,x3,y,plotmain) { require(compositions) opar - par(mar=c(4,4,3,1)) NO3 - x1 SO4 - x2 pH - x3 pairwisePlot(cbind(NO3,SO4,pH),clr(y),add.line=T) title(main=plotmain) par(opar) detach('package:compositions') return() } (I suppose the return statement is superfluous since there is no value returned to a calling function.) What I want to do is call plotpairs() with appropriate arguments for each plot as needed. TIA, Rich __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] Convert csv to xpt file in R?
-Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Santosh Sent: Wednesday, May 06, 2015 8:04 PM To: r-help Subject: [R] Convert csv to xpt file in R? Dear Rxperts.. Was wondering if there is a way in R to read a csv file and generate an XPT file? For some reason the function write.xport() does not seem to work for me i get the following error... error in label.data.frame(df,default=): length of default same as x A sample dataframe is given below xg2 - data.frame(aa=runif(10),bb=sample(runif(100),10)) SASformat(xg2$aa) - 'Numeric2' SASformat(xg2$bb) - 'Numeric2' label(xg2$aa) - test aa label(xg2$bb) - test bb label(xg2) - testa SAStype(xg2) - TestXge write.xport(xg2,file=A1.xpt) Error in label.data.frame(df, default = ) : length of default must same as x Any suggestions/tips are welcome.. Thanks and regards Santosh The code above runs without error and produces an xport file on my Win7 64-bit system running R-3.2.0. You haven't told us anything about your OS, version of R, and packages loaded. Have you tried running the code from a fresh start of R after only loading the SASxport package? Dan Daniel J. Nordlund Research and Data Analysis Division Services Enterprise Support Administration Washington State Department of Social and Health Services __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] Non UTFB
On 07 May 2015, at 12:58 , khal sal card...@live.ca wrote: I am getting this message after I installed R on MAC What should I do? Consult the R for Mac OS X FAQ, I expect. Specifically Section 7, Internationalization. Notice that we cannot see what your locale settings are, and that your post has been mangled because it was posted in HTML, but there is this specific information in the FAQ: Please note that you must always use `.UTF-8' version of the locale, otherwise R.app will not work properly. - Peter D. During startup - Warning messages: 1: Setting LC_CTYPE failed, using C 2: Setting LC_COLLATE failed, using C 3: Setting LC_TIME failed, using C 4: Setting LC_MESSAGES failed, using C 5: Setting LC_PAPER failed, using C [R.app GUI 1.50 (6126) x86_64-apple-darwin9.8.0] amp;#114;amp;#x2d;amp;#104;amp;#x65;amp;#108;amp;#112;amp;#32;amp;#x61;amp;#116;amp;#32;amp;#82;amp;#x2d;amp;#112;amp;#114;amp;#x6f;amp;#106;amp;#x65;amp;#x63;amp;#116;amp;#32;amp;#100;amp;#x6f;amp;#116;amp;#32;amp;#x6f;amp;#114;amp;#x67 khal [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] Not able to submit work assignment4 with submitscript3.R
Hi there, this is not a Coursera Forum. Please ask your question there or search the Forums, these are quite regular problems there. PS: do you really have a user name and a password in your e-mail? Feladó: R-help [r-help-boun...@r-project.org] ; meghatalmaz#243;: Sonia Marin [s.marin...@gmail.com] Küldve: 2015. május 6. 23:27 To: r-help@r-project.org Tárgy: [R] Not able to submit work assignment4 with submitscript3.R Hi, I tried to submit the work assignment4 with submitscript3.R and i got an error message: Error in assign(.CourseraLogin, r, globalenv()) : unused arguments (r, globalenv()) I tryied to do it manually, but the files that I got to upload was empty. Please, let me know, how can i do to send the work assignment4. Thanks, for your attention. Best regard Sonia Marin rprog-013 TNWpNjGERh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
[R] Non UTFB
I am getting this message after I installed R on MAC What should I do? During startup - Warning messages: 1: Setting LC_CTYPE failed, using C 2: Setting LC_COLLATE failed, using C 3: Setting LC_TIME failed, using C 4: Setting LC_MESSAGES failed, using C 5: Setting LC_PAPER failed, using C [R.app GUI 1.50 (6126) x86_64-apple-darwin9.8.0] amp;#114;amp;#x2d;amp;#104;amp;#x65;amp;#108;amp;#112;amp;#32;amp;#x61;amp;#116;amp;#32;amp;#82;amp;#x2d;amp;#112;amp;#114;amp;#x6f;amp;#106;amp;#x65;amp;#x63;amp;#116;amp;#32;amp;#100;amp;#x6f;amp;#116;amp;#32;amp;#x6f;amp;#114;amp;#x67 khal [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.