Displaying 1 result from an estimated 1 matches for "totx".
Did you mean:
tot
2007 Jun 01
1
object not found inside function
...g2plus
are parameters
#create design matrix for linear part
fo00 <- paste("~",paste(paste("x",1:p,sep=""),collapse="+"),sep="")
fo0 <- as.formula(fo00)
A <- model.matrix(fo0,data=ydata)
# create z variable
z2plus <- ifelse(totx>1,1,0)
ydata <- data.frame(ydata,z2plus)
#run model
t2 <- nls(y ~
A*exp(g2plus*z2plus),data=ydata,start=c(g2plus=0),alg="plinear")
}
model <- fm(4,ydata)
The code inside the function works if not enclosed in a function. This
makes me think that it is a scope problem a...