Re: [R] What are the pros and cons of the log.p parameter in (p|q)norm and similar?

2021-08-04 Thread matthias-gondan
Response to 1You need the log version e.g. in maximum likelihood, otherwise the product of the densities and probabilities can become very small. Ursprüngliche Nachricht Von: r-help-requ...@r-project.org Datum: 04.08.21 12:01 (GMT+01:00) An: r-help@r-project.org Betreff:

Re: [R] density with weights missing values

2021-07-13 Thread Matthias Gondan
. Best wishes, Matthias PS. Sorry for the HTML email. I’ve given up trying to fix such behavior. Von: Martin Maechler Gesendet: Dienstag, 13. Juli 2021 09:09 An: Matthias Gondan Cc: r-help@r-project.org Betreff: Re: [R] density with weights missing values >>>>>

Re: [R] density with weights missing values

2021-07-12 Thread matthias-gondan
: 12.07.21 18:44 (GMT+01:00) An: r-help@r-project.org, matthias-gondan , Bert Gunter Cc: r-help@r-project.org Betreff: Re: [R] density with weights missing values Sure, you might think that.But most likely the reason this code has not been corrected is that when you give weights for missing data

Re: [R] density with weights missing values

2021-07-12 Thread matthias-gondan
?  Ursprüngliche Nachricht Von: Bert Gunter Datum: 12.07.21 16:25 (GMT+01:00) An: Matthias Gondan Cc: r-help@r-project.org Betreff: Re: [R] density with weights missing values The behavior is as documented AFAICS.na.rmlogical; if TRUE, missing values are removed from x. If FALSE anymissing values

Re: [R] density with weights missing values

2021-07-12 Thread Matthias Gondan
a.rm=TRUE) [1] 2 Von: Richard O'Keefe Gesendet: Montag, 12. Juli 2021 13:18 An: Matthias Gondan Betreff: Re: [R] density with weights missing values Does your copy of R say that the weights must add up to 1? ?density doesn't say that in mine. But it does check. On Mon, 12 Jul 2021 at 22:42,

[R] density with weights missing values

2021-07-12 Thread Matthias Gondan
Dear R users, This works as expected: • plot(density(c(1,2, 3, 4, 5, NA), na.rm=TRUE)) This raises an error • plot(density(c(1,2, 3, 4, 5, NA), na.rm=TRUE, weights=c(1, 1, 1, 1, 1, 1))) • plot(density(c(1,2, 3, 4, 5, NA), na.rm=TRUE, weights=c(1, 1, 1, 1, 1, NA))) This seems to work (it

[R] Embedded R: Test if initialized

2021-06-16 Thread Matthias Gondan
Dear R friends, I am currently trying to write a piece of C code that uses „embedded R“, and for specific reasons*, I cannot keep track if R already has been initialized. So the code snippet looks like this: LibExtern char *R_TempDir; if(R_TempDir == NULL) …throw exception R not

Re: [R] Strange lazy evaluation of default arguments

2017-09-05 Thread Matthias Gondan
So, I’ll stick with R. Still 25 years or so until retirement, but I’ll survive, even without crossreferenced default arguments. Best wishes, Matthias Von: S Ellison Gesendet: Dienstag, 5. September 2017 16:17 An: Matthias Gondan; r-help@r-project.org Betreff: RE: [R] Strange lazy evaluation of de

Re: [R] Strange lazy evaluation of default arguments

2017-09-02 Thread Matthias Gondan
mu=0.53, sigma2=4.3^2) # instead of l=u And maybe also „in-place“ changes of values… Best regards, Matthias Von: William Dunlap Gesendet: Samstag, 2. September 2017 19:41 An: Rui Barradas Cc: Matthias Gondan; r-help@r-project.org Betreff: Re: [R] Strange lazy evaluation of default argume

[R] Strange lazy evaluation of default arguments

