Re: [R] HISTOGRAM

2018-11-09 Thread Rick Bilonick
First, a histogram would not be appropriate (your data appear to be
categorical - a histogram is for continuous numeric vales) - you would need
a bar plot. You should make two vectors (one for the category names and the
other for the frequencies) and use the barplot function.

On Fri, Nov 9, 2018 at 1:46 PM Medic  wrote:

> What would be the correct code (simplest version) (without gplot())
> for histogram (with 7 bars), which would include 7 names of bars under
> the X-axis. The data are:
>
> name number
> ds6277
> lk 24375
> ax46049
> dd70656
> az216544
> df 220620
> gh641827
>
> (I'm attaching mydata.r, making with dput.)
>
> My attempt is:
>
> options(scipen=999)
> with (mydata, hist(number))
>
> P.S. I can't understand how the column "name" to include in a code
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-helpdata=02%7C01%7Crab45%40pitt.edu%7C55f2571738b246f9dc1e08d646739b27%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C636773859721875419sdata=haHuxll2%2FO0Dci0fSpd0evjfi0MTmLi0JoghvHxlz3o%3Dreserved=0
> PLEASE do read the posting guide
> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.R-project.org%2Fposting-guide.htmldata=02%7C01%7Crab45%40pitt.edu%7C55f2571738b246f9dc1e08d646739b27%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C636773859721875419sdata=aL6arSyKx4m9LBdOMhdhSpsdJmGCHubfdI%2Fns4Rgytw%3Dreserved=0
> 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.


Re: [R] Is there t.test with null hypothesis?

2016-09-08 Thread Rick Bilonick

You need to include the argument "mu=1" (without parentheses). For example:

> t.test(group1,group2, mu=1)

for a two-sample independent groups t-test. If you type:

> ?t.test

you can see the help information for the t.test function.

RIck

On 09/08/2016 08:06 AM, Matti Viljamaa wrote:

I’m trying to do a t-test, where the null hypothesis for the two data sets has 
to be:

“the means are the same”/“difference in means is equal to one”

Using the t.test function in R I’m able to see that it uses the following 
“alternative hypothesis”:

alternative hypothesis: true difference in means is not equal to 0

but does not seem to specify null hypothesis. I believe alternative and null 
hypotheses are different, although
I don’t exactly know how.

So what should I use for my t-test? Or is t.test ok?

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fstat.ethz.ch%2fmailman%2flistinfo%2fr-help=01%7c01%7crab45%40pitt.edu%7c99a5b7c1533548c5ead708d3d7e0bb76%7c9ef9f489e0a04eeb87cc3a526112fd0d%7c1=Pf9Tku8lIeH9quNmY2dEmR4HNSLgShRP7p7Hx9HUCMY%3d
PLEASE do read the posting guide 
https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fwww.R-project.org%2fposting-guide.html=01%7c01%7crab45%40pitt.edu%7c99a5b7c1533548c5ead708d3d7e0bb76%7c9ef9f489e0a04eeb87cc3a526112fd0d%7c1=eGCmYy70ceyiJ%2bpgDXA8SaHHma%2f4DbxhIbSARUDYwxg%3d
and provide commented, minimal, self-contained, reproducible code.


__
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] Logical operator in R

2016-01-22 Thread Rick Bilonick

On 01/22/2016 10:46 AM, li li wrote:

Hi all,
   I encountered the following strange phenomenon.
For some reason, the obs_p[1] and res1$st_p[89] have
the same value but when I run "==", it returns FALSE.
Can anyone help give some explanation on this?
   Thanks very much!
 Hanna


obs_p[1]

[1] 0.002201438

res1$st_p[89]

[1] 0.002201438

res1$st_p[89]==obs_p[1]

[1] FALSE

res1$st_p[89]obs_p[1]

[1] TRUE

