[R] temporal autocorrelation in MCMCglmm

2015-03-30 Thread David Villegas Ríos
Hi, For a number of individuals, I have measured several behavioral traits in the wild. Those traits (e.g. home range) can be estimated on different temporal scales, for example daily, weekly or monthly. I want to estimate repeatability of those traits, assuming that the daily/weekly/monthly measur

[R] Timestamp of exported files not updated when the file name is overwritten (ggsave)

2015-03-19 Thread David Villegas Ríos
Hi. I have a script in which I export some plots to a folder in my PC. The plots are exported with the function ggsave (in ggplot2). Whenever I re-run the code and export updated plots, the name of the exported file is overwritten (as expected) but the timestamp is not updated what turns it very di

[R] Problem defining a grid in adehabitatHR (kernelUD)

2015-01-29 Thread David Villegas Ríos
Hi all, I'm trying to estimate a HR area for several individuals using kernelUD and kernel.area in adehabitatHR library. My code is: library(adehabitatHR) h=50 kud=kernelUD(detections[,1],h=h,grid=grid,extent=extent,kern=c("bivnorm")) area=kernel.area(kud,percent=95,unin ="m",unout="km2

[R] How to pass a nested random effect with frailty in coxph() - survival package?

2014-12-11 Thread David Villegas Ríos
Hi, I have a very simple Cox regression model in which I need to include a nested random effect: individual nested in treatment. I know how to pass a single random effect - e.g. frailty(id)- but how can I specify the nested random (id nested in treatment) effect using frailty? The equivalent in lme

[R] specifying a structural equation model with sem

2014-12-02 Thread David Villegas Ríos
Hi all, I'm new to sem package and sem analyses, so this is probably very basic, although I was not able to solve it myself reading some other similar posts. I was trying to specify a structural equation model using a correlation matrix of three variables. The correlation matrix comes from a mixed

[R] how to structure data to use a cengaussian/cenpoisson distribution in MCMCglmm

2014-10-28 Thread David Villegas Ríos
Hi. I was wondering how data has to be structured in the database to be able to run a mixed-model with the MCMCglmm funcion using censored family distributions, like "cengaussian" or "cenpoisson". I know my response variable should have two columns, but can anyone provide an example of this? In my

[R] how to predict scores after varimax rotation (using prcomp() and varimax())?

2014-10-20 Thread David Villegas Ríos
Hello. I ran a PCA analysis on a dataset with 5 variables and retained two components. I rotated them and now I want to predict the scores in a new data set for which the original variables are available. I normally use the predict.prcomp() function to predict using a prcomp object. For example..

[R] strange loadings matrix after varimax rotation: PCA with prcomp in R

2014-10-20 Thread David Villegas Ríos
Hello. I ran a PCA analysis on a dataset with 5 variables and retained two components. I rotated them and now I want to predict the scores in a new data set for which the original variables are available. I normally use the predict.prcomp() function to predict using a prcomp object. For example..