Displaying 20 results from an estimated 11000 matches similar to: "plotting additive ns components"
2010 Dec 14
2
Use generalised additive model to plot curve
Readers,
I have been reading 'the r book' by Crawley and think that the
generalised additive model is appropriate for this problem. The
package 'gam' was installed using the command (as root)
install.package("gam")
...
library(gam)
> library(gam)
Loading required package: splines
Loading required package: akima
> library(mgcv)
This is mgcv 1.3-25
Attaching
2007 Apr 03
3
Testing additive nonparametric model
I have estimated a multiple nonparametric regression using the loess
command in R. I have also estimated an additive version of the model using
the gam function. Is there a way of using the output of these two models to
test the restrictions imposed by the additive model?
2004 Apr 05
1
GAM with Locfit components
Hi,
I?m trying to combine the Locfit Package with the Mgcv package (to use
Generalized Additive Models with Locfit components). I read the book
written by Clive Loader where it?s said that, for the S language, you just
have to "load" the locfit package using the command :
Library(locfit, first="T")
in order to use locfit components in an additive model.
But I can?t. I guess
2012 Jun 05
1
Do YOU know an equation for splines (ns)?
Hi,
I am looking at the change in N concentration in plant roots over 4 time
points and I have fit a spline to the data using ns and lme:
fit10 <- lme( N~ns(day, 3), data = rcn10G)
I may want to adjust the model a little bit, but for now, let's assume it's
good. I get output for the fixed effects:
Fixed: N ~ ns(day, 3)
(Intercept) ns(day, 3)1 ns(day, 3)2 ns(day, 3)3
2017 May 29
2
stats::line() does not produce correct Tukey line when n mod 6 is 2 or 3
Tukey divides the points into three groups, not the x and y values
separately.
I'll try to get hold of the book for a direct quote, might take a couple of
days.
On Mon, May 29, 2017 at 8:40 AM, Duncan Murdoch <murdoch.duncan at gmail.com>
wrote:
> On 27/05/2017 9:28 PM, GlenB wrote:
>
>> Bug: stats::line() does not produce correct Tukey line when n mod 6 is 2
>> or
2017 May 29
2
stats::line() does not produce correct Tukey line when n mod 6 is 2 or 3
A usually trustworthy R correspondent posted a pure R implementation on SO at some point in his lost youth:
https://stackoverflow.com/questions/3224731/john-tukey-median-median-or-resistant-line-statistical-test-for-r-and-line
This one does indeed generate the line of identity for the (1:9, 1:9) case, so I do suspect that we have a genuine scr*wup in line().
Notice, incidentally, that
>
2006 Feb 27
3
how to use the basis matrix of "ns" in R? really confused by multi-dim spline filtering?
Hi all,
Could anybody recommend some easy-to-understand and example based
notes/tutorials on how to use cubic splines to do filtering on
multi-dimension data?
I am confused by the 1-dimensional case, and more confused by
multi-dimensional case.
I found all the books suddenly become very abstract when it comes to this
subject.
They don't provide examples in R or Splus at all.
Specifically,
2006 Sep 01
1
difference between ns and bs in predict.glm
I am fittling a spline to a variable in a regression model, I am then using
the predict.glm funtion to make some predictions. When I use bs to fit the
spline I don't have any problems using the predict.glm function however when
I use ns I get the following error:
Error in model.frame(formula, rownames, variables, varnames, extras,
extranames, :
variable lengths differ (found for
2011 Sep 06
1
Question about Natural Splines (ns function)
Hi - How can I 'manually' reproduce the results in 'pred1' below? My attempt
is pred_manual, but is not correct. Any help is much appreciated.
library(splines)
set.seed(12345)
y <- rgamma(1000, shape =0.5)
age <- rnorm(1000, 45, 10)
glm1 <- glm(y ~ ns(age, 4), family=Gamma(link=log))
dd <- data.frame(age = 16:80)
mm <- model.matrix( ~ ns(dd$age, 4))
pred1 <-
2012 Dec 06
1
scope, lme, ns, nlme, splines
I want to fit a series of lme() regression models that differ only in the
degrees of freedom of a ns() spline. I want to use a wrapper function to do
this. The models will be of the form
y ~ ns(x, df=splineDF)
where splineDF is passed as an argument to a wrapper function.
This works fine if the regression function is lm(). But with lme(),
I get an error. fitfunction() below demonstrates this.
2017 May 29
3
stats::line() does not produce correct Tukey line when n mod 6 is 2 or 3
Here is an attached patch.
Best,
Serguei.
Le 29/05/2017 ? 12:21, Serguei Sokol a ?crit :
> The problem or actual R implementation relies on an assumption
> that median(x[i] | x[i] <= quantile(x, 1/3)) == quantile(x, 1/6)
> which reveals not to be true despite very trustful appearance.
>
> If we continue with the example of x=y=1:9
> then quantile(x, 1/6)=2.5 (here quantile()
2004 Jan 21
1
Problem with lme, ns and df (variable scoping problem?)
Hi,
I'm experimenting with random effect natural splines, and I've
encountered an odd problem.
library(nlme); library(splines)
a <- data.frame(x = 1:10, y = 1:10 + runif(10, min=-3, max=3), c =
rep(c(1,2),5))
df <- 10
lml <- lmList(y ~ ns(x,df=df) | c, a)
Error in df - 1 : non-numeric argument to binary operator
I presume this is because the formula isn't evaluated
2017 May 28
3
stats::line() does not produce correct Tukey line when n mod 6 is 2 or 3
Bug: stats::line() does not produce correct Tukey line when n mod 6 is 2 or
3
Example: line(1:9,1:9) should have intercept 0 and slope 1 but it gives
intercept -1 and slope 1.2
Trying line(1:i,1:i) across a range of i makes it clear there's a cycle of
length 6, with four of every six correct.
Bug has been present across many versions.
The machine I just tried it on just now has R3.2.3:
2001 Jun 11
2
Generalized Additive Model
Hello,
I am wondering if someone can direct me to the syntax of the Generalised
Additive Model in R? In Splus this is gam(formula, ... inputs would be
pretty much the same as glm I suspect..)
Any response on that (or what package should I grap) would be appreciated
very much.
Thanks,
Peppy Adi-Purnomo
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help
2003 May 08
2
natural splines
Apologies if this is this too obscure for R-help.
In package splines, ns(x,,knots,intercept=TRUE) produces an n by K+2
matrix N, the values of K+2 basis functions for the natural splines with K
(internal) knots, evaluated at x. It does this by first generating an
n by K+4 matrix B of unconstrained splines, then postmultiplying B by
H, a K+4 by K+2 representation of the nullspace of C (2 by K+4),
2004 Mar 18
1
termplot has problems with a single term (fix included) (PR#6679)
On Thu, 18 Mar 2004 k.hansen@biostat.ku.dk wrote:
> The bug exists on R-1.9.0-alpha compiled the 10/3.
>
> Termplot has a problem if either the model only contains a single term
> or if asked to plot a single term. In addition there are problems with
> the option se = TRUE.
I can't reproduce this in either R-devel or 1.8.1, and termplot hasn't
changed since January.
I do
2003 Apr 22
1
glmmPQL and additive random effects?
I'm a bit puzzled by how to write out additive random effects in
glmmPQL. In my situation, I have a factorial design on two
(categorical) random factors, A and B. At each combination, I have a
binary response, y, and two binary fixed covariates, C and D.
If everything were fixed, I would use
glm(y ~ A + B + C + D, family = binomial)
My first thought was to use
glmmPQL(y ~ A + B, random
2011 Oct 08
1
Generalized Additive Models: How to create publication-ready regression tables
Hi -
I have a series of 9 GAM regressions with about 5 parametric effects and
three non-parametric effects in each.
What is a good library or command for turning GAM outputs into
publication-ready regression tables?
I tried apsrtable and the mtable command in memisc but neither seemed to
work with the gam output.
I'd be okay with two separate tables - one for the parametric effects and
2001 Dec 22
2
gam plots
Dear R users,
Using the library(mgcv) and running R under MacOSX, I have fitted a
generalised additive model with binomial errors in order to check the
linearity of two continuous variables ap2mm and diffdaysm in a glm:
> mymodel.gam <- gam(diedhos~ s(ap2mm) + Dweekm + s(diffdaysm) +
Dweekm:diffdaysm + ap2mm:Dweekm, binomial)
I would like postscript gam plots for the two smoothed
2006 Feb 16
1
testing the significance of the variance components using lme
Hi R-users,
I am using lme to fit a linear mixed model with the nlme package,
does anyone know if it is possible to obtain standard error estimates of the variance components estimators and an adequate method to test the significance of the variance component?
Thanks,
Berta.
[[alternative HTML version deleted]]