[[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.
I believe the decimal representation is only approximate. The real 
internal values in binary are different. If you want to have comparisons 
like this result in being considered equal, I think there is a way to 
use a fuzzy comparison but I don't remember the details.


Rick

--
Richard A. Bilonick, PhD
Assistant Professor
Dept. of Ophthalmology, School of Medicine
Dept. of Biostatistics, Graduate School of Public Health
Dept. of Orthodontics, School of Dental Medicine
University of Pittsburgh
Principal Investigator for the Pittsburgh Aerosol Research
 and Inhalation Epidemiology Study (PARIES)
412 647 5756

__
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] Lavaan

2015-06-24 Thread Rick Bilonick
Have you considered using the semPlot package? It works nicely with 
lavaan models (among other sem packages). There is also the DiagrammeR 
package.


Rick

On 06/23/2015 10:48 AM, DzR wrote:

Dear Senior users of R/R Studio,

I am very new to this environment hence am unable to plot the SEM models 
including use of graphic package ggplot.

Request for some help in getting the plots please.

Thanks,

-
Deva
__
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.



--
Richard A. Bilonick, PhD
Assistant Professor
Dept. of Ophthalmology, School of Medicine
Dept. of Biostatistics, Graduate School of Public Health
Dept. of Orthodontics, School of Dental Medicine
University of Pittsburgh
Principal Investigator for the Pittsburgh Aerosol Research
 and Inhalation Epidemiology Study (PARIES)
412 647 5756

__
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] chi-square test

2014-09-15 Thread Rick Bilonick

On 09/15/2014 10:57 AM, eliza botto wrote:

Dear useRs of R,
I have two datasets (TT and SS) and i wanted to to see if my data is uniformly 
distributed or not?I tested it through chi-square test and results are given at the end 
of it.Now apparently P-value has a significant importance but I cant interpret the 
results and why it says that In chisq.test(TT) : Chi-squared approximation may be 
incorrect
###

dput(TT)

structure(list(clc5 = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.26, 0.14, 0, 0.44, 
0.26, 0, 0, 0, 0, 0, 0, 0.11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.17, 0.16, 
0.56, 0, 1.49, 0, 0.64, 0.79, 0.66, 0, 0, 0.17, 0, 0, 0, 0, 0.56, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0.43, 0.41, 0, 0.5, 0.44, 0, 0, 0, 0, 0.09, 0.46, 0, 0.27, 
0.45, 0.15, 0.31, 0.16, 0.44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.07, 0, 0, 0, 0, 
0, 0.06, 0, 0.09, 0.07, 0, 0, 7.89, 0, 0.22, 0.29, 0.33, 0.27, 0, 0.36, 0.41, 
0, 0, 0, 0, 0.55, 0.81, 0, 0.09, 0.13, 0.28, 0, 0, 0), quota_massima = c(1167L, 
1167L, 4572L, 3179L, 3141L, 585L, 585L, 876L, 876L, 1678L, 2667L, 1369L, 1369L, 
1369L, 1381L, 1381L, 1381L, 1381L, 2284L, 410L, 2109L, 2507L, 2579L, 2507L, 
1436L, 3234L, 3234L, 3234L, 3234L, 2792L, 2569L, 2569L, 2569L, 1669L, 4743L, 
4743L, 4743L, 3403L, 3197L, 3267L, 3583L, 3583L, 3583L, 2584L, 2584L, 2579L, 
1241L, 1241L, 4174L, 3006L, 3197L, 2366L, 2618L, 2670L, 4487L, 3196L, 3196L, 
2107L, 2107L, 2427L, 1814L, 2622L, 1268L, 1268L, 1268!

L,!

   3885L, 3885L, 3092L, 3234L, 2625L, 2625L, 3760L, 4743L, 3707L, 3760L, 4743L, 3760L, 3885L, 3760L, 4743L, 
2951L, 782L, 2957L, 3343L, 2697L, 2697L, 3915L, 2277L, 1678L, 1678L, 3197L, 2957L, 2957L, 2957L, 4530L, 
4530L, 4530L, 2131L, 3618L, 3618L, 3335L, 2512L, 2390L, 1616L, 3526L, 3197L, 3197L, 2625L, 2622L, 3197L, 
3197L, 2622L, 2622L, 2622L, 368L, 4572L, 3953L, 863L, 3716L, 3716L, 3716L, 2697L, 2697L, 1358L)), .Names = 
c(clc5, quota_massima), class = data.frame, row.names = c(NA, -124L))


  chisq.test(TT)

 Pearson's Chi-squared test
data:  TT
X-squared = 411.5517, df = 123, p-value  2.2e-16
Warning message:
In chisq.test(TT) : Chi-squared approximation may be incorrect
###

dput(SS)

