[R] Opportunities for Developing R Packages (Research-Based, Open-Source)

2019-04-22 Thread Justin Thong
Dear R package community, I am uncertain whether this is appropriate for this mailing list. Please let me know. If not, would you be so kind as to point me in a better direction? I am a mathematics major with a well-developed R experience. I have graduated two years ago and have been working in b

[R] igraph problem

2017-09-19 Thread Justin Thong
Run this code tree<-graph_from_literal(1-+2:3,3-+5,1-+4); graph.bfs(tree,root=1, neimode="out",father=TRUE,order=TRUE,unreachable = FALSE) I do not understand why the father values will give NA 1 1 3 1 rather than NA 1 1 1 3 The reason I am doing this is to obtain the values(by vertex names) or

[R] rmutil parameters for Pareto distribution

2017-08-24 Thread Justin Thong
In https://en.wikipedia.org/wiki/Pareto_distribution, it is clear what the parameters are for the pareto distribution: *xmin *the scale parameter and *a* the shape parameter. I am using rmutil to generate random deviates from a pareto distribution. It says in the documentation that the probabilty

[R] Kernel Density Estimation: Generate a sample from Epanechnikov Kernel

2017-03-21 Thread Justin Thong
Below are samples from a kernel density estimated "data" with gaussian kernel. I really like this solution of estimation of a kernel because it is nice and elegant. fit<-density(data) rnorm(N, sample(data, size = N, replace = TRUE), fit$bw) #samples from kernel density estimation I am however in

Re: [R] Estimated Effects Not Balanced

2016-08-23 Thread Justin Thong
data.frame(A=factor(c(1,1,1,1,1,1,2,2,2,2,2,2)), > > + B=factor(c(1,1,2,2,3,3,1,1,2,2,3,3)), > > + y=rnorm(12)) > >> mod <- aov(y ~ A+B, data=tmp) > >> summary(mod) > > Df Sum Sq Mean Sq F value Pr(>F) > > A1 1.553 1.553 1.

[R] Estimated Effects Not Balanced

2016-08-22 Thread Justin Thong
Something does not make sense in R. It has to do with the question of balance and unbalance. *A<-factor(c(1,1,1,1,1,1,2,2,2,2,2,2))* *B<-factor(c(1,1,2,2,3,3,1,1,2,2,3,3))* *y<-rnorm(12)* *mod<-aov(y~A+B)* I was under the impression that the design is balanced ie order does not effect the sums of

[R] Intercept in Model Matrix (Parameters not what I expected)

2016-08-21 Thread Justin Thong
I have something which has been bugging me and I have even asked this on cross validated but I did not get a response. Let's construct a simple example. Below is the code. A<-gl(2,4) #factor of 2 levels B<-gl(4,2) #factor of 4 levels df<-data.frame(y,A,B) As you can see, B is nested within A. Th

[R] What is "args" in this function?

2016-08-02 Thread Justin Thong
Hi again I need help *R-code* debug(model.matrix) model.matrix(~S) *model.matrix code* ans <- .External2(C_modelmatrix, t, data) #t =terms(object) , data="data frame of object" *modelframe C-code* SEXP modelframe(SEXP call, SEXP op, SEXP args, SEXP rho) { SEXP terms, data, names, variables,

[R] Ways to understand C code (like debug function)

2016-08-01 Thread Justin Thong
Hi I need some advice. Note: I do not know anything from C apart from my 2 days of research. I am currently trying to make meaning of the modelmatrix function (written in C) and called from R function model.matrix() via .External2. In trying to view the source code (in R) for model.matrix(), I h

Re: [R] Reference for aov()

2016-07-27 Thread Justin Thong
o > error strata becomes nonsensical otherwise. If you do have a balanced > design, the error strata reduce to simple combinations of means and > observation, so the aov() algorithm is quite inefficient, but to my > knowledge nobody has bothered to try and do better. > > -pd > > &

[R] Linear Dependance of Model Matrix and How Fitted/ Sums of Squares Follow

2016-07-26 Thread Justin Thong
Below is the covariates for a model ~x1+x2+x3+x4+x5+x6. I noticed that when fitting this model that the coefficient x6 is unestimable.*Is this merely a case that adding more columns to my model matrix will eventually lead to linear dependance so the more terms I have in the model formulae the more

[R] Soft Question: Where to find this reference.

2016-07-25 Thread Justin Thong
I notice a lot of r documentation refer to this reference below. I can't seem to find it anywhere. Does anyone have a link to point to where I can either view it or buy it? *Chambers, J. M., Freeny, A and Heiberger, R. M. (1992) Analysis of variance; designed experiments* -- Yours sincerely, Ju

Re: [R] Missing rows anova

2016-07-20 Thread Justin Thong
. Does this makes sense? On 19 July 2016 at 16:19, Michael Dewey wrote: > Presumably it disappears because there is a unique value of ID for eac > combination of S*x1 so they are indistinguishable. > > > On 19/07/2016 12:53, Justin Thong wrote: > >> Why does the S:

[R] Missing rows anova

2016-07-19 Thread Justin Thong
Why does the S:x1 column disappear (presumably S:x1 goes into ID but I dont know why)? S is a factor, x1 is a covariate and ID is a factor. rich.side<-aov(y~S*x1+ID) summary(rich.side) Below is the model frame model.frame(~S*x1+ID) S x1 ID 1 1 12 A 2 1 12 A

[R] Reference for aov()

2016-07-13 Thread Justin Thong
Hi *I have been looking for a reference to explain how R uses the aov command(at a deeper level)*. More specifically, how R reads the formulae and R computes the sums of squares. I am not interested in understanding what the difference of Type 1,2,3 sum of squares are. I am more interested in find