Displaying 13 results from an estimated 13 matches for "nmodel".
Did you mean:
model
2007 Aug 01
1
Problem to remove loops in a routine
...(idata,idata$DVID==j)
for (k in 1:nPer) {
#loop on Period
# k=1
ijkdata<-subset(ijdata,ijdata$OCC==k)
for (l in 1:nGRP) { #loop on Group
# l=1
subdata<-subset(ijkdata,ijkdata$GRP==l)
nModel<-nlevels(factor(subdata$MODEL))
#number of models to be plotted in this loop
mylegend<-c("Raw data",levels(factor(subdata$MODEL)))
subID<-nlevels(factor(subdata$ID)) #number of
ID in the new dataset
myplot<-xyplot(Y...
2011 May 18
1
How to make array of regression objects
...couple logistic regressions, what making a distribution of some
event.
Currently, i store it like this:
o1 <- lrm(...)
o2 <- lrm(...)
o3 <- lrm(...)
...
Then, i have made a function to peak required regression object from this
variables by it number:
get_object <- function(obj_name, nModel) {
eval (parse(text=paste("o <- ", obj_name, nModel, sep="")))
o
}
Is there a better way to do it? I have try to store it in the matrix using
data.frame(), but object become destroyed after that and predict() function
do not recognize it.
Regards,
Dmitrij Kudriavcev...
2011 Feb 28
3
nls not solving
...the same problem. If I remove the parameter "a," then it can
find a solution. Does anyone know what I can do to fit this model?
vardata<- rnorm(73,mean=0,sd=5)
x<-0:72
a<-1
b<-50
k<-0.05
l<-5
startt<-c(a,b,k,l)
yf<-a+b*(1-exp(-k*(x-l)))
y<-yf+vardata
nmodel<-nls(y~a+b*(1-exp(-k*(x-l))),
start=list(a=1,b=50,k=0.05,l=5))
--
View this message in context: http://r.789695.n4.nabble.com/nls-not-solving-tp3328647p3328647.html
Sent from the R help mailing list archive at Nabble.com.
2007 Jun 24
2
matlab/gauss code in R
...I did not try to implement the changes proposed by
> Hadley, hoping that a solution can be found using the original dataset.
>
> ######### My code
>
> # Creating dataset
>
> nPts<-10 # number of time points
> nInd<-6 # number of individuals
> nModel<-3 # number of models
>
> TimePts<-rep(1:nPts,nInd*nModel) #
> creates the "Time" column
> Coef<-rep(rnorm(6,0.1,0.01),each=nPts,nModel) # Creates a
> vector of coefficients for generating the observations
>...
2009 May 05
0
stepAICc function (based on MASS:::stepAIC.default)
...v[1L] <- NA
nas <- !is.na(dev)
P <- dev
P[nas] <- safe_pchisq(dev[nas], dfs[nas], lower.tail = FALSE)
aod[, c("LRT", "Pr(Chi)")] <- list(dev, P)
}
aod <- aod[o, ]
head <- c("Single term deletions", "\nModel:", deparse(as.vector(formula(object))))
if (scale > 0)
head <- c(head, paste("\nscale: ", format(scale), "\n"))
class(aod) <- c("anova", "data.frame")
attr(aod, "heading") <- head
aod
}
##
addterm.AICc=func...
2011 Feb 25
2
nls
hi,
I would like to find the x value (independent variable) for a certain dependent value using the fitted model with nls.
with (predict) I can find y that corresponds to a list of x. I need the other way around. can it be done?
thanks,
afadda
2011 Oct 21
0
nls making R "not responding"
...= seq(0.1, 1.6,.5), mu = seq(0.01, .41,.1), l=1, b
=seq(0,.6,.3))
lower.bound<-list(A=.01,mu=0,l=0,b=0)
try(
invisible(capture.output(mod1<-nls2(Yvals~modeltest(A,mu,l,b,thour),
#start = list(b =5, k = 2, l=0),
start = st2,
lower = lower.bound,
algorithm = "brute-force"
)))
)
try(nmodel<-nls(Yvals~modeltest(A,mu,l,b,thour),
start=coef(mod1),
#start=list(A=1.8,mu=.2,l=.5,b=.15),
lower=lower.bound,
algorithm="port")
)
My problem seems to be with initial parameter estimates. I am running
through a couple hundred treatments, so I used nls2 to pick the best
starting value...
2002 Jun 24
10
code optimization
...e)\t",k,"\t",vlr,"\n")
vlr <- NULL
k <- 0
for(j in 1:length(delta)) if(delta[j]>10){
k <- k+1
vlr[k] <- delta[j]
}
cat("> 10 (very strong evidence)\t",k,"\t",vlr,"\n")
cat("\nMODELS\n")
vlr <- NULL
k <- 0
for(j in 1:length(delta)) if(delta[j] <= 2){
k <- k+1
vlr[k] <- j
}
cat("<= 2 (no credible evidence)\t",k,"\t",vlr,"\n")
vlr <- NULL
k <- 0
for(j in 1:length(...
2011 Feb 28
0
Gamma mixture models with flexmix
...rate=rates[ii])
}
uy <- unlist(y)
ylim <- if (any(uy == Inf)) {
c(0, 2*max(ho$intensities))
} else {
c(0, max(c(ho$intensities, uy)))
}
plot(ho, col='lightgray', freq=FALSE, ylim=ylim,
main=paste(KK, 'component(s) in model\nmodel prior(s) =',
paste(round(pis, 2), collapse=', ')))
cols <- rainbow(KK)
for (ii in 1:KK) {
lines(x, y[[ii]], col=cols[ii])
}
}
##
## Model dat as a mixture of Gammas then plot.
##
modelGammas <- function(dat, which='BIC') {
set.seed(939458)
fmo <...
2010 Mar 01
0
MASS::loglm - exploring a collection of models with add1, drop1
...? ? 1
> str(hoyt.add1)
Classes ?anova? and 'data.frame': 4 obs. of 4 variables:
$ Df : num NA 1 2 6
$ AIC : num 2166 2130 1430 842
$ LRT : num NA 38.8 740.3 1336.5
$ Pr(Chi): num NA 4.66e-10 1.74e-161 1.36e-285
- attr(*, "heading")= chr "Single term additions" "\nModel:" "~Status +
(Sex * Rank * Occupation)"
So, all I get is a data frame containing the results for added terms.
I'm also not sure which add1 function to look at since I don't find an
add1.loglm
> methods(add1)
[1] add1.default* add1.glm* add1.gnm* add1.lm* add1.mlm* add...
2002 Apr 29
0
code optimization
...e)\t",k,"\t",vlr,"\n")
vlr <- NULL
k <- 0
for(j in 1:length(delta)) if(delta[j]>10){
k <- k+1
vlr[k] <- delta[j]
}
cat("> 10 (very strong evidence)\t",k,"\t",vlr,"\n")
cat("\nMODELS\n")
vlr <- NULL
k <- 0
for(j in 1:length(delta)) if(delta[j] <= 2){
k <- k+1
vlr[k] <- j
}
cat("<= 2 (no credible evidence)\t",k,"\t",vlr,"\n")
vlr <- NULL
k <- 0
for(j in 1:length(...
2012 Jul 19
1
Change log(J) to log(J+1) to stop log(0) from occurring in harModel
...#######################################################################
# Print method for harmodel:
print.harModel = function(x, digits = max(3, getOption("digits") - 3), ...){
formula = getHarmodelformula(x); modeldescription = formula[[1]]; betas =
formula[[2]];
cat("\nModel:\n", paste(modeldescription, sep = "\n", collapse = "\n"),
"\n\n", sep = "")
coefs = coef(x);
names(coefs) = c("beta0",betas)
if (length(coef(x))){
cat("Coefficients:\n")
print.default(format(coefs, di...
2012 Jul 19
1
Switching log(J) to log(J+1) to avoid log(0) in HAR-RVJ model
...#########################################################################
# Print method for harmodel:
print.harModel = function(x, digits = max(3, getOption("digits") - 3), ...){
formula = getHarmodelformula(x); modeldescription = formula[[1]]; betas =
formula[[2]];
cat("\nModel:\n", paste(modeldescription, sep = "\n", collapse = "\n"),
"\n\n", sep = "")
coefs = coef(x);
names(coefs) = c("beta0",betas)
if (length(coef(x))){
cat("Coefficients:\n")
print.default(format(coefs, digits...