structure(list(NDVIanno = c(0.57, 0.536, 0.082, 0.262, 0.209, 0.539, 0.536, 
0.543, 0.588, 0.599, 0.397, 0.63, 0.616, 0.644, 0.579, 0.597, 0.617, 0.622, 
0.548, 0.528, 0.541, 0.436, 0.509, 0.467, 0.534, 0.412, 0.324, 0.299, 0.41, 
0.462, 0.427, 0.456, 0.508, 0.581, 0.242, 0.291, 0.324, 0.28, 0.291, 0.305, 
0.365, 0.338, 0.399, 0.516, 0.357, 0.558, 0.605, 0.638, 0.191, 0.377, 0.325, 
0.574, 0.458, 0.426, 0.188, 0.412, 0.464, 0.568, 0.582, 0.494, 0.598, 0.451, 
0.577, 0.572, 0.602, 0.321, 0.38, 0.413, 0.427, 0.55, 0.437, 0.481, 0.425, 
0.234, 0.466, 0.464, 0.491, 0.463, 0.489, 0.435, 0.267, 0.564, 0.256, 0.156, 
0.476, 0.498, 0.122, 0.508, 0.582, 0.615, 0.409, 0.356, 0.284, 0.285, 0.444, 
0.303, 0.478, 0.557, 0.345, 0.408, 0.347, 0.498, 0.534, 0.576, 0.361, 0.495, 
0.502, 0.553, 0.519, 0.504, 0.53, 0.547, 0.559, 0.505, 0.557, 0.377, 0.36, 
0.613, 0.452, 0.397, 0.277, 0.42, 0.443, 0.62), delta_z = c(211L, 171L, 925L, 
534L, 498L, 50L, 53L, 331L, 135L, 456L, 850L, 288L, 286L, 233L, 342L, !

27!

  4L, 184L, 198L, 312L, 67L, 476L, 676L, 349L, 873L, 65L, 963L, 553L, 474L, 948L, 1082L, 616L, 704L, 814L, 
450L, 865L, 987L, 1265L, 720L, 565L, 652L, 941L, 822L, 1239L, 929L, 477L, 361L, 199L, 203L, 642L, 788L, 818L, 
450L, 703L, 760L, 711L, 1015L, 1351L, 195L, 511L, 617L, 296L, 604L, 381L, 389L, 287L, 1043L, 1465L, 963L, 
1125L, 582L, 662L, 1424L, 1762L, 575L, 1477L, 1364L, 1236L, 1483L, 1201L, 1644L, 498L, 142L, 510L, 482L, 
811L, 788L, 466L, 626L, 461L, 350L, 1177L, 826L, 575L, 568L, 916L, 767L, 1017L, 532L, 1047L, 1370L, 902L, 
686L, 703L, 440L, 1016L, 1148L, 1089L, 753L, 650L, 1065L, 568L, 712L, 762L, 636L, 79L, 1092L, 955L, 158L, 
1524L, 1145L, 673L, 513L, 596L, 239L)), .Names = c(NDVIanno, delta_z), class = 
data.frame, row.names = c(NA, -124L))

  chisq.test(SS)

 Pearson's Chi-squared test
data:  SS
X-squared = 72.8115, df = 123, p-value = 0.
Warning message:
In chisq.test(SS) : Chi-squared approximation may be incorrect
#
Kindly guide me through like you always did :)
thanks in advance,


Eliza   
[[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.
You are using a Chi-squared test on a 124x2 matrix of values (not all 
integers) and many are zeros. The expected frequencies for many cells 
are very small (near zero, less than 1) hence the warning message. More 
importantly, does this application of the 

Re: [R] CFA with lavaan or with SEM

2013-02-01 Thread Rick Bilonick
Not sure if you are aware of the OpenMx SEM package 
(http://openmx.psyc.virginia.edu/). It's a very full-featured structural 
equation modeling package.


__
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] FIML with missing data in sem package

2011-12-01 Thread Rick Bilonick

On 12/01/2011 07:18 AM, John Fox wrote:

  To:r-help@r-project.org
  Subject: [R] FIML with missing data in sem package
  
You should check out the OpenMx R package. Just search for OpenMx and 
SEM. You can download from the web site. It does FIML and is an 
excellent SEM package.


Rick B .

__
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] Installing Rmpi on Centos 5.2

2009-03-26 Thread Rick Bilonick
I am trying to install the R package Rmpi which needs libmpi. I've
installed openmpi and lam in Centos 5.2:

[r...@rab45-1 /]# rpm -qv openmpi
openmpi-1.2.5-5.el5
openmpi-1.2.5-5.el5
[r...@rab45-1 /]# rpm -qv lam
lam-7.1.2-14.el5
lam-7.1.2-14.el5

I'm using this to install Rmpi:

R CMD INSTALL /home/rick/Rmpi_0.5-7.tar.gz
--with-mpi=/usr/lib64/lam/include

But I get the following error message:

/usr/bin/ld: skipping incompatible /usr/lib/lam/lib/libmpi.so when
searching for -lmpi

I'm not sure what else to install/uninstall to fix this.

Rick B.

__
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] Power analysis for MANOVA?

