[R] GLMER Syntax Question

2011-09-28 Thread Ubuntu Diego
I was wondering is someone can explain me the differences between these (random 
slopes and intercept) models

model1 - glmer(output~A+B+C+(A+B+C | F) )

model2 - glmer(output~A+B+C+(A | F)+(B | F)+(C | F)


Thanks.

__
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] library REEMtree = Error in estRE[toString(uniqueID[i]), 1] : incorrect number of dimensions

2011-08-24 Thread Ubuntu Diego
Hi List,

I'm having this problem when trying to use the PREDICT function.


Here is a way to reproduce the error

library(REEMtree)
data(simpleREEMdata)
REEMresult-REEMtree(Y~D+t+X, data=simpleREEMdata, random=~1|ID/D)
predict(REEMresult, simpleREEMdata, id = simpleREEMdata$ID/simpleREEMdata$D, 
EstimateRandomEffects=TRUE)


As far as I understand the problem is that I'm not being able to specify 
correctly the number of groups created in the random structure of the model 
(~1|ID/D). 

Does anybody knows how to FIX this ?

__
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] is there a way/library for generating colorful noise in R ??

2011-04-29 Thread Ubuntu Diego
I would like to generate some noisy time series. I know that it is possible to 
classify noise by looking at the exponent (beta) of the relationship between 
the spectrum of the time series and the frequencies (i.e. spectrum ~ frequency 
^ beta ).  
Is there a way to generate White (beta=0), Pink (beta=-1), Brown (Beta=-2), 
Blue(beta=1) and Violet (beta=2) noise in R ?.

Thanks.

__
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] is this an ANOVA ?

2011-04-12 Thread Ubuntu Diego
Hi all,
I have a very easy questions (I hope). I had measure a property of 
plants, growing in three different substrates (A, B and C). The rest of the 
conditions remained constant. There was very high variation on the results. 
I want to do address, whether there is any difference in the response 
(my measurement) from substrate to substrate?

x-c('A','A','A','A','A','B','B','B','B','B','C','C','C','C','C') # Substrate 
type
y - c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) # Results of the measurement
MD-data.frame(x,y)

I wrote a linear model for this:

summary(lm(y~x,data=MD))

This is the output:

Call:
lm(formula = y ~ x, data = MD)

Residuals:
   Min 1Q Median 3QMax 
-2.000e+00 -1.000e+00  5.551e-17  1.000e+00  2.000e+00 

Coefficients:
Estimate Std. Error t value Pr(|t|)
(Intercept)   3. 0.7071   4.243 0.001142 ** 
xB5. 1.   5.000 0.000309 ***
xC   10. 1.  10.000 3.58e-07 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Residual standard error: 1.581 on 12 degrees of freedom
Multiple R-squared: 0.8929, Adjusted R-squared: 0.875 
F-statistic:50 on 2 and 12 DF,  p-value: 1.513e-06 

I conclude that there is an effect of substrate type (x). 
NOW the questions :
1) Do the fact that the all p-values are significant means that 
all the groups are different from each other ?
2) Is there a (easy) way to plot,  mean plus/minus 2*sd for 
each substrate type ? (with asterisks denoting significant differences ?)


THANKS !

version
platform   x86_64-apple-darwin9.8.0 
arch   x86_64   
os darwin9.8.0  
system x86_64, darwin9.8.0  
status  
major  2
minor  11.1 
year   2010 
month  05   
day31   
svn rev52157
language   R
version.string R version 2.11.1 (2010-05-31)

__
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] LMER: How to specify Random Effects

2009-12-01 Thread Ubuntu Diego
I saw different specifications for Random Effects and I'm confused about 
the use of / and  the use of (0+...|) .
Let say we have a nested structure where some countries have some 
several plants in different states and we measure the reaction to a drug.


The list of Countries = USA, France, Italy
The States for USA = Michigan, Florida, California
The States for France =  Paris, Orleans
The States for Italy =  Venezia, Sienna, Florence, Rome, Napoli , Sicilia

Plants were classified as High and Low

is this the way to specify a possible model ?

lmer(Reaction ~ Drug + (1| Country / State / Plant) , data)

or should I use something like this
A) lmer(Reaction ~ Drug + (0| Country / State / Plant) , data)
B) lmer(Reaction ~ Drug + (1| Country ) + (0+Country | State / Plant) , 
data)
C) lmer(Reaction ~ Drug + (1| Country ) + (0+Country | State / Plant) + 
(0+Country + State | Plant), data)
D) lmer(Reaction ~ Drug + (1| Country ) + (0+Country | State ) + 
(0+Country + State | Plant), data)


Thanks

__
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] LMER: How to specify Random Effects

2009-12-01 Thread Ubuntu Diego

