Re: [R] Need a vectorized way to avoid two nested FOR loops

2009-10-08 Thread joris meys
Neat piece of code, Jim, but it still uses a nested loop. If you order the matrix first, you only need one passage through the whole matrix to find the information you need. Off course I don't take into account the ordering. If the ordering algorithm doesn't work in linear time, then it doesn't re

Re: [R] I can not install DAAG package . help

2009-10-08 Thread joris meys
Quite a strange error. The function installed.packages should be in the utils package. Try ?installed.packages and see if you get a help file. If it doesn't find that function, there is a problem with your R installation. It might be something went wrong with downloading the package itself. DAAG i

Re: [R] foreach loop - rejection method

2009-10-08 Thread joris meys
First, you should define your function as : test <- function(cand2,phi,lambda, whatever-arguments-you-want-to-use-further){... insert code here ...} All variables you use inside a function only exist within that function. Your parameters/arguments is the interface between the function and the outs

Re: [R] Plot

2009-10-06 Thread joris meys
Actually, it's a bit more complex than just plot(). First you have to make Days an ordered factor, otherwise you get indeed that error. days <- c("Mon", "Tue", "Wed", "Thu", "Fri", "Sat","Sun") Days <- factor(days,levels=days,ordered=T) Then you want to make a plot with 2 axes, you should check :

Re: [R] Unable to load 'doBy' package

2009-10-06 Thread joris meys
Hi Lauren, from the error message it looks like you have a problem with the package "Hmisc". doBy is dependent on that one. Can you check whether Hmisc is installed in your R version? For me, doBy loads without problems. On Tue, Oct 6, 2009 at 12:18 PM, Lauren Szathmary wrote: > Hi all, > > I am

[R] Extracting year from a date object

2009-10-06 Thread joris meys
Hi all, this one left me a bit puzzled, as I don't seem to find a function to perform this easily. I must have overlooked the obvious, so sorry in advance. I have a list of dates in numerical format (i.e. 34576), defined as the number of days that passed since january 1st 1900. So I apply the fun

Re: [R] confint fails in quasibinomial glm: dims do not match

2009-10-02 Thread joris meys
Confint doesn't work if you have a multi-dimensional dependent variable. Kind regards Joris On Fri, Oct 2, 2009 at 4:29 AM, smith_cc wrote: > > I am unable to calculate confidence intervals for the slope estimate in a > quasibinomial glm using confint(). Below is the output and the package info

Re: [R] GAM question

2009-10-01 Thread joris meys
Hi Daniel, I presume you mean coefficients by values. Try ?gamObject and read the info in the help file. A GAM object (returned by the function gam() ) contains an element coefficients that is easily accessible. That one contains all estimated coefficients, including those for the smooth functions

Re: [R] Missing functions

2009-10-01 Thread joris meys
r: package 'psych' does not have a name space > > is there a way to clean up and reinstall the packages? > > thanks, > Kenny > > On Thu, Oct 1, 2009 at 4:02 PM, joris meys wrote: >> >> Hi, >> >> It installed perfectly for me, both packages

Re: [R] Minimum and blanks

2009-10-01 Thread joris meys
The minimum of a character vector is returned according to the unicode or ascii code values, but I guess that's not what Chris is looking for. Chris, please always try to provide a minimal working example of code to see what is wrong. Something goes wrong with the input in your example. As Peter

Re: [R] Overview of error and warning messages for teaching + examples

2009-10-01 Thread joris meys
Hi Ben, other members of the list also pointed me to this possibility. I'll certainly add the manual. Kind regards Joris On Thu, Oct 1, 2009 at 4:14 AM, Ben Bolker wrote: > Tal Galili gmail.com> writes: > >> >> Hi Joris, >> >> Good luck with your work. >> >> I know how to set up a wiki. But I w

Re: [R] Overview of error and warning messages for teaching + examples

2009-09-30 Thread joris meys
ne number: 972-52-7275845 > FaceBook: Tal Galili > My Blogs: > http://www.talgalili.com (Web and general, Hebrew) > http://www.biostatistics.co.il (Statistics, Hebrew) > http://www.r-statistics.com/ (Statistics,R, English) > > > > > On Wed, Sep 30, 2009 at 2:50 PM, jor

[R] Overview of error and warning messages for teaching + examples

2009-09-30 Thread joris meys
n R. Off course this mailing list is an extensive source of all kind or errors and examples, but I was wondering if there is a somewhat more structured overview. All help appreciated. Kind regards Joris Meys __ R-help@r-project.org mailing list https

Re: [R] Hopefully a simple question