2009-02-01 Thread Rick Bilonick
On Wed, 2009-01-28 at 21:21 +0100, Stephan Kolassa wrote:
 Hi Adam,
 
 first: I really don't know much about MANOVA, so I sadly can't help you 
 without learning about it an Pillai's V... which I would be glad to do, 
 but I really don't have the time right now. Sorry!
 
 Second: you seem to be doing a kind of post-hoc power analysis, my 
 result isn't significant, perhaps that's due to low power? Let's look at 
 the power of my experiment! My impression is that post-hoc power 
 analysis and its interpretation is, shall we say, not entirely accepted 
 within the statistical community, see:
 
 Hoenig, J. M.,  Heisey, D. M. (2001, February). The abuse of power: The 
 pervasive fallacy of power calculations for data analysis. The American 
 Statistician, 55 (1), 1-6
 
 And this:
 http://staff.pubhealth.ku.dk/~bxc/SDC-courses/power.pdf
 
 However, I am sure that lots of people can discuss this more competently 
 than me...
 
 Best wishes
 Stephan
 

The point of the article was that doing a so-called retrospective
power analysis leads to logical contradictions with respect to the
confidence intervals and p-values from the analysis of the data. In
other words, DON'T DO IT! All the information is contained in the
confidence intervals which are based on the observed data - an after the
fact power analysis cannot provide any insight - it's not data
analysis.

Rick B.

__
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] Ordinal Package Errors

2009-01-14 Thread Rick Bilonick
I'm trying to install the ordinal package
(http://popgen.unimaas.nl/~plindsey/rlibs.html).

I downloaded ordinal03.tgz and untarred it. rmutil was previously
installed (and appears to work ok.) Then I installed ordinal:

[r...@localhost ~]# R CMD INSTALL /home/chippy/Download/ordinal
* Installing to library '/usr/lib/R/library'
* Installing *source* package 'ordinal' ...
** libs
** arch - 
gcc -m32 -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 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables -c dist.c -o dist.o
dist.c: In function ‘evalfn’:
dist.c:119: warning: unused variable ‘nn’
dist.c: In function ‘romberg’:
dist.c:146: warning: unused variable ‘j’
dist.c:147: warning: ‘sum[0]’ may be used uninitialized in this function
dist.c:147: warning: ‘Rf_df’ may be used uninitialized in this function
gcc -m32 -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 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables -c kord.c -o kord.o
kord.c: In function ‘pkord’:
kord.c:428: warning: suggest explicit braces to avoid ambiguous ‘else’
kord.c: In function ‘kord’:
kord.c:73: warning: ‘omega’ may be used uninitialized in this function
kord.c:73: warning: ‘b0b’ may be used uninitialized in this function
kord.c:73: warning: ‘a0a’ may be used uninitialized in this function
gcc -m32 -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 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables -c lcr.c -o lcr.o
lcr.c: In function ‘lbr’:
lcr.c:247: warning: ‘p’ may be used uninitialized in this function
gcc -m32 -std=gnu99 -shared -L/usr/local/lib -o ordinal..so dist.o
kord.o lcr.o   -L/usr/lib/R/lib -lR
** R
** data
** preparing package for lazy loading
Loading required package: rmutil

Attaching package: 'rmutil'


The following object(s) are masked from package:base :

 units 

** help
  Building/Updating help pages for package 'ordinal'
 Formats: text html latex example 
** building package indices ...
* DONE (ordinal)


I start up R but when I try to load ordinal I get error messages:


[r...@localhost ~]# R

R version 2.8.0 (2008-10-20)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Previously saved workspace restored]

 library(ordinal)
Loading required package: rmutil

Attaching package: 'rmutil'


The following object(s) are masked from package:base :

 units 

Error in library.dynam(ordinal, pkg, lib) : 
  shared library 'ordinal' not found
Error in library(ordinal) : .First.lib failed for 'ordinal'


Does anyone know how to fix this?

Rick B.

__
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] Ordinal Package Errors

2009-01-14 Thread Rick Bilonick

On Wed, 2009-01-14 at 16:38 +, Prof Brian Ripley wrote:
 You need to ask the author (as the posting guide asked you to).
 
 I'm tempted to not help further given the (almost complete) lack of 
 cooperation of that author with R's recommendations, but note 
 'ordinal..so' in your log and look for the obvious fix in 
 src/Makefile.
 
 

I had no idea whether this was a problem with the particular package or
my installation of R. Sometimes you have to ask a question before it's
clear what to do.

I went to /usr/lib/R/library/ordinal/libs and moved ordinal..so to
ordinal.so. This solved the problem. I didn't see anything obvious in
the Makefile (at least, not obvious to me).

There were other things that made installing the ordinal package
difficult. The first is that the file is ordinal03.tgz. Using

 R CMD INSTALL ordinal03.tgz

won't work because the package name is ordinal, not ordinal03. I tried
renaming but that didn't work, so I untarred it and then did:

 R CMD INSTALL ordinal

This installed the package but then ordinal..so is incorrectly named so
I corrected it as described above.

It would have been a whole lot easier if the package was in the
contributed package repository.

Rick B.

__
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] Errors running gam examples

2008-11-09 Thread Rick Bilonick
I'm running R 2.8.0 under Fedora 8 (32-bit). I installed the gam
package. I can fit gam models, but I get error messages when I try to
use step.gam and plot.gam, even for examples:

 library(gam)
 ?plot.gam
 data(gam.data)
 gam.object - gam(y ~ s(x,6) + z,data=gam.data)
 plot(gam.object,se=TRUE)
Error in dim(data) - dim : attempt to set an attribute on NULL

summary(gam.object) appears to work OK. The same thing happens if I use
my own data and model.

Package:   gam
Title: Generalized Additive Models
Date:  2008-05-28
Version:   1.0

I was able to get step.gam to work on its example but it doesn't work on
my model.

Has anyone else run into this?

Rick B.

__
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] Getting R and x11 to work

2008-06-05 Thread Rick Bilonick
I'm using Suse Linux Enterprise Desktop 10.2 (SP2) on an HP 2133 (x86)
mini-notebook. (There apparently are a LOT of bugs in 10.1!) I
downloaded R-base from the openSuse 10.2 repository and was (finally)
able to install it (after installing blas and gcc-fortran). I can start
an R session and do computations. When I try to do any graphics using
x11, I get the message:

unable to load shared library '/usr/lib/R/modules//R_X11.so':
/usr/lib/R/modules//R_X11.so: undefined symbol:
cairo_image_surface_get_data

Does anyone have an idea on how to fix this?

Rick B.

__
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] Using lme (nlme) to find the conditional variance of the random effects

2007-11-12 Thread Rick Bilonick
Using lmer in the lme4 package, you can compute the conditional
variance-covariance matrix of the random effects using the bVar slot:

bVar: A list of the diagonal inner blocks (upper triangles only) of the
positive-definite matrices on the diagonal of the inverse of ZtZ+Omega.
With the appropriate scale factor (and conversion to a symmetric matrix)
these are the conditional variance-covariance matrices of the random
effects.

Is there anything similar in the nlme package using the lme function?

Rick B.

__
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] Using lme (nlme) to find the conditional variance of therandom effects

2007-11-12 Thread Rick Bilonick
On Mon, 2007-11-12 at 16:45 -0500, Doran, Harold wrote:
 No, don't reach into the bVar slot. Use the proper extractor function
 ranef() with postVar=T. There is no similar function for lme() 
 
  -Original Message-
  From: [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of Rick Bilonick
  Sent: Monday, November 12, 2007 4:40 PM
  To: R Help
  Subject: [R] Using lme (nlme) to find the conditional 
  variance of therandom effects
  
  Using lmer in the lme4 package, you can compute the 
  conditional variance-covariance matrix of the random effects 
  using the bVar slot:
  
  bVar: A list of the diagonal inner blocks (upper triangles 
  only) of the positive-definite matrices on the diagonal of 
  the inverse of ZtZ+Omega.
  With the appropriate scale factor (and conversion to a 
  symmetric matrix) these are the conditional 
  variance-covariance matrices of the random effects.
  
  Is there anything similar in the nlme package using the lme function?
  
  Rick B.
  
  __


Is there some way to get ranef with postVar=TRUE to show what the
variances are, or what the lower and upper bounds are? qqmath makes nice
plots but I need to obtain the numerical values.

Rick B.

__
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] Using lme (nlme) to find the conditional variance of therandom effects

2007-11-12 Thread Rick Bilonick
On Tue, 2007-11-13 at 01:03 -0500, Rick Bilonick wrote:

 
 Is there some way to get ranef with postVar=TRUE to show what the
 variances are, or what the lower and upper bounds are? qqmath makes nice
 plots but I need to obtain the numerical values.
 
 Rick B.
 
I found a way:

attr(ranef(lmer.13,postVar=TRUE)[[2]],postVar)

But I still don't understand why it's not OK to access the bVar slot
directly. 

Also, the code I originally showed and the results from ranef are very
similar with a correlation of 0.9983 (it varies very slightly from
subject to subject):


round(data.frame(a=as.numeric([EMAIL 
PROTECTED](attr(VarCorr(lmer.13),sc)^2)[1]),
  b=as.numeric(attr(ranef(lmer.13,postVar=TRUE)[[2]],postVar))),10)
  ab
1  5.41e-08 5.44e-08
2  4.77e-08 4.83e-08
3  6.24e-08 6.25e-08
4  4.44e-08 4.52e-08
5  6.50e-08 6.50e-08
6  2.67e-08 2.92e-08
7  5.07e-08 5.12e-08
8  6.43e-08 6.43e-08
9  3.64e-08 3.79e-08
10 4.86e-08 4.92e-08
11 6.33e-08 6.33e-08
12 3.44e-08 3.60e-08
13 4.16e-08 4.26e-08
14 3.69e-08 3.83e-08
15 5.96e-08 5.97e-08
16 6.46e-08 6.46e-08
17 3.28e-08 3.46e-08
18 4.71e-08 4.77e-08
19 5.18e-08 5.22e-08
20 2.81e-08 3.04e-08
21 3.97e-08 4.09e-08
22 5.70e-08 5.72e-08
23 6.06e-08 6.07e-08
24 3.23e-08 3.42e-08
25 4.94e-08 4.99e-08
26 5.35e-08 5.38e-08
27 3.86e-08 3.98e-08
28 6.73e-08 6.73e-08
29 4.68e-08 4.74e-08
30 6.15e-08 6.16e-08
31 4.67e-08 4.74e-08
32 2.04e-08 2.37e-08
33 3.45e-08 3.61e-08
34 6.28e-08 6.29e-08
35 5.53e-08 5.55e-08

Not sure why they are not exactly the same.

Rick B.

__
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] Confidence Intervals for Random Effect BLUP's

2007-11-09 Thread Rick Bilonick
I want to compute confidence intervals for the random effect estimates
for each subject. From checking on postings, this is what I cobbled
together using Orthodont data.frame as an example. There was some
discussion of how to properly access lmer slots and bVar, but I'm not
sure I understood. Is the approach shown below correct?

Rick B.

# Orthodont is from nlme (can't have both nlme and lme4 loaded at same
time!)
# OrthoFem-Orthodont[Orthodont$Sex==Female,] 
# http://tolstoy.newcastle.edu.au/R/help/06/03/23758.html

library(lme4)
fm1OrthF. - lmer(distance~age+(age|Subject), data=OrthoFem)

lmer(distance~age+(age|Subject), data=OrthoFem)@bVar$Subject[2,2,]*
  (attr(VarCorr(lmer(distance~age+(age|
Subject),data=OrthoFem)),sc)^2)[1]
  
(attr(VarCorr(fm1OrthF.),sc)^2)[1]  
  
fm1.s - coef(fm1OrthF.)$Subject
fm1.s.var - [EMAIL PROTECTED](attr(VarCorr(fm1OrthF.),sc)^2)[1]
fm1.s0.s - sqrt(fm1.s.var[1,1,])
fm1.s0.a - sqrt(fm1.s.var[2,2,])
fm1.s[,1]+outer(fm1.s0.s, c(-2,0,2))
fm1.s[,2]+outer(fm1.s0.a, c(-2,0,2))

 fm1.s
(Intercept)   age
F1014.48493 0.3758608
F0917.26499 0.3529804
F0616.77328 0.3986699
F0116.95609 0.4041058
F0518.36188 0.3855955
F0717.28390 0.5193954
F0216.05461 0.6336191
F0819.40204 0.3562135
F0316.35720 0.6727714
F0419.02380 0.5258971
F1119.13726 0.6498911

 fm1.s[,1]+outer(fm1.s0.s, c(-2,0,2))
  [,1] [,2] [,3]
 [1,] 12.21371 14.48493 16.75616
 [2,] 14.99377 17.26499 19.53622
 [3,] 14.50205 16.77328 19.04450
 [4,] 14.68487 16.95609 19.22732
 [5,] 16.09066 18.36188 20.63311
 [6,] 15.01267 17.28390 19.55512
 [7,] 13.78339 16.05461 18.32584
 [8,] 17.13082 19.40204 21.67327
 [9,] 14.08598 16.35720 18.62843
[10,] 16.75257 19.02380 21.29502
[11,] 16.86604 19.13726 21.40849

 fm1.s[,2]+outer(fm1.s0.a, c(-2,0,2))
   [,1]  [,2]  [,3]
 [1,] 0.1738325 0.3758608 0.5778890
 [2,] 0.1509522 0.3529804 0.5550087
 [3,] 0.1966417 0.3986699 0.6006982
 [4,] 0.2020775 0.4041058 0.6061340
 [5,] 0.1835672 0.3855955 0.5876237
 [6,] 0.3173671 0.5193954 0.7214236
 [7,] 0.4315909 0.6336191 0.8356474
 [8,] 0.1541852 0.3562135 0.5582417
 [9,] 0.4707432 0.6727714 0.8747997
[10,] 0.3238688 0.5258971 0.7279253
[11,] 0.4478629 0.6498911 0.8519194

__
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] Confidence Intervals for Random Effect BLUP's

2007-11-09 Thread Rick Bilonick
On Fri, 2007-11-09 at 10:01 -0800, Bert Gunter wrote:
 Ummm...
 
 Define: Confidence interval for BLUP .
 
 I know what a confidence interval for a parameter or function of parameters
 (which is what a predicted value is) is; but a BLUP is neither, so I don't
 get what a confidence interval for it should mean.
 
 Feel free to reply off list, as this is clearly not an R question.
 
 
 Bert Gunter
 Genentech Nonclinical Statistics

Would you feel better with prediction interval? What I'm asking is how
to access the information from lmer to compute intervals for the BLUPS
that reflect the uncertainty in these estimates. The code I showed was
taken from someone who had the same question and the various replies.

Rick B.

__
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] Confidence Intervals for Random Effect BLUP's

2007-11-09 Thread Rick Bilonick
On Fri, 2007-11-09 at 18:55 +, Prof Brian Ripley wrote:

 I think Bert's point is important: I picked up a student on it in a case 
 study presentation on this week because I could think of three 
 interpretations, none strictly confidence intervals.  I think 'tolerance 
 interval' is fairly standard for prediction of a random quantity: see 
 ?predict.lm.
 

I think prediction interval is what is usually used. Regardless, I'm not
sure how predict.lm will be of much help because I asked specifically
about BLUP's for random effects and the last time I checked lm did not
handle mixed effects models. Neither predict.lme and predict.lmer
provide intervals. Here is the code that I included in my original
e-mail. My simple question is, will this code correctly compute a
prediction interval for each subjects random effect? In particular, will
the code handle the bVar slot correctly? Some postings warned about
inappropriate access to slots. Here is the code that I asked about in my
original e-mail:

# OrthoFem has all the females from Orthodont from the nlme package

library(lme4)
fm1OrthF. - lmer(distance~age+(age|Subject), data=OrthoFem)

lmer(distance~age+(age|Subject), data=OrthoFem)@bVar$Subject[2,2,]*
  (attr(VarCorr(lmer(distance~age+(age|
Subject),data=OrthoFem)),sc)^2)[1]
  
(attr(VarCorr(fm1OrthF.),sc)^2)[1]  
  
fm1.s - coef(fm1OrthF.)$Subject
fm1.s.var - [EMAIL PROTECTED](attr(VarCorr(fm1OrthF.),sc)^2)[1]
fm1.s0.s - sqrt(fm1.s.var[1,1,])
fm1.s0.a - sqrt(fm1.s.var[2,2,])
fm1.s[,1]+outer(fm1.s0.s, c(-2,0,2))
fm1.s[,2]+outer(fm1.s0.a, c(-2,0,2))

 fm1.s
