Displaying 20 results from an estimated 4000 matches similar to: "terms.formula"
2020 Oct 23
3
formula mungeing
Suppose I have a formula like this:
f <- y ~ qss(x, lambda = lambdas[1]) + qss(z, lambdas[2]) + s
I?d like a function, g(lambdas, f) that would take g(c(2,3), f) and produce the new
formula:
y ~ qss(x, lambda = 2) + qss(z, 3) + s
For only two qss terms I have been using
g <- function(lambdas, f){
F <- deparse(f)
F <- gsub("lambdas\\[1\\]",lambdas[1],F)
F
2020 Oct 23
0
formula mungeing
Recursively walk the formula performing the replacement:
g <- function(e, ...) {
if (length(e) > 1) {
if (identical(e[[2]], as.name(names(list(...))))) {
e <- eval(e, list(...))
}
if (length(e) > 1) for (i in 1:length(e)) e[[i]] <- Recall(e[[i]], ...)
}
e
}
g(f, lambdas = 2:3)
## y ~ qss(x, lambda = 2L) + qss(z, 3L) + s
On Fri, Oct
2009 Apr 11
1
data argument and environments
I'm having difficulty with an environmental issue: I have an additive
model fitting function
with a typical call that looks like this:
require(quantreg)
n <- 100
x <- runif(n,0,10)
y <- sin(x) + rnorm(n)/5
d <- data.frame(x,y)
lam <- 2
f <- rqss(y ~ qss(x, lambda = lam), data = d)
this is fine when invoked as is; x and y are found in d, and lam is
found the
2004 Jul 22
2
Files and classes in a package?
While installing my small package, I met a tricky problem.
For clarity, let me explain it with the following simplified example.
In ~/pkg/R/aclass.R,
setClass("aclass", contains="bclass", representation(i="numeric"))
In ~/pkg/R/bclass.R,
setClass("bclass", representation(j="numeric"))
After building a "pkg" package, the file
2003 Sep 01
0
Quantile Regression Packages
I'd like to mention that there is a new quantile regression package
"nprq" on CRAN for additive nonparametric quantile regression estimation.
Models are structured similarly to the gss package of Gu and the mgcv
package of Wood. Formulae like
y ~ qss(z1) + qss(z2) + X
are interpreted as a partially linear model in the covariates of X,
with nonparametric components defined as
2002 Aug 28
1
fix(fix)
About 2 percent of the time I use fix() to edit a function that is
sitting in .RData I get the response:
> fix(qss)
Error in edit(name, file, editor) : problem with running editor vi
when I try to close the editing session. I used to think that these
were always cases where there was some syntactical error with the
edited file, but this is not the case. I realize that one surefire
way to
2009 Jun 19
1
result of rqss
Hello,
i have the following data:
x=c(0,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.1,0.11,0.12,0.13,0.14,0.15,0.16,0.17,0.18,0.19,0.2,0.21,0.22,0.23,0.25,0.26,0.27,0.46,0.47,0.48,0.49)
y=c(0.48,0.46,0.41,0.36,0.32,0.35,0.48,0.47,0.55,0.56,0.54,0.67,0.61,0.60,0.54,0.51,0.45,0.42,0.44,0.46,0.41,0.43,0.43,0.48,0.48,0.47,0.39,0.37,0.32,0.29)
and tried to get piecewise linear regression. Doing a
2006 Feb 05
1
how to extract predicted values from a quantreg fit?
Hi,
I have used package quantreg to estimate a non-linear fit to the
lowest part of my data points. It works great, by the way.
But I'd like to extract the predicted values. The help for
predict.qss1 indicates this:
predict.qss1(object, newdata, ...)
and states that newdata is a data frame describing the observations
at which prediction is to be made.
I used the same technique I used
2009 Jun 24
2
Memory issues on a 64-bit debian system (quantreg)
Rers:
I installed R 2.9.0 from the Debian package manager on our amd64
system that currently has 6GB of RAM -- my first question is whether
this installation is a true 64-bit installation (should R have access to
> 4GB of RAM?) I suspect so, because I was running an rqss() (package
quantreg, installed via install.packages() -- I noticed it required a
compilation of the source) and
2003 Aug 06
1
S4 methods bug in naming of slots (PR#3665)
Hello,
I am using R 1.7.1 on a Redhat Linux machine, version 7.3.
The following works fine:
setClass("ok", representation(
"A" = "matrix",
"Cmatrix" = "matrix"))
new("ok",
"A" = diag(4),
"Cmatrix" = diag(4))
But the following doesn't work:
setClass("notok", representation(
2006 Apr 17
1
slot named C
"C" appears to be an illegal name for a slot in an S4 class (example
below). If this is a known limitation, and not a bug, it would be nice
if it were caught by setClass.
Paul Gilbert
> setClass("testobj", representation ( C = "numeric"))
[1] "testobj"
> new("testobj", C= 2)
Error in methodsPackageMetaName("C", name) :
2004 Aug 12
1
correlation structures in NLME
I am using the latest version of R on a Windows machine and get the
following error when I try to initialize a correlation structure with
the function corAR1 in NLME. This example is taken from the book of
Pinheiro and Bates, so it should work. What is going wrong?
> library(nlme)
> data(Orthodont)
> cs1AR1 <- corAR1(0.8, form= ~1 | Subject)
> cs1AR1 <- initialize(cs1AR1, data =
2005 Jul 13
3
How to increase memory for R on Soliars 10 with 16GB and 64bit R
Dear all,
My machine is SUN Java Workstation 2100 with 2 AMD Opteron CPUs and 16GB RAM.
R is compiled as 64bit by using SUN compilers.
I trying to fit quantile smoothing on my data and I got an message as below.
> fit1<-rqss(z1~qss(cbind(x,y),lambda=la1),tau=t1)
Error in as.matrix.csr(diag(n)) : cannot allocate memory block of size 2496135168
The lengths of vector x and y are
2011 Jul 13
1
question on formula and terms.formula()
I'm trying to create a formula object to pass on to a function that
applies the function terms.formula() to it.
f <- function(formula, ...)
{
...
mf <- match.call()
term <- terms.formula(mf$formula)
...
}
However, my code below gives an error.
form <- as.formula("y~x")
f(form, ...)
The error message was:
Error in terms.formula(mf$formula): argument is not a valid
2024 Oct 22
1
invalid permissions
Gurus:
I have a new version of my quantreg package with minimal changes, mainly to fix some obscure fortran problems. It fails R CMD check ?as-cran with the error:
Running examples in ?quantreg-Ex.R? failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: plot.rqss
> ### Title: Plot Method for rqss Objects
2011 Mar 21
2
rqss help in Quantreg
Dear All,
I'm trying to construct confidence interval for an additive quantile regression
model.
In the quantreg package, vignettes section: Additive Models for Conditional
Quantiles
http://cran.r-project.org/web/packages/quantreg/index.html
It describes how to construct the intervals, it gives the covariance matrix for
the full set of parameters, \theta is given by the sandwich formula
2007 Nov 14
0
Piecewise Linear Regression
Hi,
Let me pick up this old thread. How does one extract the locations of the knots (ends of the segments) from the fit object below?
Thanks,
Vadim
>From : roger koenker < roger_at_ysidro.econ.uiuc.edu >
Date : Tue 31 May 2005 - 10:23:19 EST
It is conventional to fit piecewise linear models by assuming Gaussian error and
using least squares methods, but one can argue that
2004 Dec 22
2
GAM: Getting standard errors from the parametric terms in a GAM model
I am new to R. I'm using the function GAM and wanted to get standard errors
and p-values for the parametric terms (I fitted a semi-parametric models).
Using the function anova() on the object from GAM, I only get p-values for
the nonparametric terms.
Does anyone know if and how to get standard errors for the parametric terms?
Thanks.
Jean G. Orelien
2005 May 30
3
Piecewise Linear Regression
Hi,
I need to fit a piecewise linear regression.
x = c(6.25,6.25,12.50,12.50,18.75,25.00,25.00,25.00,31.25,31.25,37.50,37.50,50.00,50.00,62.50,62.50,75.00,75.00,75.00,100.00,100.00)
y = c(0.328,0.395,0.321,0.239,0.282,0.230,0.273,0.347,0.211,0.210,0.259,0.186,0.301,0.270,0.252,0.247,0.277,0.229,0.225,0.168,0.202)
there are two change points. so the fitted curve should look like
\
\ /\
2005 Nov 28
1
terms.object documentation bug? (PR#8353)
Full_Name: simon wood
Version: 2.2.0 (and lower)
OS: linux/windows
Submission from: (NULL) (86.135.153.59)
I think that the documentation for the `specials' attribute of a `terms.object'
is not quite right:
specials: If the 'specials' argument was given to 'terms.formula' there
is a 'specials' attribute, a list of vectors indicating the
terms