Ben Bolker | 1 Jul 2008 02:14
Picon

Re: Coda not providing summary on mcmc object

smith_cc <smith_cc <at> yahoo.com> writes:

> 
> 
> The object is a mcmc sample from lmer. I am using R v2.7.1. Please let me
> know what additional information I can provide, hopefully I am just making a
> simple mistake. Thanks in advance!
> 
> > data(ratdrink, package = 'faraway')
> > rd.er <- lmer(wt ~ weeks*treat + (1 | subject), data = ratdrink)
> > rd.mc <- mcmcsamp(rd.er, 10000)
> > library(coda)
> Loading required package: lattice
> > summary(rd.mc)
>  Length   Class    Mode 
>       1 merMCMC      S4 
> > HPDinterval(rd.mc)
> Error in UseMethod("HPDinterval") : 
>   no applicable method for "HPDinterval"

   I don't think it should necessarily have been obvious,
but help("merMCMC-class") suggests that lme4 contains
its own methods for doing HPDinterval calcs.  Furthermore,
loading coda after lme4 gives the following warning

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

	 HPDinterval 

If you really want HPDintervals from coda, it looks like
(Continue reading)

Jason Lee | 1 Jul 2008 02:54
Picon

Help in using PCR

Hi,

Currently I have a dataset of 2400*408. And I would like to apply PCR method
to study the any correlation between the tests.
My current data is in data.frame and I have formed horizontal(1-407) to be
the exact data, and (408) to be my results data(Yes and No)
I have also binarized these Yes and No to 1 and -1s.

However, when I refer to PCR manual on R, the example of  yarn.pcr <-
pcr(density ~ NIR, 6, data = yarn, validation = "CV"), I
am not sure how can I adapt the command based line to my sample dataset.

It seems that they label each horizontal (columns) as NIR and followed by
Density (which is my results data).  My doubt is
do I have to label these data at the first place? If not, what
variables/command that I should put in place of density?

 cancerv1.pcr<-pcr(cancerv1[,1-407],6,data=cancerv1,validation="CV")?

Please advise. Thanks.

	[[alternative HTML version deleted]]

______________________________________________
R-help <at> 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.

(Continue reading)

Peng Jiang | 1 Jul 2008 03:15
Picon

Re: Mclust ???

Hi ,Ping .

There ARE two components using the iris[,-5] data.
The Mclust method is using the BIC value to obtain the optimal number of
components of the model, and the result is two.

Try to use Mc$parameters to see the parameters for each component.
I suggest u to read the help document seriously.

best regards.

On 2008-6-30, at 下午8:40, 王春萍 wrote:

> hello everyone
>  I have used the function Mclust, and i found the result(the  
> component $z) is
> just two class, why?
>
> Mc <- Mclust(iris[,-5])
> Mc$z
> ....
> ....
>
> thanks
>
> wangchunping
>
> ______________________________________________
> R-help <at> r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
(Continue reading)

Tanya Yatsunenko | 1 Jul 2008 04:08
Picon

PCA : Error in eigen(cv,

Hi all,

I am doing bootstrap on a distance matrix, in which samples have been 
drawn with replacement. After that I do PCA on a resulted matrix, and 
these 2 steps are repeated 1000 times.

pca(x) is a vector where I wanted to store all 1000 PCAs; and x is from 
1 to 1000
SampleD is a new matrix after resampling;

I am getting the following error message, which I don't understand:
....
+pca(x)<-princomp(SampleD[i,j])
+ }
Error in eigen(cv, symmetric = TRUE) : infinite or missing values in 'x'

Should I maybe not use a vector, but matrix instead?
Thanks!

--

-- 
Tanya.

	[[alternative HTML version deleted]]

______________________________________________
R-help <at> 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.

(Continue reading)

Rolf Turner | 1 Jul 2008 05:44
Picon
Picon
Favicon

Messge ``no visible binding''.


I have written a function make.fun(), which I keep in my personal
``miscellaneous'' package.  It searches the current working directory
for files named ``*.R'' and sources them if their modification date
is later than the date stored in ``.Last.make.date''.  (The variable
.Last.make.date then gets updated.)  The function checks whether
.Last.make.date exists before comparing its value with the modification
dates of the *.R files.

When I do R CMD check on my ``miscellaneous'' package, I get a ``NOTE''
(not even a warning!) to the effect:

	``no visible binding for global variable '.Last.make.date'

Is this something that I should worry about at all?  Am I running any
risk by this procedure? Is there a better way to check whether code file
have modified sufficiently recently that they need to be re-sourced?