2017-09-02 Thread Matthias Gondan
Dear R developers, sessionInfo() below Please have a look at the following two versions of the same function: 1. Intended behavior: > Su1 = function(u=100, l=u, mu=0.53, sigma2=4.3^2) + { + print(c(u, l, mu)) # here, l is set to u’s value + u = u/sqrt(sigma2) + l = l/sqrt(sigma2) + mu

Re: [R] Quantiles with ordered categories

2017-03-14 Thread matthias-gondan
I found it: quantile(ordered(1:10), probs=0.5, type=1) works, because type=1 seems to round up or down, whatever. The default option for is 7, which wants to interpolate, and then produces the error. Two options come to my mind: - The error message could be improved. - The default type

[R] Quantiles with ordered categories

2017-03-14 Thread matthias-gondan
Dear R users, This works: quantile(1:10, probs=0.5) This fails (obviously): quantile(factor(1:10), probs=0.5) But why do quantiles for ordered factors not work either? quantile(ordered(1:10), probs=0.5) Is it because interpolation (see the optional type argument) is not defined? Is there

Re: [R] problem with any function

2012-11-17 Thread Matthias Gondan
The warning 1: In (ind.c == TRUE) (ind.sgn == TRUE) : longer object length is not a multiple of shorter object length means that ind.c and ind.sgn have different lengths, for whatever reason. Although R continues the routine, the warning should, in general, not be ignored. Try: 1:3 + 1:2

[R] ylim with only one value specified

2012-10-09 Thread Matthias Gondan
, Inf)[as a replacement for NULL/ autoselection] and ylim=c(Inf, -Inf)[autoselection, reversed y axis] should be handled correctly. I would find such a feature useful. Do you think it would interfere with other functions? Thank you for your consideration. Best wishes, Matthias Gondan

Re: [R] transform RTs

2012-08-30 Thread Matthias Gondan
you might to do something like library(SuppDists) t = runif(100, 100, 500) # original RT t_IG = qinvGauss(ecdf(t)(t)-0.5/length(t), 1, 16) plot(density(t_IG)) but what is the purpose of it? Usually reaction times are thought to follow a certain kind of distribution (e.g. an inverse Gaussian

Re: [R] What makes R different from other programming languages?

2012-08-20 Thread Matthias Gondan
My vote: 1. Symbolic function arguments: fn = function(a, b) { a/b } fn(b=10, a=2) 2. Names for elements of a vector and matrices v = c(a=1, b=2) v['a'] = v['a'] * 2 same for matrices 3. about 10,000 user-contributed packages on CRAN 4. weird things like a = numeric(10) a[1:10] = 1:2

[R] line width in legend of interaction.plot

2012-02-22 Thread Matthias Gondan
leg.lwd Best wishes, Matthias Gondan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained

[R] Reference for dataset colon (package survival)

2012-01-17 Thread Matthias Gondan
Dear R team, dear Prof. Therneau, library(survival) data(colon) ?colon gives me only a very rudimentary source (only a name). Is there a possibility to get a reference to the clinical trial these data are taken from? Many thanks in advance. With best wishes, Matthias Gondan

[R] Fwd: Re: Poisson GLM using non-integer response/predictors?

2011-12-30 Thread Matthias Gondan
Hi, Use offset variables if count occurrences of an event and you want to model the observation time. glm(count ~ predictors + offset(log(observation_time)), family=poisson) If you want to compare durations, look at library(survival), ?coxph If tnoise_sqrt is the square root of tourist noise,

Re: [R] Fwd: Re: Poisson GLM using non-integer response/predictors?

2011-12-30 Thread Matthias Gondan
Hi Ben, Thanks for clarifying this, I used a misleading word, model the observation time sounds as if observation time were the dependent variable - which it is not, of course, instead, in the scenario described, the parrot counts are modeled. Best wishes, Matthias Am 30.12.2011 20:50,

[R] arrow egdes and lty

2011-11-14 Thread Matthias Gondan
Dear R developers, I want to draw an arrow in a figure with lty=2. The lty argument also affects the edge of the arrow, which is unfortunate. Feature or bug? Is there some way to draw an arrow with intact edge, still with lty=2? Example code: plot(1:10) arrows(4, 5, 6, 7, lty=2) Best wishes,

[R] image problem in 2.13.1

2011-07-13 Thread Matthias Gondan
Dear R people, On my freshly installed R-2.13.1 (winxp), the following code yields unsatisfactory results (irregular grid lines instead of a smooth plane): image(matrix(1, nrow=100, ncol=100)) This is working fine, image(matrix(1, nrow=100, ncol=100), useRaster=TRUE) but then right-click and

