Displaying 20 results from an estimated 9000 matches similar to: "Problem with pasteing formulas (PR#8897)"
2004 Oct 11
0
scoping problem when calling step inside a function
Hi everyone -
I'm trying to do a forward stepwise regression (I've tried both step
and stepAIC) inside of a function. I can do it outside the function
with no problems (first example in code below). I can also do a
backward stepwise regression inside a function (second example), but
forward stepwise regression ( third example ) fails with the error:
"Error in
2012 Feb 28
2
update.formula has 512 char buffer?
Hello,
I am trying to "paste" together a formula to use in the mob function of
party. This means the formula will be of the form y ~ x1+ ...+xM | z1+..zN.
I am doing some preliminary fits of y ~ x1+ ...+xM, then want to add the
conditional part of the equation using update().
Here's the test code:
var1 <- 1:78
x1 <- paste("x", var1, sep="")
f1 <-
2004 Nov 30
3
2k-factorial design with 10 parameters
Hi,
I'd like to apply a 2^k factorial design with k=10 parameters. Obviously
this results in a quite long term for the model equation due to the high
number of combinations of parameters.
How can I specify the equation for the linear model (lm) without writing
all combinations explicitly down by hand? Does a R command exist for
this problematic?
Thanks for your help in advance,
Sven
2012 Nov 07
5
Calling R object from R function
Hi,
Can you please help me with this please?
What I am trying to do is call a vector from R function and used in the new
function
So I create 4 functions with these arguments
M11 <- function(TrainData,TestData,mdat,nsam) {
ls <- list()
I have few statments one of them is
vectx <- c(,1,2,3,4,5,6,6)
vectz <- c(12,34,5,6,78,9,90)
and then................
ls(vectx=vtecx,vectz=vectz)
2005 Jul 01
1
scope argument in step function
Thanks a lot for help in advance. I am switching from matlab to R and I guess I need some time to get rolling. I was wondering why this code :
> fit.0 <- lm( Response ~ 1, data = ds3)
> step(fit.0,scope=list(upper=~.,lower=~1),data=ds3)
Start: AIC= -32.66
Response ~ 1
Call:
lm(formula = Response ~ 1, data = ds3)
Coefficients:
(Intercept)
1.301
is not working
2008 Jul 06
3
Lots of huge matrices, for-loops, speed
Hello,
we have 80 text files with matrices. Each matrix represents a map (rows for
latitude and columns for longitude), the 80 maps represent steps in time. In
addition, we have a vector x of length 80. We would like to compute a
regression between matrices (response through time) and x and create maps
representing coefficients, r2 etc. Problem: the 80 matrices are of the size
4000 x 3500 and we
2005 Aug 16
4
as.character and a formula
Dear list,
given this formula:
> fmla <- formula(y1 ~ spp1 + spp2 + spp3 + spp5)
> fmla[[3]]
spp1 + spp2 + spp3 + spp5
is this the intended behaviour of as.character:
> as.character(fmla[[3]])
[1] "+" "spp1 + spp2 + spp3" "spp5"
? Where does the extra "+" come from?
> as.character(fmla)
[1] "~"
2008 Dec 02
4
Variables inside a for
Hi!
I had a database with some variables in sequence. Let me say: TX01, TX02,
TX03 and TX04.
But I need to run some regressions changing the variables... so:
variable <- paste("TX0", 1:4, sep="")
for(i in 1:4){
test[i] <- lm(variable[i] ~ INCOME, data=database)
}
But doesn't work... lm tries to find a variable inside database named
variable[i] ...
Suggestions?
2005 Jun 24
1
"Error in contrasts" in step wise regression
Hi,
I have a problem in getting step function work. I am getting the following error:
> fit1 <- lm(Response~1)
> fmla <- as.formula(paste(" ~ ",paste(colnames,collapse="+")))
> sfit <- step(fit1,scope=list(upper= fmla,lower= ~1),k=log(nrow(dat)))
Start: AIC= -1646.66
Response ~ 1
Error in "contrasts<-"(`*tmp*`, value =
2009 Aug 25
1
Problem with correct usage of formula environment
Dear all,
I am working on a function formula.design that should automatically generate
reasonable lm formulae for a number of different designs. All works well as
long as all variables used are columns of the design data frame. For one
function, I would like to incorporate a dummy variable for center points
that is not a column of the design. Without this function, it would work
like this (at
2012 Jan 25
4
formula error inside function
I want use survfit() and basehaz() inside a function, but it doesn't work.
Could you take a look at this problem. Thanks for your help. Following is my
codes:
library(survival)
n <- 50 # total sample size
nclust <- 5 # number of clusters
clusters <- rep(1:nclust,each=n/nclust)
beta0 <- c(1,2)
set.seed(13)
#generate phmm data set
Z <- cbind(Z1=sample(0:1,n,replace=TRUE),
2003 Oct 02
4
using a string as the formula in rlm
Hi,
I am trying to build a series of rlm models. I have my data frame and
the models will be built using various coulmns of the data frame.
Thus a series of models would be
m1 <- rlm(V1 ~ V2 + V3 + V4, data)
m2 <- rlm(V1 ~ V2 + V5 + V7, data)
m3 <- rlm(V1 ~ V2 + V8 + V9, data)
I would like to automate this. Is it possible to use a string in place
of the formula?
I tried doing:
fmla
2008 Dec 10
1
Error: protect () : protection stack overflow
I am attempting to create a formula using as.formula for a PLS analysis. I have used the code below successfully, but in a previous R version and with many fewer predictors. Any help getting all of these predictors into one formula would be greatly appreciated.
TC.fmla <- as.formula(paste("TC ~ ", paste(vars, collapse= "+")))
As I mentioned, this code worked fine in a
2019 Sep 05
2
ARM vectorized fp16 support
Hi,
I'm trying to compile half precision program for ARM, while it seems
LLVM fails to automatically generate fused-multiply-add instructions
for c += a * b. I'm wondering whether I did something wrong, if not,
is it a missing feature that will be supported later? (I know there're
fp16 FMLA intrinsics though)
Test programs and outputs,
$ clang -O3 -march=armv8.2-a+fp16fml
2012 May 29
3
trouble automating formula edits when log or * are present; update trouble
Greetings
I want to take a fitted regression and replace all uses of a variable
in a formula. For example, I'd like to take
m1 <- lm(y ~ x1, data=dat)
and replace x1 with something else, say x1c, so the formula would become
m1 <- lm(y ~ x1c, data=dat)
I have working code to finish that part of the problem, but it fails
when the formula is more complicated. If the formula has log(x1)
2011 Dec 19
1
pls help to print out first row of terms(model) output in example program
Greetings.
I've written a convenience function for multicollinearity diagnosis.
I'd like to report to the user the formula that is used in a
regression. I get output like this:
> mcDiagnose(m1)
[1] "The following auxiliary models are being estimated and returned in a list:"
[1] "`x1` ~ ."
formula(fmla)()
[1] "`x2` ~ ."
I'd like to fill in the period
2019 Sep 05
2
ARM vectorized fp16 support
Thanks for reply. I was using LLVM 8.0. Let me try trunk and will let
you know if it works.
On Wed, Sep 4, 2019 at 11:19 PM Sjoerd Meijer <Sjoerd.Meijer at arm.com> wrote:
>
> Hi,
> Which version of Clang are you using? I do get a "vfma.f16" with a recent trunk build. I haven't looked at older versions and when this landed, but we had an effort to plug the remaining
2005 Jul 12
2
how to generate argument from a vector automatically
hi netters
i have a vector NAMES containing a series of variable names:
NAMES=c(x,r,z,m,st,qr,.....nn).
i wanna fit a regression tree by using the code:
my.tree<-tree(y~x+r+z+m+....nn,my.dataframe)
but i don't want to type out "x+r+z+m+....+nn" one by one, as there are so
many variables. besides, sometimes i wanna put the code in a function. so i
need to have the
2008 Aug 29
1
nls() fails on a simple exponential fit, when lm() gets it right?
Dear R-help,
Here's a simple example of nonlinear curve fitting where nls seems to get
the answer wrong on a very simple exponential fit (my R version 2.7.2).
Look at this code below for a very basic curve fit using nls to fit to (a)
a logarithmic and (b) an exponential curve. I did the fits using
self-start functions and I compared the results with a more simple fit
using a straight lm()
2012 Jan 03
1
returning information from functions via attributes rather than return list
I would like to ask for advice from R experts about the benefits or
dangers of using attr to return information with an object that is
returned from a function. I have a feeling as though I have cheated by
using attributes, and wonder if I've done something fishy.
Maybe I mean to ask, where is the dividing line between attributes and
instance variables? The separation is not clear in my mind