Thanks for any tips.  (But no asparagus, please! :-) )

	cheers,

		Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

______________________________________________
R-help <at> r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
(Continue reading)

Daniel Malter | 1 Jul 2008 05:46
Picon
Favicon

Re: PCA : Error in eigen(cv,

Hi, yes a loop would work. Maybe there are other options also. Bootstrapping
a PCA with a loop can be done as follows. You will have to adjust the
dimension of the matrices/array according to the dimensions of your data and
according to the values that you want to retrieve from your PCA.

####Start of example

##Iris data
data=iris

##Inspect data
data

##Perform pca on columns 1:4
x=prcomp(data[,1:4])

##Inspect results of pca
summary(x)
summary(x)$importance

trials=10 ##we want 10 bootstraps

##We want to bootstrap pca
##and, say, know some information
##contained in "summary(x)$importance"
##Thus, we create an array that has the
##dimension of "summary(x)$importance"
##and depth of "trials"
importance=array(0,c(3,4,trials))

(Continue reading)

Gavin Simpson | 1 Jul 2008 09:03
Picon
Picon
Favicon

Re: Help in using PCR

On Tue, 2008-07-01 at 10:54 +1000, Jason Lee wrote:
> Hi,
> 
> Currently I have a dataset of 2400*408. And I would like to apply PCR method
> to study the any correlation between the tests.
> My current data is in data.frame and I have formed horizontal(1-407) to be
> the exact data, and (408) to be my results data(Yes and No)
> I have also binarized these Yes and No to 1 and -1s.
> 
> However, when I refer to PCR manual on R, the example of  yarn.pcr <-
> pcr(density ~ NIR, 6, data = yarn, validation = "CV"), I
> am not sure how can I adapt the command based line to my sample dataset.
> 

In the yarn data set, NIR is a matrix with columns representing near
infra-red spectra at 268 wavelengths (i.e. variables) on 28 yarns (the
samples, 7 of which are a test set). Take a look at:

str(yarn)

class(yarn$NIR)

A matrix is allowed on the rhs of a model formula which is why this
works.

This is a reasonably standard model formula in R, something that you'll
come across more and more if you use R for a short amount of time. These
formulae are a symbolic way of describing the model in the form:

response ~ rhs
(Continue reading)

jgarcia | 1 Jul 2008 09:40
Picon

extracting elements from a list in vectorized form

Hi;
It seems to me that has probably been asked in the past. But I cannot find
the track.

I usually need to extract elements from a list and contruct vector from
them; e.g., to create a table. Perhaps there is a way to directly extract
them without looping?
Simple example:

> S.lst
$sublist.1
$sublist.1$age
[1] 24.58719

$sublist.1$weight
[1] 60.82861

$sublist.2
$sublist.2$age
[1] 32.39551

$sublist.2$weight
[1] 59.46347

etc.

I would like to extract, e.g.,  directly all weights element from each
sublist without looping. I  know it is possible to do this as:

unlist(S.lst)[paste("sublist.",1:length(S.lst),".weight",sep="")]
(Continue reading)

Peter Dalgaard | 1 Jul 2008 09:41
Picon
Favicon

Re: extracting elements from a list in vectorized form

jgarcia <at> ija.csic.es wrote:
> Hi;
> It seems to me that has probably been asked in the past. But I cannot find
> the track.
>
> I usually need to extract elements from a list and contruct vector from
> them; e.g., to create a table. Perhaps there is a way to directly extract
> them without looping?
> Simple example:
>
>   
>> S.lst
>>     
> $sublist.1
> $sublist.1$age
> [1] 24.58719
>
> $sublist.1$weight
> [1] 60.82861
>
>
> $sublist.2
> $sublist.2$age
> [1] 32.39551
>
> $sublist.2$weight
> [1] 59.46347
>
> etc.
>
(Continue reading)

jgarcia | 1 Jul 2008 09:57
Picon

Re: extracting elements from a list in vectorized form

Perfect!!
Thanks a lot!
Javier
-------
> jgarcia <at> ija.csic.es wrote:
>> Hi;
>> It seems to me that has probably been asked in the past. But I cannot
>> find
>> the track.
>>
>> I usually need to extract elements from a list and contruct vector from
>> them; e.g., to create a table. Perhaps there is a way to directly
>> extract
>> them without looping?
>> Simple example:
>>
>>
>>> S.lst
>>>
>> $sublist.1
>> $sublist.1$age
>> [1] 24.58719
>>
>> $sublist.1$weight
>> [1] 60.82861
>>
>>
>> $sublist.2
>> $sublist.2$age
>> [1] 32.39551
(Continue reading)


Gmane