[R] random sequences for rnorm and runif

2011-02-03 Thread Matthias Gondan
0.8830174 Best wishes, Matthias Gondan -- GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit gratis Handy-Flat! http://portal.gmx.net/de/go/dsl __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] [OT] R on Atlas library

2010-08-11 Thread Matthias Gondan
On 06/08/10 15:12, Matthias Gondan wrote: Dear List, I am aware this is slightly off-topic, but I am sure there are people who already had the problem and who perhaps solved it. I am running long-lasting model fits using constrOptim command. At work there is a linux computer (Quad Core, debian

Re: [R] optimization subject to constraints

2010-08-10 Thread Matthias Gondan
try this (package Rsolnp) library(Rsolnp) g- function(x) { return(x[1]^2+x[2]^2) } # constraint f- function(x) { return(x[1]+x[2]) } # objective function x0 = c(1, 1) solnp(x0, fun=f, eqfun=g, eqB=c(1)) Am 10.08.2010 14:59, schrieb Gildas Mazo: Thanks, but I still cannot get to

Re: [R] optimization subject to constraints

2010-08-09 Thread Matthias Gondan
try command solnp in package Rsolnp Am 09.08.2010 18:56, schrieb Dwayne Blind: Hi ! Why not constrOptim ? Dwayne 2010/8/9 Gildas Mazogildas.m...@curie.fr Dear R users, I'm looking for tools to perform optimization subject to constraints, both linear and non-linear. I don't mind which

[R] [OT] R on Atlas library

2010-08-06 Thread Matthias Gondan
. Searching around the internet was not very encourageing. Some people wrote that it is not so simple to have Atlas fully exploit a multicore computer. I hope this is not too unspecific. Best wishes, Matthias -- Dr. rer. nat. Matthias Gondan Institut für Psychologie Universität Regensburg D-93050

Re: [R] Nonparametric generalization of ANOVA

2010-03-05 Thread Matthias Gondan
Brunner et al. available on his website http://www.ams.med.uni-goettingen.de/de/sof/ld/index.html But they seem not to be working with current R versions. Best regards, Matthias Gondan -- Sicherer, schneller und einfacher. Die aktuellen Internet-Browser - jetzt kostenlos herunterladen! http

[R] Accessing named elements of a vector

2010-02-25 Thread Matthias Gondan
Dear R developers, A great R feature is that elements of vectors, lists and dataframes can have names: vx = c(a=1, b=2) lx = list(a=1, b=2) Accessing element a of vx: vx['a'] Accessing element a of lx: lx[['a']] or lx$a Might be a matter of taste, but I like the $ very much. Unfortunately,

Re: [R] programming to calculate variance

2009-09-30 Thread Matthias Gondan
. Matthias Gondan Institut für Psychologie Universität Regensburg D-93050 Regensburg Tel. 0941-943-3856 Fax 0941-943-3233 Email: matthias.gon...@psychologie.uni-regensburg.de http://www.psychologie.uni-r.de/Greenlee/team/gondan/gondan.html __ R-help@r

[R] Test for stochastic dominance, non-inferiority test for distributions

2009-08-31 Thread Matthias Gondan
Dear R-Users, Is anyone aware of a significance test which allows demonstrating that one distribution dominates another? Let F(t) and G(t) be two distribution functions, the alternative hypothesis would be something like: F(t) = G(t), for all t null hypothesis: F(t) G(t), for some t. Best

[R] sscanf

2009-05-08 Thread Matthias Gondan
Dear list, Apparently, there is no function like sscanf in R. I have a string, Condition: 311, and I would like to read out the number and store it to a numeric variable. Is there an easy way to do this? Best wishes, Matthias -- __

[R] Statistical question: one-sample binomial test for clustered data

2008-11-25 Thread Matthias Gondan
Dear list, I hope the topic is of sufficient interest, because it is not R-related. I have N=100 yes/no-responses from a psychophysics paradigm (say Y Yes and 100-Y No-Responses). I want to see whether these yes-no-responses are in line with a model predicting a certain amount p of

[R] Small Bug in constrOptim documentation

2008-06-18 Thread Matthias Gondan
Dear list, I think there is a small bug in the constrOptim documentation (R-2.7.0): ## from optim fr - function(x) { ## Rosenbrock Banana function x1 - x[1] x2 - x[2] 100 * (x2 - x1 * x1)^2 + (1 - x1)^2 } grr - function(x) { ## Gradient of 'fr' x1 - x[1] x2 - x[2]

Re: [R] A stats question -- about survival analysis and censoring

2008-03-10 Thread Matthias Gondan
Hi Geoff, I think the answer to such a problem (overall survival vs. disease free survival) depends on the regulatory environment, for example, in a phase III clinical trial, OS would be used, whereas in an equivalence study, DFS would be used. Best, Matthias Geoff Russell schrieb: Dear

Re: [R] Kaplan Meier function

2008-02-14 Thread Matthias Gondan
Hi Eleni, hi list, here is small sample program, the library is survival, it is included in the standard R distribution. data(colon) s = survfit(Surv(time, status) ~ rx, data=colon) plot(s) plot(s, col=1:3) By the way: Does anyone know a neat way to indicate the number of patients under

[R] Package for sample size calculation

2008-02-13 Thread Matthias Gondan
Dear list, Is anyone aware of a library for sample size calculation in R, similar to NQuery? I have to give a course in this area, and I would like to enable the students playing around with this. Best wishes, Matthias __ R-help@r-project.org mailing

Re: [R] Cox model

2008-02-13 Thread Matthias Gondan
Hi Eleni, The problem of this approach is easily explained: Under the Null hypothesis, the P values of a significance test are random variables, uniformly distributed in the interval [0, 1]. It is easily seen that the lowest of these P values is not any 'better' than the highest of the P

Re: [R] Package for sample size calculation

2008-02-13 Thread Matthias Gondan
. On Feb 13, 2008 4:52 AM, Matthias Gondan [EMAIL PROTECTED] wrote: Dear list, Is anyone aware of a library for sample size calculation in R, similar to NQuery? I have to give a course in this area, and I would like to enable the students playing around with this. Best wishes

Re: [R] [OT?] Question on bootstrapping

2008-02-03 Thread Matthias Gondan
(little correction below) Dear list, This is off-topic, but perhaps there is an expert out there who can help me in a bootstrapping test. I have two samples A, B from, say, a normal distribution. A third sample R is the vector of pairwise minima of the same random variables: A =

[R] [OT?] Question on bootstrapping

2008-02-02 Thread Matthias Gondan
Dear list, This is off-topic, but perhaps there is an expert out there who can help me in a bootstrapping test. I have two samples A, B from, say, a normal distribution. A third sample R is the vector of pairwise minima of the same random variables: A = rnorm(100) B = rnorm(100) A2 =

Re: [R] Two-way non-parametric ANOVA?

2008-01-23 Thread Matthias Gondan
Hi Diana, Look at Edgar Brunner's Homepage http://www.ams.med.uni-goettingen.de/en/sta/e.brunner.html and here: http://www.ams.med.uni-goettingen.de/en/sof/index.html Unfortunately, the R script for a 2x2 design with two groups and two timepoints (f1.ld.f1.r) seems to be broken. Uncommenting

[R] Anova for stratified Cox regression

2008-01-15 Thread Matthias Gondan
Dear List, I have tried a stratified Cox Regression, it is working fine, except for the Anova-Tests: Here the commands (should work out of the box): library(survival) d = colon[colon$etype==2, ] m = coxph(Surv(time, status) ~ strata(sex) + rx, data=d) summary(m) # Printout ok anova(m,

[R] Problem in anova with coxph object

2008-01-08 Thread Matthias Gondan
Dear R users, I noticed a problem in the anova command when applied on a single coxph object if there are missing observations in the data: This example code was run on R-2.6.1: library(survival) data(colon) colondeath = colon[colon$etype==2, ] m = coxph(Surv(time, status) ~ rx + sex +

[R] Function arguments sometimes ignored

2007-11-08 Thread Matthias Gondan
lines. A bug in R? (Windows binary, 2.6.0) Best wishes, Matthias Gondan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented