Re: [R] [R-sig-ME] Help with lmer

2011-06-26 Thread Iker Vaquero Alba

   I´m not an expert either, but from my own experience with those annoying 
messages, I can suggest you some precautions you should take:

   - First of all, make sure, in your ".txt" file, that you are using dots for 
separating decimals, NOT commas. 

   - Before writing your model, test each of the variables you are using (just 
type the name) and check that the software has not interpreted any covariate as 
a factor or viceversa.

   Hope that helps a bit. 

   Good luck.
   
   





De: Sophie Higgins 
Para: hugo.mildenber...@web.de; r-help@r-project.org; 
r-sig-mixed-mod...@r-project.org
Enviado: dom,26 junio, 2011 13:26
Asunto: Re: [R-sig-ME] [R] Help with lmer


Hello Hugo,
Thank you for your reply.  
This is a snap shot of what my data looks like:







  Presencebsence
  Habitatype
  Substratetype
  Width
  Banktype
  BankIncline
  Bankheight
  Waterdepth


  0
  Lake
  Rocksgravel
  600
  Earth
  0.45
  less1
  greater2


  0
  Lake
  Rocksgravel
  600
  Earth
  0.45
  less1
  greater2


  1
  Lake
  Rocksgravel
  600
  Earth
  0.45
  less1
  greater2


  0
  Lake
  Rocksgravel
  600
  Earth
  0.45
  less1
  greater2


  0
  Lake
  Rocksgravel
  600
  Earth
  0.45
  less1
  greater2


  0
  Stream
  Rocksgravel
  1
  Rocks
  0.45
  less1
  025to05


  0
  Stream
  Rocksgravel
  1
  Rocks
  0.45
  less1
  025to05


  0
  Stream
  Rocksgravel
  1
  Rocks
  0.45
  less1
  025to05


  0



  Stream
  Rocksgravel
  1
  Rocks
  0.45
  less1
  025to05


  









  







I am trying to find out if any off the above factors so substrate type, width, 
bank type etc have an effect on the presence/absence of the species in 
question.  But as stated below I keep getting an error message up and I have no 
idea how to fix it in order for me to fun the lmer.
Sophie 
> From: hugo.mildenber...@web.de
> To: r-help@r-project.org
> CC: england...@hotmail.com
> Subject: Re: [R] Help with lmer
> Date: Fri, 24 Jun 2011 17:19:00 +0200
> 
> Sophie,
> 
> I'm myself quite new to linear mixed effect models, but "PresenceAbsence"
>sounds like
> a binary response variable. So  wouldn't be
> 
>  m1<-lmer(Presencebsence~Habitatype*Width+(1|Sitename),familiy=binomial)
> 
> the first thing to try?  There is also a special mailing list for linear - 
>mixed -effect 
>
> models:
> 
>  r-sig-mixed-mod...@r-project.org
> 
> But with numeric problems like this one you really should provide a self
>contained 
>
> example (i.e. with data),  at least the output of str(yourdata), if ever
>possible. 
>
> 
> Kind regards
> 
> Hugo
> 
> On Friday 24 June 2011 13:11:23 Sophie Higgins wrote:
> > 
> > Hey,
> > I am having trouble with lmer.  I am looking at the presence/absence of 
> > water 
>shrews against habitat and other factors e.g
> > so I used this:
> > m1<-lmer(Presencebsence~Habitatype*Width+(1|Sitename))summary(m1)
> > But i keep getting this error up
> > Error in mer_finalize(ans) : Downdated X'X is not positive definite, 16.> 
>summary(m1)Error in asMethod(object) : matrix is not symmetric [1,2]
> > What does this mean and now can I fix it?
> > Sophie   
> > [[alternative HTML version deleted]]
> > 
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
 
[[alternative HTML version deleted]]

___
r-sig-mixed-mod...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Plot confidence intervals

2011-02-23 Thread Iker Vaquero Alba

   Hello, list:

   I'm not sure about where to send this question. I have several repeatability 
calculations, together with their 95% confidence intervals, and I would like to 
plot them, in a way similar to error bars. I was wondering if there is any 
specific function to do this, or any method I can apply in R, as I haven't 
found anything like that in the R book.

   Thank you very much

   Iker Vaquero-Alba
   Centre for Ecology and Conservation
   Daphne du Maurier Building
   University of Exeter, Cornwall Campus
   Treliever Road
   TR10 9EZ Penryn
   U.K.



  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] no slot of name "fixef" for this object of class "lmerMod"

2015-07-02 Thread Iker Vaquero Alba
   Hello everyone.
   I am trying to re-analyse some data with an R function I last used in 2011. 
Everything seemed to work fine then, but now, using the same code, it gives me 
this error:
   Error in R.pe(y, group1, group2, returnR = FALSE) : 
  no slot of name "fixef" for this object of class "lmerMod"
   This is the part of the function that I think is relevant for the problem:
   # preparation
    #n <- rowSums(y)
    N <- length(y)
    k <- length(unique(group1)) # clone
    g <- length(unique(group2)) # round
    #
    require(lme4)
    # functions
    R.pe <- function(y, group1, group2, returnR=TRUE) { 
     mod <- lmer(y ~ 1 + (1|group1)+(1|group2),verbose=FALSE) 
        VarComp  <- lme4::VarCorr(mod)
        beta0    <- as.numeric(mod@fixef)
        var.e <- attr(VarComp, "sc")^2 # residual variance
        var.a1 <- (as.numeric(VarComp[1])) # e.g. get clone R
        var.a2 <- (as.numeric(VarComp[2])) # e.g. get round R
            R.group1  <- var.a1/(var.a1+var.e) # clone level
  R.group2  <- var.a2/(var.a2+var.e)
  R.groupr  <- var.a1/(var.a1+var.e+var.a2)
        if(returnR) 
return(list(R.group1=R.group1,R.group2=R.group2,R.groupr=R.groupr))
        else return(list(beta0=beta0, var.e=var.e, var.a1=var.a1, 
var.a2=var.a2)) 
    }


   I would appreciate any help about this. Let me know if you need more code, 
the function is obviously longer.
   Thank you very much in advance.
   Iker
__________

   Dr. Iker Vaquero-Alba
    Daphne du Maurier
    Centre for Ecology and Conservation
    College of Life and Environmental Sciences
    University of Exeter, Cornwall Campus
    TR10 9FE 
    Penryn
    U.K.

    http://biosciences.exeter.ac.uk/cec/staff/postgradresearch/ikervaquero-alba/

    https://eric.exeter.ac.uk/repository/handle/10036/3381


[[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] no slot of name "fixef" for this object of class "lmerMod"

2015-07-03 Thread Iker Vaquero Alba

   Dear Thierry,
   Thank you very much. Do you mean I should add a line to the function with 
the code "fixef(my.model)", retaining everything else, even the "beta0    <- 
as.numeric(mod@fixef)" line? Or should I replace something?   Also, when you 
say "fixef(my.model), do you mean "fixef(mod)" (as in my case "mod <- lmer(y ~ 
1 + (1|group1)+(1|group2),verbose=FALSE)"?
   Thank you very much again.   Iker
 ______

   Dr. Iker Vaquero-Alba
    Daphne du Maurier
    Centre for Ecology and Conservation
    College of Life and Environmental Sciences
    University of Exeter, Cornwall Campus
    TR10 9FE 
    Penryn
    U.K.

    http://biosciences.exeter.ac.uk/cec/staff/postgradresearch/ikervaquero-alba/

    https://eric.exeter.ac.uk/repository/handle/10036/3381


  De: Thierry Onkelinx 
 Para: Iker Vaquero Alba  
CC: r-help@r-project.org 
 Enviado: Viernes 3 de julio de 2015 11:00
 Asunto: Re: [R] no slot of name "fixef" for this object of class "lmerMod"
   
Dear Iker,The internals of the mer model have changed. Use fixef(your.model). 
Best regards,​
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and 
Forest 
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance 
Kliniekstraat 25
1070 Anderlecht
BelgiumTo call in the statistician after the experiment is done may be no more 
than asking him to perform a post-mortem examination: he may be able to say 
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The 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 
TukeyOp 2 jul. 2015 22:17 schreef "Iker Vaquero Alba" :



   Hello everyone.
   I am trying to re-analyse some data with an R function I last used in 2011. 
Everything seemed to work fine then, but now, using the same code, it gives me 
this error:
   Error in R.pe(y, group1, group2, returnR = FALSE) :
  no slot of name "fixef" for this object of class "lmerMod"
   This is the part of the function that I think is relevant for the problem:
   # preparation
    #n <- rowSums(y)
    N <- length(y)
    k <- length(unique(group1)) # clone
    g <- length(unique(group2)) # round
    #
    require(lme4)
    # functions
    R.pe <- function(y, group1, group2, returnR=TRUE) {
     mod <- lmer(y ~ 1 + (1|group1)+(1|group2),verbose=FALSE)
        VarComp  <- lme4::VarCorr(mod)
        beta0    <- as.numeric(mod@fixef)
        var.e <- attr(VarComp, "sc")^2 # residual variance
        var.a1 <- (as.numeric(VarComp[1])) # e.g. get clone R
        var.a2 <- (as.numeric(VarComp[2])) # e.g. get round R
            R.group1  <- var.a1/(var.a1+var.e) # clone level
  R.group2  <- var.a2/(var.a2+var.e)
  R.groupr  <- var.a1/(var.a1+var.e+var.a2)
        if(returnR) 
return(list(R.group1=R.group1,R.group2=R.group2,R.groupr=R.groupr))
        else return(list(beta0=beta0, var.e=var.e, var.a1=var.a1, 
var.a2=var.a2))
    }


   I would appreciate any help about this. Let me know if you need more code, 
the function is obviously longer.
   Thank you very much in advance.
   Iker
__

   Dr. Iker Vaquero-Alba
    Daphne du Maurier
    Centre for Ecology and Conservation
    College of Life and Environmental Sciences
    University of Exeter, Cornwall Campus
    TR10 9FE
    Penryn
    U.K.

    http://biosciences.exeter.ac.uk/cec/staff/postgradresearch/ikervaquero-alba/

    https://eric.exeter.ac.uk/repository/handle/10036/3381


        [[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.


  
[[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] p-values in "rpt.adj"

2015-07-19 Thread Iker Vaquero Alba

   Hello everyone,   My question is about the "rptR" package. I am using the 
rpt.adj function (for adjusted repeatability). 
   My model is as follows:

   rpt.adj(brifield ~ 1 + 
(1|ring)+(1|year),"ring",data=bellyfield,datatype="Gaussian")
   where "brifield" is the measurement for which I want to obtain repeatability 
and "ring" is the individual ID (there are 3 different measurements per ID – 
per ring number). 

   What I want is an adjusted repeatability estimate that includes the 
year-to-year variance. Reading how to use the function, it says: 
grnameA character string or vector of character strings giving the name(s) of 
the grouping factor(s), for which the repeatability should be estimated. 
Spelling needs to match the random effect names as given in formula. 
   So my grouping factor is "ring". Is that right? That would be my first 
question (just reassuring).
   And the second one is about the results:   
   R  = 0.591
   SE = 0.148
   CI = [0.27, 0.808]
   P  = 1.06e-22 []
          0.001 []
   It's basically about the p-values (as it gives me 2). Which one is which? 
The upper one is the p-value due to grouping factor "ring" (or ID) and the 
bottom one is the one of grouping factor "year"? Which one should I report, 
according to what I am interested in?
   Thank you very much in advance.
   Iker
 ______

   Dr. Iker Vaquero-Alba
    Daphne du Maurier
    Centre for Ecology and Conservation
    College of Life and Environmental Sciences
    University of Exeter, Cornwall Campus
    TR10 9FE 
    Penryn
    U.K.

    http://biosciences.exeter.ac.uk/cec/staff/postgradresearch/ikervaquero-alba/

    https://eric.exeter.ac.uk/repository/handle/10036/3381


[[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] Potencial bug in R.adjust ("holm" method)

2015-08-06 Thread Iker Vaquero Alba
   Hello all,
   I am doing some Bonferroni correction analyses with R.adjust function. I 
have a spreadsheet with 24 columns, each with 5 values. When I use the "holm" 
method, it gives me adjusted figures for all the original values except from 
the ones in the 4th row of each column. I mean, the value on the 4th row for 
every column is exactly the same either in the original data or in the 
corrected one.   I've tried using another algorithm just to see what happens 
("bonferroni", for example) and everything is fine, I get corrected figures for 
all the values, even the ones on the 4th row.

   Does anyone know whether this is any kind of known bug of the "holm" 
algorithm of P.adjust function. If so, should I worry about it? If so, can 
anybody suggest any possible solution?
   Thank you very much.
   Iker


______

   Dr. Iker Vaquero-Alba
   Visiting Postdoctoral Research Associate
   Laboratory of Evolutionary Ecology of Adaptations, 
   School of Life Sciences, University of Lincoln,    Riseholme Park Campus, 
Lincoln
   LN2 2LG,
   UK.

   https://eric.exeter.ac.uk/repository/handle/10036/3381


[[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] Potencial bug in R.adjust ("holm" method)

2015-08-07 Thread Iker Vaquero Alba


   Hello, Peter, and thank you for your clarifying reply. Actually, that was 
another doubt I had. As I take my data from different files (every "bunch of 5" 
values is taken from a different file), I assumed that, if I wanted to adjust 
for the error due to repeated measures, it should be enough to do it inside 
each file, right? I mean, the possible error due to repeated measures shouldn't 
go beyond each file. Once you close one file, open and attach a new one, the 
count, let's say, starts from scratch. 
Am I right? And if I'm not, what is the reason why should I pool all the 
p-values in a massive column and adjust them in bulk?
   Thank you very much for your help.   Iker 
__________

   Dr. Iker Vaquero-Alba
   Visiting Postdoctoral Research Associate
   Laboratory of Evolutionary Ecology of Adaptations, 
   School of Life Sciences, University of Lincoln,    Riseholme Park Campus, 
Lincoln
   LN2 2LG,
   UK.

   https://eric.exeter.ac.uk/repository/handle/10036/3381


  De: peter dalgaard 

CC: "r-help@r-project.org"  
 Enviado: Viernes 7 de agosto de 2015 14:40
 Asunto: Re: [R] Potencial bug in R.adjust ("holm" method)
   



>    Hello all,
>    I am doing some Bonferroni correction analyses with R.adjust function. I 
>have a spreadsheet with 24 columns, each with 5 values. When I use the "holm" 
>method, it gives me adjusted figures for all the original values except from 
>the ones in the 4th row of each column. I mean, the value on the 4th row for 
>every column is exactly the same either in the original data or in the 
>corrected one.  I've tried using another algorithm just to see what happens 
>("bonferroni", for example) and everything is fine, I get corrected figures 
>for all the values, even the ones on the 4th row.
> 
>    Does anyone know whether this is any kind of known bug of the "holm" 
>algorithm of P.adjust function. If so, should I worry about it? If so, can 
>anybody suggest any possible solution?
>    Thank you very much.
>    Iker

p.adjust(), I presume?

The Holm procedure is essentially to sort p-values in decreasing order and 
mutiplying by 1:n plus a little fiddling to keep the order and prevent p > 1. 
The logic is that if you reject the hypothesis corresponding to the smallest p 
after Bonferroni-correction by N, you only have N-1 simultaneous tests to 
consider, etc. The smallest multiplier will be 1, so it's not strange that one 
value appears uncorrected. It's curious that it is always in the 4th row, but 
it might be that the p-values in the 4 other rows are all considerably smaller.

You do realize that if you run p.adjust for each column, you are not actually 
adjusting for the total of 120 tests, only for 5 of them, effectively ignoring 
the 23 other columns every time?

-pd



> 
> 
> __
> 
>    Dr. Iker Vaquero-Alba
>    Visiting Postdoctoral Research Associate
>    Laboratory of Evolutionary Ecology of Adaptations, 
>    School of Life Sciences, University of Lincoln,    Riseholme Park Campus, 
>Lincoln
>    LN2 2LG,
>    UK.
> 
>    https://eric.exeter.ac.uk/repository/handle/10036/3381
> 
> 
>     [[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










  
[[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] Multinomial data

2015-09-14 Thread Iker Vaquero Alba

   Hello everyone,
   I have some data I would like to analyse where my response variables are 
categorical data: several participants were asked to give answers in the form 
of 1 to 5 (for the degree of importance given to certain items). So, what I 
have now is response variables that can just take 5 possible values: 1, 2, 3, 4 
or 5. 
   After a bit of research, I have learned this might be a case of multinomial 
categorical data, although I am not sure whether ordered multinomial or nominal 
multinomial. I would like to apply generalized linear mixed models to my 
response variables, but I am a bit lost at the moment. Should I just use lmer 
and change the link function? Is it better to try MCMCglmm package and start 
from there?

   Any slight guidance or light shed on this would be greatly appreciated. 

   Thanks a lot!
 __

   Dr. Iker Vaquero-Alba
   Visiting Postdoctoral Research Associate
   Laboratory of Evolutionary Ecology of Adaptations 
   School of Life Sciences
   Joseph Banks Laboratories
   University of Lincoln   Brayford Campus, Lincoln
   LN6 7DL
   United Kingdom

   https://eric.exeter.ac.uk/repository/handle/10036/3381


[[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] Factor response and explanatory variables.

2015-09-17 Thread Iker Vaquero Alba

   Hello everyone,
   I am going to ask this certainly tricky question here not (yet) with the 
intention of getting a definitive answer, as I need to deepen my questions much 
more, but just to have an approximate idea of which direction taking next. 
   I have a dataset where the potential response variables are categorical 
multinomial (ordered, I think): several people were asked to give a value from 
1 to 5 to several attributes in a potential partner, both for a short term 
commitment or for a longer relationship. The age, religion, sexual orientation, 
sexual identity (gender), self-perceived sexual attractivess and minimum 
attractiveness demanded in a potential partner (this ones also with values 1 to 
5) were recorded for each participant.   The idea is using the values given to 
attributes in potential partners as the response variable, and see to what 
extent these are influenced by the person's age, gender, religion and so on. 
   The problem is that all my variables are factors, I have no numeric ones. 
Also, as the values given to the same attributes for a short term commitment of 
for a longer relationship are expected to be correlated, I was considering 
using multiple response variables, which adds even more difficulty to the model.
   I have been reading about MCMCglmm, the course notes, which are not easy to 
understand. In any case, at some point I have read that if I don't want to fit 
random effects (as I think it's my case), I'd better use the pscl package 
instead.

   Can you give me any advice at this point? Should I try and use pscl, or is 
it better to try with MCMCglmm given the difficulty of the model? Any little 
help will be highly appreciated. 

   Thank you very much
   Iker.

______

   Dr. Iker Vaquero-Alba
   Visiting Postdoctoral Research Associate
   Laboratory of Evolutionary Ecology of Adaptations 
   School of Life Sciences
   Joseph Banks Laboratories
   University of Lincoln   Brayford Campus, Lincoln
   LN6 7DL
   United Kingdom

   https://eric.exeter.ac.uk/repository/handle/10036/3381


[[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.