Displaying 4 results from an estimated 4 matches for "newtree".
Did you mean:
newbee
2009 Feb 08
5
glmmBUGS: logistic regression on proportional data
...cify the model correctly.
I am trying to specify the response variable, /yseed/, as # of successes
out of total observations... but I suspect that given the error below,
that is not correct. Also, Newsect should be a factor, whereas Newdist
is continuous.
Thanks,
John
Newdat<-data.frame(Newtree=rep(1:3, each=20), Newsect=rep(c("a","b"),
each=10), Newdist=rep(1:5, 2),
y=rpois(60,2), tot=rep(c(14,12,10,8,6), 12))
yseed<-cbind(Newdat$y, Newdat$tot)
mod<-glmmBUGS(yseed~Newsect + Newdist, effects="Newtree",
family="binomial",...
2008 Mar 12
0
R code for kernel density using kd-tree, looking for speed up
...it
sqrt(sum(temp*temp))/2
}
########################################
Kconst = function(d, n, bw)
{
con = gamma(d/2+1)/pi^(d/2);
con = con/( (2-2*d)/(d+2) + 2*d*(d+7)/(d+4)/(d+6));
con/n/bw^d;
}
###################################################################
## create an empty node
newtree = function(){ list(center=NULL, diameter=NULL, left=NULL, right=NULL) }
####################################################################################
## add a node to the kdtree
addNode = function(tree, points)
{
numOfPoints = ncol(points);
if(numOfPoints==1)
{
tree$center =...
2010 Oct 05
1
binary tree construction in R
Hi all,
I'm very new to R and I'm trying to construct a threaded binary tree using
recursive functions.
I'm very confused was wondering if anyone had any R sample code they would
share. I've come across a lot of C++ code(nothing in R) and this is not
helping.
best,
MK
--
View this message in context:
2011 Aug 19
1
gsub for numeric characters in string
...with a name (because there are
internal nodes in the tree structure).
> tree
[1] "(*1*:328,((*5*:154,*2*:135):147,(*3*:30,*4*:50):252):45);"
I would like to replace the length with the lengthplusstate in the tree,
while removing the names, so that it looks like this:
> theoreticalnewtree
[1] "(*1*:328,((*1*:154,*4*:135)NA:147,(*3*:30,*2*:50)NA:252)NA:45);"
I am using this code:
> for (j in all)
newtree <- gsub(ln[j], lnplusstate[j], tree)
However, I end up with this:
> newtree
[1] "(*11*:328,((*51*:154,*24*:135)NA:147,(*33*:30,*42*:50)NA:252...