[R] graph: add 2 inches on the left outer region, but keep everything unchanged

2014-04-17 Thread Xing Zhao
Hi R experts, My original graph was plotted, and for some reason, I need to add extra '2' inches on the left side. Meanwhile, I want to keep everything unchanged. Particularly, the length-width ratio for each panel of the original graph is nice, therefore I want to keep the original ratio Adding

Re: [R] The explanation of ns() with df =2

2014-04-16 Thread Xing Zhao
- > John Fox > McMaster University > Hamilton, Ontario, Canada > http://socserv.socsci.mcmaster.ca/jfox > >> On Apr 16, 2014, at 12:10 AM, Xing Zhao wrote: >> >> Dear John >> >> Sorry I use 3 degree of freedom for cubi

Re: [R] The explanation of ns() with df =2

2014-04-15 Thread Xing Zhao
due to the linearity constraint) - 1 (similar for the left) = 3, not 2 Thanks Xing On Tue, Apr 15, 2014 at 10:54 AM, John Fox wrote: > Dear Xing, > >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- >> project.org] On Behalf Of Xi

Re: [R] The explanation of ns() with df =2

2014-04-15 Thread Xing Zhao
the linearity constraint) - 1 (similar for the left) = 1, not 2 Where is the problem? Best, Xing On Tue, Apr 15, 2014 at 6:17 AM, John Fox wrote: > Dear Xing Zhao, > > To elaborate slightly on Michael's comments, a natural cubic spline with 2 df > has one *interior* knot and t

[R] The explanation of ns() with df =2

2014-04-15 Thread Xing Zhao
Dear all I understand the definition of Natural Cubic Splines are those with linear constraints on the end points. However, it is hard to think about how this can be implement when df=2. df=2 implies there is just one knot, which, according the the definition, the curves on its left and its right

[R] mgcv, should include a intercept for the 'by' varying coefficient model, which is unconstrained

2014-03-17 Thread Xing Zhao
Dear Dr. Wood and other mgcv experts In ?gam.models, it says that the numeric "by" variable is genrally not subjected to an identifiability constraint, and I used the example in ?gam.models, finding some differences (code below). I think the the problem might become serious when several varying

[R] How to know the what functions have used datasets in loaded packages.

2014-03-10 Thread Xing Zhao
Hi all, Once you start your R program, there are example data sets available within R along with loaded packages. Command data() will list all the datasets in loaded packages. Is there a method to know what R functions have used one of the datasets to present the function's utility, maybe at leas

[R] Safe prediction does not work for bivariate polynomial terms?

2014-01-23 Thread Xing Zhao
Hi everyone, R documents says the safe prediction is implemented, when basis functions are used, such as poly(), bs(), ns() This works for univariate basis, but fails in my bivariate polynomial setting. Can anyone explain the reason? The following is a small example. set.seed(731) x<-runif(300

[R] lm(y ~ group/x ) + predict.lm(...,type="terms")

2014-01-18 Thread Xing Zhao
Hi, all I am trying to figure out the computation result for predict.lm(...,type="terms") when the original fitting model has a nesting term, lm(y ~ group/x ). A example, > set.seed(731) > group <- factor(rep(1:2, 200)) > x <- rnorm(400) > > fun1 <- function(x) -3*x+8 > fun2 <- function(x) 15*x

[R] lm(y ~ group/x ) + predict.lm(...,type="terms")

2014-01-18 Thread Xing Zhao
Hi, all I am trying to figure out the computation result for predict.lm(...,type="terms") when the original fitting model has a nesting term, lm(y ~ group/x ). A example, > set.seed(731) > group <- factor(rep(1:2, 200)) > x <- rnorm(400) > > fun1 <- function(x) -3*x+8 > fun2 <- function(x) 15*x

[R] lm(y ~ group/x ) + predict.lm(...,type="terms")

2014-01-18 Thread Xing Zhao
Hi, all I am trying to figure out the computation result for predict.lm(...,type="terms") when the original fitting model has a nesting term, lm(y ~ group/x ). A example, > set.seed(731) > group <- factor(rep(1:2, 200)) > x <- rnorm(400) > > fun1 <- function(x) -3*x+8 > fun2 <- function(x) 15*x