2009-03-25 Thread joris meys
Dear Jacy, As Jorge said. To clarify : what you ask, is actually to compare the first element of genotype with the first element of FREQ, the second of genotype with the second of FREQ and so on. If the lengths differ, the shorter vector is recycled. This toy example illustrates that principle :

Re: [R] modelling probabilities instead of binary data with logisticregression

2009-03-25 Thread joris meys
e plural of anecdote is not data. > ~ Roger Brinner > > The combination of some data and an aching desire for an answer does not > ensure that a reasonable answer can be extracted from a given body of > data. > ~ John Tukey > > -Oorspronkelijk bericht- > Van: r-help-bou

Re: [R] modelling probabilities instead of binary data with logistic regression

2009-03-24 Thread joris meys
t; More seriously, you could transform the proportions to logits > logit <- log(p/(1-p)) > and fit a linear regression. > > Kjetil > > On Tue, Mar 24, 2009 at 3:30 PM, joris meys wrote: > >> Dear all, >> >> I have a dataset where I reduced the dimensionality, a

[R] modelling probabilities instead of binary data with logistic regression

2009-03-24 Thread joris meys
Dear all, I have a dataset where I reduced the dimensionality, and now I have a response variable with probabilities/proportions between 0 and 1. I wanted to do a logistic regression on those, but the function glm refuses to do that with non-integer values in the response. I also tried lrm, but th

Re: [R] Describing clusters

2009-03-18 Thread joris meys
Just a side remark : "any" clustering method in R is pretty broad. Actually, k-means clustering is a completely different animal than distance-based neighbour-joining methods. You should be a bit more specific about your research I wouldn't worry too much about the scientific practice, as cluster

[R] Likelihood of a ridge regression (lm.ridge)?

2009-03-17 Thread joris meys
Dear all, I want to get the likelihood (or AIC or BIC) of a ridge regression model using lm.ridge from the MASS library. Yet, I can't really find it. As lm.ridge does not return a standard fit object, it doesn't work with functions like e.g. BIC (nlme package). Is there a way around it? I would ca

[R] Sparse PCA in R

2009-03-10 Thread joris meys
Dear all, I would like to perform a sparse PCA, but I didn't find any library offering me this in R. Is there one available, or do I have to write the functions myself? Kind regards Joris Meys [[alternative HTML version deleted]] __ R-h

Re: [R] Interaction term not significant when using glm???

2009-03-08 Thread joris meys
d Harding wrote: > On 07-Mar-09 10:57:17, Thomas Lumley wrote: > > On Fri, 6 Mar 2009, joris meys wrote: > >> Dear all, > >> I have a dataset where the interaction is more than obvious, > >> but I was asked to give a p-value, so I ran a logistic regression > &g

Re: [R] Interpreting GLM coefficients

2009-03-06 Thread joris meys
One thing I notice immediately is a number of NA values for your coefficients. If I were you, I would try a model with less parameters, and use the anova() function to compare models, to see if the extra terms really improve the model. e.g. fit1 <- glm(Y~X1+X2+X3,...) fit2 <- glm(Y~X1+X2+X3+X1:X2,.

[R] Interaction term not significant when using glm???

2009-03-06 Thread joris meys
Dear all, I have a dataset where the interaction is more than obvious, but I was asked to give a p-value, so I ran a logistic regression using glm. Very funny, in the outcome the interaction term is NOT significant, although that's completely counterintuitive. There are 3 variables : spot (binary

Re: [R] Ask about glm()

2009-03-06 Thread joris meys
On 3/6/09, kenji_aoyagi wrote: > > Hi, > > I am using glm(). > I'd like to know what the command means. > > For example, > glm(family=binomial(link=logit)) > means logit model. Means : binomial response variable transformed with the logit Then, > glm(family=gaussian(link=logit)), > does this me

Re: [R] Bug in predict function for naiveBayes?

2009-02-26 Thread joris meys
tion? It's contained in the package e1071. Thank you in advance On Thu, Feb 19, 2009 at 2:16 PM, joris meys wrote: > Dear all, > > I tried a simple naive Bayes classification on an artificial dataset, but I > have troubles getting the predict function to work with the type=&qu

[R] Bug in predict function for naiveBayes?

2009-02-19 Thread joris meys
type="class") Tried it also with pred.bayes <-predict(Bayes.res, mixture.test,type="class"), but that gives the same effect. Is this a bug or am I missing something? Kind regards Joris Meys University Ghent [[alternative HTML version deleted]] ___

Re: [R] Obtaining p-values for coefficients from LRM function (package Design) - plaintext

