Displaying 6 results from an estimated 6 matches for "resplength".
2012 Jul 03
1
nls problem
...m is related to the way `nls' tries to compute
# its internal variable `varIndex' which rests on the assumption that
# the dependent ("y") and, possibly, the independent ("x") variable
# are identified by having a length equal to the `nls' variable
# `respLength'. the problem arises when there are `varNames'
# components accidentally having this length, too.
# in the present example, setting the number of data points to
# len=2 triggers the error since the `call' object `fifu' has this
# length, too and `nls' constructs...
2006 Sep 15
1
Formula aruguments with NLS and model.frame()
...f,
upper = Inf));
mWeights<-F;#missing(weights);
start=list(w=.5,a=.1,p=.5,b=init.y$coef[2],int=init.y$coef[1] );
pnames <- names(start);
varNames <- varNames[is.na(match(varNames, pnames, nomatch = NA))]
varIndex <- sapply(varNames,
function(varName, data, respLength) {
length(eval(as.name(varName), data))%%respLength == 0},
data, length(eval(formula[[2]], data))
);
mf$formula <- as.formula(paste("~", paste(varNames[varIndex],
collapse = "+")), env = environment(formula));
mf$start <- NULL;m...
2006 Dec 23
1
simple NLS query
dear R experts: I am trying to orient myself using nls(). so, I am
just trying to copy and adapt an example in the nls() function:
> d= data.frame( y= runif(10), x= runif(10) )
> nls( y ~ 1/(1+x), data = d, start= list(x=0.5,y=0.5), trace=TRUE)
Error in n%%respLength : non-numeric argument to binary operator
the error message seems internal, so it would be nicer if there was a
better error message. I presume my mistake is so basic that an R
expert sees the problem in 1 second.
(if I manage to figure this one out, my next step will be to learn how
I can get [...
2006 Sep 07
0
Help understanding how nls parses the formula argument to estimate the model
...-Inf,
upper = Inf));
mWeights<-F;#missing(weights);
start=list(w=.5,a=.1,p=.5,b=init.y$coef[2],int=init.y$coef[1] );
pnames <- names(start);
varNames <- varNames[is.na(match(varNames, pnames, nomatch = NA))]
varIndex <- sapply(varNames,
function(varName, data, respLength) {
length(eval(as.name(varName), data))%%respLength == 0},
data, length(eval(formula[[2]], data))
);
mf$formula <- as.formula(paste("~", paste(varNames[varIndex],
collapse = "+")), env = environment(formula));
mf$start <- NULL;mf$co...
2006 Sep 21
0
Help understanding how nls parses the formula argument to estimate the model
...f,
upper = Inf));
mWeights<-F;#missing(weights);
start=list(w=.5,a=.1,p=.5,b=init.y$coef[2],int=init.y$coef[1] );
pnames <- names(start);
varNames <- varNames[is.na(match(varNames, pnames, nomatch = NA))]
varIndex <- sapply(varNames,
function(varName, data, respLength) {
length(eval(as.name(varName), data))%%respLength == 0},
data, length(eval(formula[[2]], data))
);
mf$formula <- as.formula(paste("~", paste(varNames[varIndex],
collapse = "+")), env = environment(formula));
mf$start <- NULL;m...
2001 Feb 19
2
problems sourcing in vs interactive
If I source in the function (see below) calib(), I get:
> source("papers/helle/threshold.r")
> calib()
Error in eval(expr, envir, enclos) : Object "energy" not found
But if I cut and paste the code for calib() one line at a time into the R
window it works fine.
calib<-function()
{
contrast<-c(.01,.02,.0325,.055,.0775,.1,.125,.15,.175,.2)