(Intercept)   age
F1014.48493 0.3758608
F0917.26499 0.3529804
F0616.77328 0.3986699
F0116.95609 0.4041058
F0518.36188 0.3855955
F0717.28390 0.5193954
F0216.05461 0.6336191
F0819.40204 0.3562135
F0316.35720 0.6727714
F0419.02380 0.5258971
F1119.13726 0.6498911

 fm1.s[,1]+outer(fm1.s0.s, c(-2,0,2))
  [,1] [,2] [,3]
 [1,] 12.21371 14.48493 16.75616
 [2,] 14.99377 17.26499 19.53622
 [3,] 14.50205 16.77328 19.04450
 [4,] 14.68487 16.95609 19.22732
 [5,] 16.09066 18.36188 20.63311
 [6,] 15.01267 17.28390 19.55512
 [7,] 13.78339 16.05461 18.32584
 [8,] 17.13082 19.40204 21.67327
 [9,] 14.08598 16.35720 18.62843
[10,] 16.75257 19.02380 21.29502
[11,] 16.86604 19.13726 21.40849

 fm1.s[,2]+outer(fm1.s0.a, c(-2,0,2))
   [,1]  [,2]  [,3]
 [1,] 0.1738325 0.3758608 0.5778890
 [2,] 0.1509522 0.3529804 0.5550087
 [3,] 0.1966417 0.3986699 0.6006982
 [4,] 0.2020775 0.4041058 0.6061340
 [5,] 0.1835672 0.3855955 0.5876237
 [6,] 0.3173671 0.5193954 0.7214236
 [7,] 0.4315909 0.6336191 0.8356474
 [8,] 0.1541852 0.3562135 0.5582417
 [9,] 0.4707432 0.6727714 0.8747997
[10,] 0.3238688 0.5258971 0.7279253
[11,] 0.4478629 0.6498911 0.8519194


This web page describes bVar:

http://hosho.ees.hokudai.ac.jp/~kubo/Rdoc/library/lme4/html/lmer-class.html

bVar:
A list of the diagonal inner blocks (upper triangles only) of
the positive-definite matrices on the diagonal of the inverse of
ZtZ+Omega. With the appropriate scale factor (and conversion to
a symmetric matrix) these are the conditional
variance-covariance matrices of the random effects.

Rick B.

__
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] Executing a Function in a Loop With a Changing Value for an Argument

2007-10-24 Thread Rick Bilonick
I want to run a function in a loop and replace one of the arguments from
a large list each time through the loop. If I was writing it out
manually:

myfunc(x=var1)
myfunc(x=var2)
etc.

But I want to do this in a loop where x is replaced by a new name. 

Something like:

for(i in vars) { myfunc(x=i) }

where vars is a vector of names for items in a data.frame.

If I use as.symbol to create names, the evaluation never works
correctly. Is there a way to do this? Any suggestions would be
appreciated.

Rick B.

__
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] Cannot Install rimage

2007-10-02 Thread Rick Bilonick
I'm trying to install rimage in R version 2.5.1 running on Fedora 6
(kernel 2.6.22.7-57.fc6 with the headers and gcc installed, along with
fftw2 and libjpeg and headers):

 install.packages(rimage)
Warning in install.packages(rimage) : argument 'lib' is missing: using
'/usr/lib/R/library'
trying URL
'http://lib.stat.cmu.edu/R/CRAN/src/contrib/rimage_0.5-7.tar.gz'
Content type 'application/x-gzip' length 331029 bytes
opened URL
==
downloaded 323Kb

* Installing *source* package 'rimage' ...
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking for C++ compiler default output... configure: error: C++
compiler cannot create executables
See `config.log' for more details.
ERROR: configuration failed for package 'rimage'
** Removing '/usr/lib/R/library/rimage'

The downloaded packages are in
/tmp/RtmpGDx12u/downloaded_packages
Warning message:
installation of package 'rimage' had non-zero exit status in:
install.packages(rimage) 

I cannot find config.log that is mentioned. Can someone please tell me
what is missing from my configuration? rimage installed on another
system running Fedora 7 once I installed fftw2.

Rick B.

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