2008-12-13 Thread joris meys
To clarify : I am aware of the interpretation problems. Thank you for the tip! (it's getting late here...) On Sat, Dec 13, 2008 at 9:56 PM, joris meys wrote: > Thanks for the answers. > > @David : I am aware of that, but this is far from the last model actually. > > @ Fran

Re: [R] Obtaining p-values for coefficients from LRM function (package Design) - plaintext

2008-12-13 Thread joris meys
I missing something? Kind regards Joris On Sat, Dec 13, 2008 at 8:44 PM, David Winsemius wrote: > > On Dec 13, 2008, at 1:12 PM, joris meys wrote: > >> Sent this mail in rich text format before. Excuse me for this. >> >> >> Dear all, >&g

[R] Obtaining p-values for coefficients from LRM function (package Design) - plaintext

2008-12-13 Thread joris meys
Sent this mail in rich text format before. Excuse me for this. Dear all, I'm using the lrm function from the package "Design", and I want to extract the p-values from the results of that function. Given an lrm object constructed as follows : fit <- lrm(Y~(X1+X2+X3+X4+X5+

[R] Obtaining p-values for coefficients from LRM function (package Design)

2008-12-13 Thread joris meys
Dear all, I'm using the lrm function from the package "Design", and I want to extract the p-values from the results of that function. Given an lrm object constructed as follows : fit <- lrm(Y~(X1+X2+X3+X4+X5+X6+X7)^2, data=dataset) I need the p-values for the coefficients printed by calling "fit

Re: [R] Regex: workaround for variable length negative lookbehind

2008-12-01 Thread joris meys
On Sun, Nov 30, 2008 at 9:59 PM, Stefan Evert <[EMAIL PROTECTED]> wrote: > Still, I think it's better to write a few lines of R code than to abuse > regular expressions to do something they were never intended to do. How do > other people on this list feel about that issue? > Honestly, I believe

Re: [R] glm or transformation of the response?

2008-11-25 Thread joris meys
I reread the question, and I don't actually see the problem too much. If you plot the transformed dataset from most of your models, the problem is quite obvious : if you transform your predictor to the logscale, the result of a a linear regression on those outcomes will be naturally an exponential

Re: [R] glm or transformation of the response?

2008-11-25 Thread joris meys
I'm not sure on what kind of dataset would be most appropriate, but following code I used to create a dataset with a linear response and an increasing variance (the megaphone type, common in ecological datasets if I'm right) : beta0 <- 10 beta1 <- 1 x <- c(1:40) y <- beta0 + x*beta1 +rnorm(40,0,1

Re: [R] random value changes in a vector

2008-11-18 Thread joris meys
Just for clarification : this is an extension, where you can take the probability of switching to any possible value. Take into account that the p-value in the function rbinom is 1-P for the switching of the sign. On Tue, Nov 18, 2008 at 11:21 PM, joris meys <[EMAIL PROTECTED]> wrote:

Re: [R] random value changes in a vector

2008-11-18 Thread joris meys
The function rbinom might be a solution. Try following simple program : vec <- c(-1,1,-1,1,1,-1,-1,1,1) inv <-rbinom(length(vec),1,0.5) inv <-ifelse(inv==0,-1,1) vec2 <- vec*inv #switches sign with p=0.5 In this, inv is a random binomial vector, where the probability for being 1 is 0.5 in all

Re: [R] readPDF() -- unsure how to install xpdf to make this work?

2008-11-16 Thread joris meys
m\;C:\Program Files\xpdf\ > > Still didn't work i'm afraid, but cheers for the sugestion. > > Tony Breyal > > > On 16 Nov, 20:00, "joris meys" <[EMAIL PROTECTED]> wrote: >> Try putting "PATH" under name, and the directory path (not the fil

Re: [R] readPDF() -- unsure how to install xpdf to make this work?

2008-11-16 Thread joris meys
Try putting "PATH" under name, and the directory path (not the file) under value. That looks more appropriate to me... Kind regards Joris Meys On Sun, Nov 16, 2008 at 8:41 PM, Tony Breyal <[EMAIL PROTECTED]> wrote: > Hi, > > Uwe -- ahh, thank you kindly, I was able

Re: [R] help with doing a manipulation on a column of a data frame based on another column

2008-10-29 Thread joris meys
> #this is my stab at - I am sure that I am missing something. If this > doesn't make sense then please ask for more details. #This may show > my low level of programing knowledge > > hester. <- c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4) > value <- rnorm(16) > x <- data.frame(value, hester.) > > z <- > (

<    1   2   3   4   5