pvals.fnc() with language R does not work with R 2.10.1

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

pvals.fnc() with language R does not work with R 2.10.1

ozge gurcanli

Hi Everyone,

I am using R 2.10.1.  lmer function works properly, however pvals.fnc
()  does not despite the fact that I uploaded:

- library(lme4)
- library(coda)
- library(languageR)

This is the error message I get

  pvals.fnc(lexdec3.lmerE2, nsim=10000)$fixed

Error in pvals.fnc(lexdec3.lmerE2, nsim = 10000) :
   MCMC sampling is not yet implemented in lme4_0.999375
   for models with random correlation parameters

How can I resolve the problem?

Thanks,
Özge
______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Aligning text in the call to the text function

Tighiouart, Hocine
Hi,

I have text (see below) that is aligned nicely when printed in the
command window in R but when plotted using text function, it does not
show alignment unless I use the family="mono" in the call to the text
function. Is there a way to specify a different font while maintaining
the alignment?

 Eric & Alan 1667   3   459
 Alan 2001          45  34
 John & David 1996  2   5235

Thanks for any hints

Hocine

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Aligning text in the call to the text function

Duncan Murdoch
On 01/04/2010 3:39 PM, Tighiouart, Hocine wrote:

> Hi,
>
> I have text (see below) that is aligned nicely when printed in the
> command window in R but when plotted using text function, it does not
> show alignment unless I use the family="mono" in the call to the text
> function. Is there a way to specify a different font while maintaining
> the alignment?
>
>  Eric & Alan 1667   3   459
>  Alan 2001          45  34
>  John & David 1996  2   5235
>
>  


Plot each of the parts separately, i.e. plot 9 objects, not 3.  You can
use strwidth() to compute how big each part is and adjust the
positioning based on that.

You might also be able to do it using paste() and atop() with an
expression; see ?plotmath.  But I think manual positioning is easiest.  
Here's an example:

leftalign <- function(x, y, m) {
  widths <- strwidth(m)
  dim(widths) <- dim(m)
  widths <- apply(widths, 2, max)
  widths <- widths + strwidth("   ")
  heights <- strheight(m)
  dim(heights) <- dim(m)
  heights <- apply(heights, 1, max)
  heights <- heights*1.5
 
  xoffsets <- c(0, cumsum(widths[-length(widths)]))
  yoffsets <- c(0, -cumsum(heights[-length(heights)]))

  text(x + rep(xoffsets, each=nrow(m)),
       y + rep(yoffsets, ncol(m)), m, adj=c(0,1))

}

plot(1)
leftalign(0.8, 1.2, matrix(c("Eric & Alan 1667", "Alan 2001", "John &
David 1996", 3,45,2,459,34,5235), ncol=3))

Obviously you could make it a lot more elaborate, with left alignment
for some columns and right alignment for others, etc.  Probably some
package has already done this.

Duncan Murdoch

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: pvals.fnc() with language R does not work with R 2.10.1

Ben Bolker
In reply to this post by ozge gurcanli
ozge gurcanli <gurcanli <at> cogsci.jhu.edu> writes:

>
>
> Hi Everyone,
>
> I am using R 2.10.1.  lmer function works properly, however pvals.fnc
> ()  does not despite the fact that I uploaded:
>
> - library(lme4)
> - library(coda)
> - library(languageR)
>
> This is the error message I get
>
>   pvals.fnc(lexdec3.lmerE2, nsim=10000)$fixed
>
> Error in pvals.fnc(lexdec3.lmerE2, nsim = 10000) :
>    MCMC sampling is not yet implemented in lme4_0.999375
>    for models with random correlation parameters
>
> How can I resolve the problem?

  Neither of these packages is with base R (lme4 and languageR are
the source of your problems, not coda). The standard advice in
this case is to "contact the package maintainer" -- you can
find this info from help(package=languageR) (or the equivalent
for lme4) -- the maintainers are R Baayen and D Bates respectively.

  However, before you do that -- mcmcsamp has not worked in
lme4 for quite a while.  You could try to retrieve sufficiently
old versions of lme4 (and probably Matrix as well, since the
two are interconnected) to find a version where mcmcsamp works
(but this could be dangerous since I believe Bates abandoned
mcmcsamp after finding several cases where it got stuck and
deciding that he should remove it until he found a way to
make it more robust).

  My suggestion would be to try posting this to r-sig-mixed-models
to see if anyone has a suggestion, and possibly contacting Baayen.
I suspect Bates will just tell you what I stated above.  You could
also look at http://glmm.wikidot.com/faq , but again it doesn't
say much more than I have already stated.

  Ben Bolker

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Aligning text in the call to the text function

baptiste auguie-5
In reply to this post by Tighiouart, Hocine
Hi,

One option with Grid graphics,

m <-
matrix(c( 1667,    3,    459,
         2001, 45,   34,
         1996,   2,    5235),
       dimnames=list(c("Eric & Alan", "Alan","John & David")),
        ncol=3, byrow=T)

## install.packages("gridExtra", repos="http://R-Forge.R-project.org")
library(gridExtra)

grid.table(m, theme=theme.white(row.just="left",core.just="left"))

HTH,

baptiste

On 1 April 2010 21:39, Tighiouart, Hocine
<[hidden email]> wrote:

> Hi,
>
> I have text (see below) that is aligned nicely when printed in the
> command window in R but when plotted using text function, it does not
> show alignment unless I use the family="mono" in the call to the text
> function. Is there a way to specify a different font while maintaining
> the alignment?
>
>  Eric & Alan 1667   3   459
>  Alan 2001          45  34
>  John & David 1996  2   5235
>
> Thanks for any hints
>
> Hocine
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.