Re: [R] gamm design matrices
Hi Simon, Sorry, I spoke too soon. I now have the basic spline code working but with `by' variables I get an error in smoothCon: Error in ExtractData(object, data, knots) : 'names' attribute [1] must be the same length as the vector [0] and a segfault with smooth.construct (see example code below). I think it is something to do with by.done, but although by.done is mentioned as an item/object/attribute in the details section of ?smoothCon and the value section of ?smooth.construct, there seems to be no additional documentation so I'm not sure what by.done is or should be. Any help would be gratefully received. Cheers, Jarrod nt<-10 nid<-100 X<-matrix(rnorm(nt*nid),nid,nt) beta<-sin(1:nt) y<-X%*%beta+rnorm(nid) index<-matrix(rep(1:nt,each=nid),nid, nt) dat<-data.frame(y=y, X=X, index=index) smooth.spec.object<-interpret.gam(~s(index,k=10,by=X))$smooth.spec[[1]] sm<-smoothCon(smooth.spec.object,data=dat, knots=NULL,absorb.cons=TRUE) Error in ExtractData(object, data, knots) : 'names' attribute [1] must be the same length as the vector [0] sm<-smooth.construct(smooth.spec.object,data=dat, knots=NULL) *** caught segfault *** Quoting Simon Wood on Mon, 03 Mar 2014 13:35:04 +: Dear Jarrod, I've only managed to have a very quick look at this, but I wonder if the difference is to do with identifiability constraints? It looks to me as if your smooth.construct call does not have sum to zero constraints applied to the smooth, but by default 'gamm' will impose these (even when the model has only one smooth). 'gamm' then includes an explicit intercept term, which would explain why the model matrix dimensions still look ok. If you mimic gamm by calling smoothCon rather than smooth.construct and asking for constraints to be absorbed, and then add the model matrix column for the intercept back in, then it should be possible to get the model matrices to match. best, Simon On 02/03/14 17:16, Jarrod Hadfield wrote: Hi All, I would like to fit a varying coefficient model using MCMCglmm. To do this it is possible to reparameterise the smooth terms as a mixed model as Simon Wood neatly explains in his book. Given the original design matrix W and penalisation matrix S, I would like to find the fixed (X) and random (Z) design matrices for the mixed model parameteristaion. X are the columns of W for which S has zero eigenvalues and Z is the random effect design matrix for which ZZ' = W*S*^{-1}W* where W* is W with the fixed effect columns dropped and S* is S with the fixed effect row/columns dropped. Having e as the eigenvlaues of S* and L the associated eigenvectors then Z can be formed as W*LE^{-1} where E = Diag(sqrt(e)). However, obtaining W and S from mgcv's smooth.construct and applying the above logic I can recover the X but not the Z that gamm is passing to nlme. I have posted an example below. I have dredged the mgcv code but to no avail to see why I get differences. I want to fit the model to ordinal data, and I also have a correlated random effect structure (through a pedigree) hence the need to use MCMCglmm. Any help would be greatly appreciated. Cheers, Jarrod library(mgcv) x<-rnorm(100) y<-sin(x)+rnorm(100) dat<-data.frame(y=y,x=x) # generate some data smooth.spec.object<-interpret.gam(y~s(x,k=10))$smooth.spec[[1]] sm<-smooth.construct(smooth.spec.object,data=dat, knots=NULL) # get penalty matrix S = sm$S[[1]] and original design matrix W=sm$X Sed<-eigen(sm$S[[1]]) Su<-Sed$vectors Sd<-Sed$values nonzeros <- which(Sd > sqrt(.Machine$double.eps)) Xn<-sm$X[,-nonzeros] Zn<-sm$X%*%Su[,nonzeros]%*%diag(1/sqrt(Sd[nonzeros])) # form X and Z m2.lme<-gamm(y~s(x,k=10), data=dat) Xo<-m2.lme$lme$data$X Zo<-m2.lme$lme$data$Xr # fit gamm and extract X and Z used by lme plot(Xo,Xn) # OK plot(Zo,Zn) # not OK -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw283 -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. __ 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.
Re: [R] gamm design matrices
Hi Simon, That's perfect - the matrices now agree. Thanks, Jarrod Quoting Simon Wood on Mon, 03 Mar 2014 13:35:04 +: Dear Jarrod, I've only managed to have a very quick look at this, but I wonder if the difference is to do with identifiability constraints? It looks to me as if your smooth.construct call does not have sum to zero constraints applied to the smooth, but by default 'gamm' will impose these (even when the model has only one smooth). 'gamm' then includes an explicit intercept term, which would explain why the model matrix dimensions still look ok. If you mimic gamm by calling smoothCon rather than smooth.construct and asking for constraints to be absorbed, and then add the model matrix column for the intercept back in, then it should be possible to get the model matrices to match. best, Simon On 02/03/14 17:16, Jarrod Hadfield wrote: Hi All, I would like to fit a varying coefficient model using MCMCglmm. To do this it is possible to reparameterise the smooth terms as a mixed model as Simon Wood neatly explains in his book. Given the original design matrix W and penalisation matrix S, I would like to find the fixed (X) and random (Z) design matrices for the mixed model parameteristaion. X are the columns of W for which S has zero eigenvalues and Z is the random effect design matrix for which ZZ' = W*S*^{-1}W* where W* is W with the fixed effect columns dropped and S* is S with the fixed effect row/columns dropped. Having e as the eigenvlaues of S* and L the associated eigenvectors then Z can be formed as W*LE^{-1} where E = Diag(sqrt(e)). However, obtaining W and S from mgcv's smooth.construct and applying the above logic I can recover the X but not the Z that gamm is passing to nlme. I have posted an example below. I have dredged the mgcv code but to no avail to see why I get differences. I want to fit the model to ordinal data, and I also have a correlated random effect structure (through a pedigree) hence the need to use MCMCglmm. Any help would be greatly appreciated. Cheers, Jarrod library(mgcv) x<-rnorm(100) y<-sin(x)+rnorm(100) dat<-data.frame(y=y,x=x) # generate some data smooth.spec.object<-interpret.gam(y~s(x,k=10))$smooth.spec[[1]] sm<-smooth.construct(smooth.spec.object,data=dat, knots=NULL) # get penalty matrix S = sm$S[[1]] and original design matrix W=sm$X Sed<-eigen(sm$S[[1]]) Su<-Sed$vectors Sd<-Sed$values nonzeros <- which(Sd > sqrt(.Machine$double.eps)) Xn<-sm$X[,-nonzeros] Zn<-sm$X%*%Su[,nonzeros]%*%diag(1/sqrt(Sd[nonzeros])) # form X and Z m2.lme<-gamm(y~s(x,k=10), data=dat) Xo<-m2.lme$lme$data$X Zo<-m2.lme$lme$data$Xr # fit gamm and extract X and Z used by lme plot(Xo,Xn) # OK plot(Zo,Zn) # not OK -- Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw283 -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. __ 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] gamm design matrices
Hi All, I would like to fit a varying coefficient model using MCMCglmm. To do this it is possible to reparameterise the smooth terms as a mixed model as Simon Wood neatly explains in his book. Given the original design matrix W and penalisation matrix S, I would like to find the fixed (X) and random (Z) design matrices for the mixed model parameteristaion. X are the columns of W for which S has zero eigenvalues and Z is the random effect design matrix for which ZZ' = W*S*^{-1}W* where W* is W with the fixed effect columns dropped and S* is S with the fixed effect row/columns dropped. Having e as the eigenvlaues of S* and L the associated eigenvectors then Z can be formed as W*LE^{-1} where E = Diag(sqrt(e)). However, obtaining W and S from mgcv's smooth.construct and applying the above logic I can recover the X but not the Z that gamm is passing to nlme. I have posted an example below. I have dredged the mgcv code but to no avail to see why I get differences. I want to fit the model to ordinal data, and I also have a correlated random effect structure (through a pedigree) hence the need to use MCMCglmm. Any help would be greatly appreciated. Cheers, Jarrod library(mgcv) x<-rnorm(100) y<-sin(x)+rnorm(100) dat<-data.frame(y=y,x=x) # generate some data smooth.spec.object<-interpret.gam(y~s(x,k=10))$smooth.spec[[1]] sm<-smooth.construct(smooth.spec.object,data=dat, knots=NULL) # get penalty matrix S = sm$S[[1]] and original design matrix W=sm$X Sed<-eigen(sm$S[[1]]) Su<-Sed$vectors Sd<-Sed$values nonzeros <- which(Sd > sqrt(.Machine$double.eps)) Xn<-sm$X[,-nonzeros] Zn<-sm$X%*%Su[,nonzeros]%*%diag(1/sqrt(Sd[nonzeros])) # form X and Z m2.lme<-gamm(y~s(x,k=10), data=dat) Xo<-m2.lme$lme$data$X Zo<-m2.lme$lme$data$Xr # fit gamm and extract X and Z used by lme plot(Xo,Xn) # OK plot(Zo,Zn) # not OK -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. __ 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.
Re: [R] Swaeve, Beamer and \alt
Hi, Unfortunately not, nor \begin{frame}[fragile], which does work with the uncover environment. Cheers, Jarrod Quoting Uwe Ligges on Sat, 09 Feb 2013 18:45:39 +0100: On 09.02.2013 17:00, Jarrod Hadfield wrote: Hi, I am having trouble getting \alt (or \altenv) to work with Schunk/Sinput and was wondering if anybody had had success? With the slide \begin{frame}[fragile]\frametitle{Basic R} \alt<2>{ <>= 2+2 @ }{ <>= 2+2 @ } \end{frame} I get the error message: ! FancyVerb Error: Extraneous input `> 2+2 \end {Sinput} \end {Schunk} ' between \begin{Sinput}[ ] and line end . \FV@Error ... {FancyVerb Error: \space \space #1 } which cannot be fixed using the fragile or containsverbatim options for the frame. Thanks for any help, Jarrod Untested: Does \begin{frame}[containsverbatim] help? Best, Uwe Ligges -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. __ 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] Swaeve, Beamer and \alt
Hi, I am having trouble getting \alt (or \altenv) to work with Schunk/Sinput and was wondering if anybody had had success? With the slide \begin{frame}[fragile]\frametitle{Basic R} \alt<2>{ <>= 2+2 @ }{ <>= 2+2 @ } \end{frame} I get the error message: ! FancyVerb Error: Extraneous input `> 2+2 \end {Sinput} \end {Schunk} ' between \begin{Sinput}[ ] and line end . \FV@Error ... {FancyVerb Error: \space \space #1 } which cannot be fixed using the fragile or containsverbatim options for the frame. Thanks for any help, Jarrod -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. __ 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.
Re: [R] [R-sig-ME] Question on overdispersion
Hi Thierry + nameless, It is not necessary to expand the binomial into Bernoulli trials (nor advisable if n and/or the binomial size are large). You can just fit observation-level random effects: dataset$resid<-as.factor(1:dim(dataset)[1]) fit3 <- glmer(cbind(male_chick_no, female_chick_no) ~ 1+(1|FemaleID)+ (1|resid), data = dataset, family = binomial) gives the same answer as fit2 Cheers, Jarrod Quoting "ONKELINX, Thierry" : Dear Nameless, The quasi distribution can no longer be used in lme4 because a) the results were not very reliable b) there is an alternative to model overdispersion. The alternative is to expand your dataset to bernoulli trials. Then add a random effect with one level per observation. This random effect will model additive overdisperion. The quasi distributions model overdisperion multiplicative. In the example below, the random effect of RowID has 0 variance. Hence no overdispersion. dataset <- data.frame( male_chick_no = c(2,4,1,0,3,5,2), female_chick_no=c(1,0,3,3,1,0,2), FemaleID=c("A","A","B","B","C","D","E")) longFormat <- do.call(rbind, lapply(seq_len(nrow(dataset)), function(i){ with(dataset, data.frame(Sex = c(rep("M", male_chick_no[i]), rep("F", female_chick_no[i])), FemaleID = FemaleID[i])) })) longFormat$FemaleID <- factor(longFormat$FemaleID) longFormat$RowID <- factor(seq_len(nrow(longFormat))) longFormat$Male <- longFormat$Sex == "M" library(lme4) fit1 <- glmer(Male ~ (1|FemaleID), data = longFormat, family = binomial) fit2 <- glmer(Male ~ (1|FemaleID) + (1|RowID), data = longFormat, family = binomial) anova(fit1, fit2) Best regards, Thierry PS sig-mixed-models is a better mailinglist for this kind of questions. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Forest team Biometrics & Quality Assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 thierry.onkel...@inbo.be www.inbo.be To 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 Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens cct663 Verzonden: vrijdag 19 november 2010 5:39 Aan: r-help@r-project.org Onderwerp: [R] Question on overdispersion I have a few questions relating to overdispersion in a sex ratio data set that I am working with (note that I already have an analysis with GLMMs for fixed effects, this is just to estimate dispersion). The response variable is binomial because nestlings can only be male or female. I have samples of 1-5 nestlings from each nest (individuals within a nest are not independent, so the response variable is the ratio of sons to daughters) and some females have multiple nests in the data set (so I need to include female identity as a random effect). Here is an example of what the three vectors used in the model look like (the real data set is much bigger, just to illustrate what I'm talking about): male_chick_no=c(2,4,1,0,3,5,2) female_chick_no=c(1,0,3,3,1,0,2) FemaleID=c(A,A,B,B,C,D,E) My first question relates to coding the test in R. I received this suggested R syntax from a reviewer: SexRatio = cbind(male_chick_no, female_chick_no) Model <- lmer(SexRatio ~ 1 +(1|FemaleID), family = quasibinomial) But when I try to use this in R I get the error: "Error in glmer(formula = ratio ~ 1 + (1 | femid), family = quasibinomial) : "quasi" families cannot be used in glmer". I've tried playing around with some other mixed model functions but can't seem to find one that will provide an estimate of dispersion and allow me to include my random effect. Is there some other function I should be using? Or is there a different syntax that I should use for lmer? My second question is more general: I understand that with binomial data overdispersion suggests that the observed data have a greater variance than expected given binomial errors (in my case this means that more nests would be all male/all female than expected if sex is random). So with binomial errors the expected estimate of dispersion is 1, if I find that dispersion is > 1 it suggests that my data are overdispersed. My question is, how much greater than 1 should that number be to conclude that the data are overdispersed? Is there a rule of thumb or does it just depend on the dataset? I was thinking of doing a randomization test with the same structure (nest size and female id) as my real data set but with sex ratio of each ne
[R] unexpected behaviour with sparse.model.matrix
Hi, I'm trying to get sparse.model.matrix to retain unused levels. I can't seem to get this working through the most obvious routes such as specifying drop.unused.levels = FALSE in the model.frame or trying to pass all levels in xlev,which is an argument to sparse.model.matrix (see code below). Any help would be gratefully received. Cheers, Jarrod fac<-factor(rep(1:10,10), levels=1:100) mf<-model.frame(~fac, drop.unused.levels = TRUE) mf2<-model.frame(~fac, drop.unused.levels = FALSE) dim(model.matrix(~fac, mf)) dim(model.matrix(~fac, mf2)) dim(model.matrix(~fac, xlev=list(fac=1:10))) dim(model.matrix(~fac, xlev=list(fac=1:100))) dim(sparse.model.matrix(~fac, mf)) dim(sparse.model.matrix(~fac, mf2)) dim(sparse.model.matrix(~fac, xlev=list(fac=1:10))) dim(sparse.model.matrix(~fac, xlev=list(fac=1:100))) The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. __ 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.
Re: [R] [Rd] R CMD build wiped my computer
Hi Marc, Thanks for the info on recovery - most of it can pieced together from backups but a quick, cheap and easy method of recovery would have been nicer. My main concern is that this could happen again and that the "bug" is not limited to R 2.9. I would think that an accidental carriage return at the end of a file name (even a temporary one) would be a reasonably common phenomenon (I'm surprised I hadn't done it before). Cheers, Jarrod On 28 Jul 2010, at 14:04, Marc Schwartz wrote: Jarrod, Noting your exchange with Martin, Martin brings up a point that certainly I missed, which is that somehow the tilde ('~') character got into the chain of events. As Martin noted, on Linuxen/Unixen (including OSX), the tilde, when used in the context of file name globbing, refers to your home directory. Thus, a command such as: ls ~ will list the files in your home directory. Similarly: rm ~ will remove the files there as well. If the -rf argument is added, then the deletion becomes recursive through that directory tree, which appears to be the case here. I am unclear, as Martin appears to be, as to the steps that caused this to happen. That may yet be related in some fashion to Duncan's hypothesis. That being said, the use of the tilde character as a suffix to denote that a file is a backup version, is not limited to Fedora or Linux, for that matter. It is quite common for many text editors (eg. Emacs) to use this. As a result, it is also common for many applications to ignore files that have a tilde suffix. Based upon your follow up posts to the original thread, it would seem that you do not have any backups. The default ext3 file system that is used on modern Linuxen, by design, makes it a bit more difficult to recover deleted files. This is due to the unlinking of file metadata at the file system data structure level, as opposed to simply marking the file as deleted in the directory structures, as happens on Windows. There is a utility called ext3undel (http://projects.izzysoft.de/trac/ext3undel ), which is a wrapper of sorts to other undelete utilities such as PhotoRec and foremost. I have not used it/them, so cannot speak from personal experience. Thus it would be a good idea to engage in some reviews of the documentation and perhaps other online resources before proceeding. The other consideration is the Catch-22 of not copying anything new to your existing HD, for fear of overwriting the lost files with new data. So you would need to consider an approach of downloading these utilities via another computer and then running them on the computer in question from other media, such as a CD/DVD or USB HD. A more expensive option would be to use a professional data recovery service, where you would have to consider the cost of recovery versus your lost time. One option would be Kroll OnTrack UK (http://www.ontrackdatarecovery.co.uk/ ). I happen to live about a quarter mile from their world HQ here in a suburb of Minneapolis. I have not used them myself, but others that I know have, with good success. Again, this comes at a potentially substantial monetary cost. The key is that if you have any hope to recover the deleted files, you not copy anything new onto the hard drive in the mean time. Doing so will decrease the possibility of file recovery to near 0. As Duncan noted, there is great empathy with your situation. We have all gone through this at one time or another. In my case, it was perhaps 20+ years ago, but as a result, I am quite anal retentive about having backups, which I have done for some time on my systems, hourly. HTH, Marc Schwartz On Jul 28, 2010, at 5:55 AM, Jarrod Hadfield wrote: Hi Martin, I think this is the most likely reason given that the name in the DESCRIPTION file does NOT have a version number. Even so, it is very easy to misname a file and then delete it/change its name (as I've done here) and I hope current versions of R would not cause this problem. Perhaps Fedora should not use ~ as its back up file suffixes? Cheers, Jarrod On 28 Jul 2010, at 11:41, Martin Maechler wrote: Jarrod Hadfield on Tue, 27 Jul 2010 21:37:09 +0100 writes: Hi, I ran R (version 2.9.0) CMD build under root in Fedora (9). When it tried to remove "junk files" it removed EVERYTHING in my local account! (See below). Can anyone tell me what happened, the culprit may lay here: * removing junk files unlink MCMCglmm_2.05/R/ residuals.MCMCglmm.R ~ where it seems that someone (you?) have added a newline in the filname, so instead of 'residuals.MCMCglmm.R~' you got 'residuals.MCMCglmm.R ~' and the unlink / rm command interpreted '~' as your home directory. But I can hardly believe it. This seems explanation seems a bit doubtful to me.. ... and even more importantly if I can I rest
Re: [R] [Rd] R CMD build wiped my computer
Hi Martin, I think this is the most likely reason given that the name in the DESCRIPTION file does NOT have a version number. Even so, it is very easy to misname a file and then delete it/change its name (as I've done here) and I hope current versions of R would not cause this problem. Perhaps Fedora should not use ~ as its back up file suffixes? Cheers, Jarrod On 28 Jul 2010, at 11:41, Martin Maechler wrote: Jarrod Hadfield on Tue, 27 Jul 2010 21:37:09 +0100 writes: Hi, I ran R (version 2.9.0) CMD build under root in Fedora (9). When it tried to remove "junk files" it removed EVERYTHING in my local account! (See below). Can anyone tell me what happened, the culprit may lay here: * removing junk files unlink MCMCglmm_2.05/R/ residuals.MCMCglmm.R ~ where it seems that someone (you?) have added a newline in the filname, so instead of 'residuals.MCMCglmm.R~' you got 'residuals.MCMCglmm.R ~' and the unlink / rm command interpreted '~' as your home directory. But I can hardly believe it. This seems explanation seems a bit doubtful to me.. ... and even more importantly if I can I restore what was lost. well, you just get it from the backup. You do daily backups, do you? Regards, Martin Maechler, ETH Zurich Panickingly, Jarrod [jar...@localhost AManal]$ R CMD build MCMCglmm_2.05 * checking for file 'MCMCglmm_2.05/DESCRIPTION' ... OK * preparing 'MCMCglmm_2.05': * checking DESCRIPTION meta-information ... OK * cleaning src * installing the package to re-build vignettes * Installing *source* package ?MCMCglmm? ... ** libs g++ -m64 -I/usr/include/R -I/usr/local/include-fpic -O2 -g - pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c MCMCglmm.cc -o MCMCglmm.o MCMCglmm.cc: In function ?void MCMCglmm(double*, double*, double*, int*, int*, int*, int*, int*, int*, double*, int*, int*, double*, int*, int*, double*, double*, int*, int*, int*, int*, int*, int*, int*, int*, int*, int*, double*, double*, double*, int*, int*, int*, int*, double*, double*, double*, int*, double*, bool*, double*, double*, int*, int*, int*, int*, int*, double*, int*, int*, int*, double*, double*, double*, int*, int*, double*, int*, int*, int*, int*, double*, double*, double*, double*)?: MCMCglmm.cc:228: warning: ?pvLS? may be used uninitialized in this function MCMCglmm.cc:227: warning: ?pvLL? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?Lrv? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?pmuL? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?pvL? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?LambdaX? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?bv_tmp? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?bv? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?A? may be used uninitialized in this function MCMCglmm.cc:86: warning: ?dimG? may be used uninitialized in this function MCMCglmm.cc:228: warning: ?AlphainvS? may be used uninitialized in this function MCMCglmm.cc:227: warning: ?AlphainvL? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphalocation_tmp? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphalocation? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphazstar? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphapred? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphaastar? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?muAlpha? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?Alphainv? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?tXalpha? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?Xalpha? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?linky_orig? may be used uninitialized in this function MCMCglmm.cc:228: warning: ?tYKrinvYS? may be used uninitialized in this function MCMCglmm.cc:228: warning: ?LambdaS? may be used uninitialized in this function MCMCglmm.cc:227: warning: ?tYKrinvYL? may be used uninitialized in this function MCMCglmm.cc:227: warning: ?LambdaLU? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?tYKrinvY? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?tYKrinv? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?ILY? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?tY? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?Y? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?I? may be used uninitialized in this function MCMCglmm.cc:228: warning: ?alphaS? may be used uninitializ
Re: [R] R CMD build wiped my computer
Hi, Thanks for your responses. Although a wrist slapping for not keeping updated with R/Fedora may be warranted, I find it quite terrifying that by simply having a version number in a directory name R went on to try and erase everything on the computer! Thank god I wasn't logged in as root. Anyway, the more pressing issue is what I can do about this. My main concern is recovering those changes that were made to the package prior to its deletion. Luckily, just before running R CMD build I ran R CMD install under root (hence my belief I had ran R CMD build under root). I also have an open terminal for which the current package is loaded (and working I think). My question is how and how much can be recovered from this - having the C/C++ code would be particularly useful. Cheers, Jarrod On 27 Jul 2010, at 22:53, Duncan Murdoch wrote: On 27/07/2010 4:39 PM, Jarrod Hadfield wrote: Hi, I ran R (version 2.9.0) CMD build under root in Fedora (9). When it tried to remove "junk files" it removed EVERYTHING in my local account! (See below). Can anyone tell me what happened, and even more importantly if I can I restore what was lost. You did several things you shouldn't have done. Don't run as root unless you need to do what root can do. R CMD build shouldn't need special permissions, so it shouldn't be run as root. (Actually, it looks as though you didn't run as root: you got a number of "permissions denied" messages.) And don't run obsolete versions of R. There have been a lot of bug fixes since 2.9.0; you should take advantage of them. You should have known those two. One thing you might not have known is that it's a bad idea to name a package with the version number in the directory name. I don't think this will cause a lot of trouble with current versions of R, but it won't work. Apparently in 2.9.0 it caused a lot of trouble. Basically you need to restore from your backup. If you don't have one, you just learned how important Davidson's laws of computing are: The First Law: Back it up. The Second Law: Do it now. It may not sound like it, but I am sympathetic. Duncan Murdoch Panickingly, Jarrod [jar...@localhost AManal]$ R CMD build MCMCglmm_2.05 * checking for file 'MCMCglmm_2.05/DESCRIPTION' ... OK * preparing 'MCMCglmm_2.05': * checking DESCRIPTION meta-information ... OK * cleaning src * installing the package to re-build vignettes * Installing *source* package ?MCMCglmm? ... ** libs g++ -m64 -I/usr/include/R -I/usr/local/include-fpic -O2 -g - pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c MCMCglmm.cc -o MCMCglmm.o MCMCglmm.cc: In function ?void MCMCglmm(double*, double*, double*, int*, int*, int*, int*, int*, int*, double*, int*, int*, double*, int*, int*, double*, double*, int*, int*, int*, int*, int*, int*, int*, int*, int*, int*, double*, double*, double*, int*, int*, int*, int*, double*, double*, double*, int*, double*, bool*, double*, double*, int*, int*, int*, int*, int*, double*, int*, int*, int*, double*, double*, double*, int*, int*, double*, int*, int*, int*, int*, double*, double*, double*, double*)?: MCMCglmm.cc:228: warning: ?pvLS? may be used uninitialized in this function MCMCglmm.cc:227: warning: ?pvLL? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?Lrv? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?pmuL? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?pvL? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?LambdaX? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?bv_tmp? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?bv? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?A? may be used uninitialized in this function MCMCglmm.cc:86: warning: ?dimG? may be used uninitialized in this function MCMCglmm.cc:228: warning: ?AlphainvS? may be used uninitialized in this function MCMCglmm.cc:227: warning: ?AlphainvL? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphalocation_tmp? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphalocation? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphazstar? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphapred? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphaastar? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?muAlpha? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?Alphainv? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?tXalpha? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?Xalpha? may be used uninitialized i
[R] R CMD build wiped my computer
Hi, I ran R (version 2.9.0) CMD build under root in Fedora (9). When it tried to remove "junk files" it removed EVERYTHING in my local account! (See below). Can anyone tell me what happened, and even more importantly if I can I restore what was lost. Panickingly, Jarrod [jar...@localhost AManal]$ R CMD build MCMCglmm_2.05 * checking for file 'MCMCglmm_2.05/DESCRIPTION' ... OK * preparing 'MCMCglmm_2.05': * checking DESCRIPTION meta-information ... OK * cleaning src * installing the package to re-build vignettes * Installing *source* package ?MCMCglmm? ... ** libs g++ -m64 -I/usr/include/R -I/usr/local/include-fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c MCMCglmm.cc -o MCMCglmm.o MCMCglmm.cc: In function ?void MCMCglmm(double*, double*, double*, int*, int*, int*, int*, int*, int*, double*, int*, int*, double*, int*, int*, double*, double*, int*, int*, int*, int*, int*, int*, int*, int*, int*, int*, double*, double*, double*, int*, int*, int*, int*, double*, double*, double*, int*, double*, bool*, double*, double*, int*, int*, int*, int*, int*, double*, int*, int*, int*, double*, double*, double*, int*, int*, double*, int*, int*, int*, int*, double*, double*, double*, double*)?: MCMCglmm.cc:228: warning: ?pvLS? may be used uninitialized in this function MCMCglmm.cc:227: warning: ?pvLL? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?Lrv? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?pmuL? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?pvL? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?LambdaX? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?bv_tmp? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?bv? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?A? may be used uninitialized in this function MCMCglmm.cc:86: warning: ?dimG? may be used uninitialized in this function MCMCglmm.cc:228: warning: ?AlphainvS? may be used uninitialized in this function MCMCglmm.cc:227: warning: ?AlphainvL? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphalocation_tmp? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphalocation? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphazstar? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphapred? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphaastar? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?muAlpha? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?Alphainv? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?tXalpha? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?Xalpha? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?linky_orig? may be used uninitialized in this function MCMCglmm.cc:228: warning: ?tYKrinvYS? may be used uninitialized in this function MCMCglmm.cc:228: warning: ?LambdaS? may be used uninitialized in this function MCMCglmm.cc:227: warning: ?tYKrinvYL? may be used uninitialized in this function MCMCglmm.cc:227: warning: ?LambdaLU? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?tYKrinvY? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?tYKrinv? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?ILY? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?tY? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?Y? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?I? may be used uninitialized in this function MCMCglmm.cc:228: warning: ?alphaS? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphaMME? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphaM? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?XtmKRinv? may be used uninitialized in this function MCMCglmm.cc:227: warning: ?alphaL? may be used uninitialized in this function MCMCglmm.cc:227: warning: ?L? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?alphaastar_tmp? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?dev? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?astar_tmp? may be used uninitialized in this function MCMCglmm.cc:225: warning: ?Worig? may be used uninitialized in this function gcc -m64 -std=gnu99 -I/usr/include/R -I/usr/local/include-fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c cs_add.c -o cs_add.o gcc -m64 -std=gnu99 -I/usr/include/R -I/usr/local/include-fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c cs_addR.
Re: [R] mcmcglmm starting value example
Dear Ping, It is not possible to pass starting values for the fixed effects. It doesn't make much sense to give starting values for the fixed effects because they can be Gibbs sampled in a single pass conditional on the latent variables and the (co)variance components - after a single iteration they would "forget" their starting values. The cut points in an ordinal model are a different matter. At the moment I do not allow user defined starting values for the cut points, but agree that it may be useful. I am about to release an update that allows spline fitting in MCMCglmm. If it is starting values for the cut points you're really after I can add that in before I release? Cheers, Jarrod On 29 Mar 2010, at 22:06, ping chen wrote: Hi R-users: Can anyone give an example of giving starting values for MCMCglmm? I can't find any anywhere. I have 1 random effect (physicians, and there are 50 of them) and family="ordinal". How can I specify starting values for my fixed effects? It doesn't seem to have the option to do so. Thanks, Ping -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. __ 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] plotmath
Hi, I want to have a legend that is a mixture of numbers and symbols, and have found no way of achieving this. For example, if I want theta="x" or theta=2 this is easily achieved. plot(0, xlab=expression(paste(theta, "= x"))) plot(0, xlab=expression(paste(theta, "= 2"))) However, if x is some numeric variable and I want to plot theta=x, how is this done? Thanks for any help, Jarrod -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. __ 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.
Re: [R] change attributes of all data.frame elements
Hi Philipp, # Sorry - perhaps I wasn't being very clear. For example, creating the data frame: df<-data.frame(y=rnorm(100), x=array(1:100)) # gives 2 elements, the last of which has a dim attribute lapply(df, dim) # I would like some way of changing the dim attribute to NULL for all elements. Thanks, Jarrod I was wondering whether there was an easy way to change the attributes of all elements in a data.frame (rather than looping through elements)? Specifically, I would like to set the "dim" attributes to NULL Maybe I just don't really understand what you are after. The elements of a data.frame are vectors so by definition they only have one dimension. Furthermore, they are required to be the same length - otherwise it wouldn't be a proper data.frame, anymore. So I guess you really want to accomplish something I didn't quite grasp. Could you give an example? cu Philipp -- Dr. Philipp Pagel Lehrstuhl f?r Genomorientierte Bioinformatik Technische Universit?t M?nchen Wissenschaftszentrum Weihenstephan 85350 Freising, Germany http://mips.gsf.de/staff/pagel The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. __ 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] change attributes of all data.frame elements
Hi, I was wondering whether there was an easy way to change the attributes of all elements in a data.frame (rather than looping through elements)? Specifically, I would like to set the "dim" attributes to NULL Thanks for any help, Jarrod -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. __ 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.
Re: [R] generalized mixed model + mcmcsamp
Hi Thomas/Ben, This model ca be MCMCed using MCMCglmm by specifying "multinomial2" (i.e. binomial) in the family argument. MCMCglmm by default, fits a residual in the linear model to soak up extra-binomial variation, which is similar in motivation to quasi models. Cheers, Jarrod Hi, I have fitted a generalized linear mixed effects model using lmer (library lme4), and the family = quasibinomial. I have tried to obtain a MCMC sample, but on calling mcmcsamp(model1, 1000) I get the following error which I don't understand at all: Error in .local(object, n, verbose, ...) : Update not yet written traceback() delivers: 4: .Call(mer_MCMCsamp, ans, object) 3: .local(object, n, verbose, ...) 2: mcmcsamp(model1, n = 1000, verbose = FALSE) 1: mcmcsamp(model1, n = 1000, verbose = FALSE) which again doesn't particularly help me. R is 2.8.1 under Windows, lme4 clean installed just today. Before the model is fitted I just read in data, and transform some variables. No other library is loaded. Any ideas ? thanks, Thomas -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. __ 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] model.matrix and missing values
Hi, Does anyone know an easy way of retaining rows in a model.matrix where missing values are present in the predictors. Ideally I'd be able to retain these rows as zeros. Thanks, Jarrod -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. __ 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] uppercase greek and plotmath
Hi, I cant seem to get some uppercase greek symbols (e.g. Delta) using plotmath. I'm on version R 2.7.0 (2008-04-22) Fedora Core 7 (34 bit). I have installed a whole heap of fonts, but still no luck, and any help would be appreciated. Cheers, Jarrod -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. __ 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.
Re: [R] linking C/C++ external libraries.
Hi Dirk, ldd is not bringing up csparse which suggests that it is a linking problem. For liking I used both the SHLIB and INSTALL comands using - L (see below), but both generate the same problem. Cheers, Jarrod [EMAIL PROTECTED] ~]$ R CMD SHLIB ~/Work/AManal2/src/SStest.cc -L/ home/jarrod/My_Programs/SuiteSparse/CSparse/Lib -lcsparse g++ -I/usr/lib/R/include -I/usr/lib/R/include -I/usr/local/ include-fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 - fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 - march=i386 -mtune=generic -fasynchronous-unwind-tables -c /home/ jarrod/Work/AManal2/src/SStest.cc -o /home/jarrod/Work/AManal2/src/ SStest.o /home/jarrod/Work/AManal2/src/SStest.cc: In function Äòvoid SStest (int*, int*, double*, int*, int*)Äô: /home/jarrod/Work/AManal2/src/SStest.cc:18: warning: unused variable ÄòiAÄô /home/jarrod/Work/AManal2/src/SStest.cc:19: warning: unused variable ÄòpAÄô /home/jarrod/Work/AManal2/src/SStest.cc:20: warning: unused variable ÄòxAÄô g++ -shared -L/usr/local/lib -o /home/jarrod/Work/AManal2/src/ SStest.so /home/jarrod/Work/AManal2/src/SStest.o -L/home/jarrod/ My_Programs/SuiteSparse/CSparse/Lib -lcsparse -L/usr/lib/R/lib -lR >dyn.load("~/Work/AManal2/src/SStest.so") Error in dyn.load("~/Work/AManal2/src/SStest.so") : unable to load shared library '/home/jarrod/Work/AManal2/src/ SStest.so': /home/jarrod/Work/AManal2/src/SStest.so: undefined symbol: _Z10cs_spalloci [EMAIL PROTECTED] ~]$ R CMD INSTALL -l ~/Desktop ~/Work/AManal2 * Installing *source* package 'AManal' ... ** libs g++ -I/usr/lib/R/include -I/usr/lib/R/include -I/home/jarrod/ My_Programs/SuiteSparse/CSparse/Include -I/usr/local/include- fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack- protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic - fasynchronous-unwind-tables -c SStest.cc -o SStest.o SStest.cc: In function Äòvoid SStest(int*, int*, double*, int*, int*) Äô: SStest.cc:18: warning: unused variable ÄòiAÄô SStest.cc:19: warning: unused variable ÄòpAÄô SStest.cc:20: warning: unused variable ÄòxAÄô g++ -shared -L/usr/local/lib -o AManal.so SStest.o -L/home/jarrod/ My_Programs/SuiteSparse/CSparse/Lib -lcsparse -L/usr/lib/R/lib -lR ** R ** data ** preparing package for lazy loading ** help >>> Building/Updating help pages for package 'AManal' Formats: text html latex example ** building package indices ... * DONE (AManal) library("AManal", lib.loc="~/Desktop") Error in dyn.load(file, ...) : unable to load shared library '/home/jarrod/Desktop/AManal/libs/ AManal.so': /home/jarrod/Desktop/AManal/libs/AManal.so: undefined symbol: _Z10cs_spalloci Error: package/namespace load failed for 'AManal' On 3 Dec 2007, at 16:57, Dirk Eddelbuettel wrote: > > On 3 December 2007 at 14:54, Jarrod Hadfield wrote: > | I'm trying to load some C++ code using dyn.load but I'm getting > | unresolved symbols associated with some external libraries > | (CSparse). I gather this is something to do with linking as the the > | code compiles fine. However, I've passed > | > | -L/home/jarrod/My_Programs/SuiteSparse/CSparse/Lib -lcsparse > | > | to the complier (g++), either directly using R CMD SHLIB or as > | PKG_LIBS in a Makevars file, and I cannot resolve the problem. I'm > | working with R 2.6.0 on fedora 6 > | > | Any help would be appreciated. > > Can you show us your error message upon load? What does ldd say > when pointed > at your package's library? How exactly is the linking done? > > Compare all that to a working library such as eg Matrix. That may > provide > further clues. > > Hth, Dirk > > -- > Three out of two people have difficulties with fractions. > [[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] linking C/C++ external libraries.
Hi Everyone, I'm trying to load some C++ code using dyn.load but I'm getting unresolved symbols associated with some external libraries (CSparse). I gather this is something to do with linking as the the code compiles fine. However, I've passed -L/home/jarrod/My_Programs/SuiteSparse/CSparse/Lib -lcsparse to the complier (g++), either directly using R CMD SHLIB or as PKG_LIBS in a Makevars file, and I cannot resolve the problem. I'm working with R 2.6.0 on fedora 6 Any help would be appreciated. Thanks, Jarrod __ 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.