Thanks for your feedback.
Actually Plant is nested since High and Low are qualitative relative 
values (High in Michigan is not the same as High in Sienna).



S Ellison wrote:

The Plant classification is not nested; it's an effect across all
countires and states and probably a fixed effct (assuming you want to
measure its size or significance). But the state is nested in country.

That would suggest to me 
lmer(Reaction~Drug+Plant+(1|Country/State),...)


(or Plant*Drug, if you want an interaction)

However, though your states are nested in countrythey are readily
identifiable by lmer as different for each country (you do not have
country1: State1, State2..., Country2:State1,State2..) so the nesting by
country probably doesn't need to be specified. I think the above would,
_in this case_ be almost identical to 


lmer(Reaction~Drug+Plant+(1|Country)+(1|State),...)





  

Ubuntu Diego ubuntu.di...@gmail.com 01/12/2009 16:22:09 


I saw different specifications for Random Effects and I'm confused
about 
the use of / and  the use of (0+...|) .
Let say we have a nested structure where some countries have some 
several plants in different states and we measure the reaction to a

drug.

The list of Countries = USA, France, Italy
The States for USA = Michigan, Florida, California
The States for France =  Paris, Orleans
The States for Italy =  Venezia, Sienna, Florence, Rome, Napoli ,
Sicilia

Plants were classified as High and Low

is this the way to specify a possible model ?

lmer(Reaction ~ Drug + (1| Country / State / Plant) , data)

or should I use something like this
A) lmer(Reaction ~ Drug + (0| Country / State / Plant) , data)
B) lmer(Reaction ~ Drug + (1| Country ) + (0+Country | State / Plant) ,

data)
C) lmer(Reaction ~ Drug + (1| Country ) + (0+Country | State / Plant) +

(0+Country + State | Plant), data)
D) lmer(Reaction ~ Drug + (1| Country ) + (0+Country | State ) + 
(0+Country + State | Plant), data)


Thanks

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


***
This email and any attachments are confidential. Any u...{{dropped:9}}


__
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] SNOW: Error in socketSelect(socklist) : not a socket connection

2009-04-01 Thread Ubuntu Diego
I'm trying to use snow in my dual-core (hopefully later this is going to
run in a cluster). So, at this moment I create a cluster using SOCK
connection (MPI in the future). However when I try to use
clusterApplyLB I got Error in socketSelect(socklist) : not a socket
connection. Any ideas ? Do you know if that is going to be an isuue too
when I swith from SOCK to MPI ?

Sample code is attached.

Thanks.



# TODO: Add comment
# 
# Author: diego
###


rm(list=ls())
library(snow)
t1-Sys.time()



rates-c(0.5,0.5,0.7)
initialState-c(0,0,0,0,0)
AllEvents-c(1,1,1,1,2,2,2,3,1,2)
AllLocations-c(1,2,3,4,1,4,2,1,5,4)
AllTimes-1:10
AllConfigurations-rbind(
c(0,0,0,0,0),
c(1,0,0,0,0),
c(1,1,0,0,0),
c(1,1,1,0,0),
c(1,1,1,1,0),
c(2,1,1,1,0),
c(2,1,1,2,0),
c(2,2,1,2,0),
c(0,2,1,2,0),
c(0,2,1,2,1),
c(0,2,1,0,1)
)

nevents-length(AllEvents)

clusterSize-2
cl-makeCluster(clusterSize,type=SOCK)

arguments-vector(list,nevents)

completedTimes-c(0,AllTimes)
for(i in 1:nevents){
element-c(AllConfigurations[i,],
rates,
completedTimes[i],
AllEvents[i],
AllLocations[i],
AllTimes[i])
arguments[[i]]-element
}

source(GetLogLikelihood.R)
parallelOutputs-clusterApplyLB(cl,arguments,GetLogLikelihood)  # This give me 
error
#parallelOutputs-clusterApply(cl,arguments,GetLogLikelihood) # This Work OK

print(sum(unlist(parallelOutputs)))

stopCluster(cl)
t2-Sys.time()
print(t2-t1)
__
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] Snow Parallel R: makeCluster with more nodes than available

2009-03-26 Thread Ubuntu Diego
Hi all,
I would like to know what would happen if using snow I create a cluster
of size 50, for example using makeCluster(50,type='SOCK') on a machine
with 2 Cores and run a function. Does snow run 25 and 25 functions on
each of my 2 real processors or it just run 50 functions in one
processor ?
Thanks.

__
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] Memory issue?

2009-01-28 Thread Ubuntu Diego
I had similar issues with memory occupancy. You should explicitly call
gc() to call the garbage collector (free memory routine) after you do
rm() of the big objects. 

D.

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