[R] glmulti wrapper for lmer does not produce results

2014-04-09 Thread anto.r
I posted this on SO, got no response. Sorry about cross-posting,
but atleast I would like to know if I am understading something totally 
wrong

I am using a `glmulti` wrapper for glmer (binomial) and the `summary` is:

`This is glmulti 1.0.7, Apr. 2013.
Length  Class   Mode
  0   NULL   NULL`

Following what has been done on this this thread, though this is for `lmer`,
http://stackoverflow.com/questions/12228418/glmulti-runs-indefinitely-when-using-genetic-algorithm-with-lme4,
 
I get the same result as above. Could it be that the versions have 
changed since and the wrapping has to be done differently? The following 
is the dummy code (lifted form the link above):

 xd = as.factor(round(runif(30),1))# dummy grouping factor
 yind = runif(30,0,10) # mock dependent variable
 ad = runif(30) # dummy covariate
 bd = runif(30) # another dummy covariate
 cd = runif(30) # an another one
 dd = runif(30)

 tmpdata - data.frame(xd=xd,yind=yind,ad=ad,bd=bd,cd=cd,dd=dd)

 lmer.glmulti - function (formula, data, random = , ...) {
 lmer(paste(deparse(formula), random), data = data, REML=F, ...)
 }

 summary(glmulti(formula = yind~ad*bd*cd*dd,
 data = tmpdata,
 random = '+(1|xd)',
 level = 2,
 method = 'h',
 crit = 'aic',
 marginality = TRUE,
 fitfunc = lmer.glmulti))

`lme4` version: 1.1.5

`glmulti` version: 1.0.7

R version 3.0.2 (2013-09-25)




--
View this message in context: 
http://r.789695.n4.nabble.com/glmulti-wrapper-for-lmer-does-not-produce-results-tp4688463.html
Sent from the R help mailing list archive at Nabble.com.
[[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.


Re: [R] Subsetting columns in data.table

2012-12-04 Thread anto.r
DT = data.frame(x=rep(c(a,b,c),each=3), y=c(1,3,6), v=1:9, w=3:11,
z=LETTERS[1:9]) 

If I understand you right, and you want to select all rows where v3 and
W10

with(DT, DT[which(v3  w10),])
  x y v w z
4 b 1 4 6 D
5 b 3 5 7 E
6 b 6 6 8 F
7 c 1 7 9 G

you can use colSums, rowSums  on this, but after removing the categorical
columns
Anto





--
View this message in context: 
http://r.789695.n4.nabble.com/Subsetting-columns-in-data-table-tp4652048p4652049.html
Sent from the R help mailing list archive at Nabble.com.

__
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] help with if statement

2012-12-04 Thread anto.r
DT-data.frame(time=c(0,1,5,24,36,48,72),DV=seq(0,60,10))
  time DV
10  0
21 10
35 20
4   48 30
5   84 40
6   96 50
7  120 60
You want to add 24 to values that are =24 in 'time'

DT[DT$time=24,'time']-DT[DT$time=24,'time']+24
  time DV
10  0
21 10
35 20
4   48 30
5   60 40
6   72 50
7   96 60

Is this what you were looking for?
A.




--
View this message in context: 
http://r.789695.n4.nabble.com/help-with-if-statement-tp4652015p4652055.html
Sent from the R help mailing list archive at Nabble.com.

__
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] convert multi dimensional array to list

2012-10-04 Thread anto.r
I have an 4D named array (the result of recast() on a dataframe) and would
like to convert it to a list with the names retained. 

Example:
my.df-expand.grid(name=c(Alf,Que), month=c(May,Jun),
year=c(2011,2012))
my.df$tmax-sample(15:20,4)
my.df$tmin-sample(10:15,4)
my.df.melt=melt(my.df)
my.df.cast=cast(my.df.melt, year~name~month~variable)

I want to convert it to a list so I can access the elements by name like 
my.df.cast$tmax$May 
to get the corresponding year-name matrix

This assuming, lists provide an easier way to handle this data. Does it?
Also, may be there is a way to get the list I want from my.df without going
through the melt and cast.  Any suggestions are welcome.

Thanks in advance
Anto

PS: I came across threads for converting list to array but not the other way
round. 



--
View this message in context: 
http://r.789695.n4.nabble.com/convert-multi-dimensional-array-to-list-tp4645011.html
Sent from the R help mailing list archive at Nabble.com.

__
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] convert multi dimensional array to list

2012-10-04 Thread anto.r
Hi Michael

thanks! That was the option if I kept it an array. The list format with $
sign since it leaves me feeling that the names are there and can be easily
accessed. Why would you rather not use the $ sign?

I use R-Studio and there names can be selected from a drop-down list, I have
found it easier but that could be my lack of proper training in R. 

Cheers
Anto








--
View this message in context: 
http://r.789695.n4.nabble.com/convert-multi-dimensional-array-to-list-tp4645011p4645036.html
Sent from the R help mailing list archive at Nabble.com.

__
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] subsample clustered data

2010-01-22 Thread anto.r

Hi all

I am pretty new to R and would like some help concerning subsampling my
data.
I have got locations of species presence that are clustered in some regions
of my study area. using this for habitat modelling produces overfitting the
denser areas. I would like to subsample the presence location. Ideally,
something like create a buffer zone around the points, then randomly select
only one of the points within if there is more than one inside the buffer.

Thanks in advance

anto


-- 
View this message in context: 
http://n4.nabble.com/subsample-clustered-data-tp1099964p1099964.html
Sent from the R help mailing list archive at Nabble.com.

__
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] selecting random points within a buffer

2010-01-22 Thread anto.r

helloo
let me try rephrase my previous post this way. I have a distribution of
points ( with cords) and I want to select only or two points that fall
within a buffer distance from each point. I guess there should be some way
to do this in R. Can someone help or suggest where I might find a solution?
Thanks
anto
-- 
View this message in context: 
http://n4.nabble.com/selecting-random-points-within-a-buffer-tp1100135p1100135.html
Sent from the R help mailing list archive at Nabble.com.

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