search for: modelfit

Displaying 12 results from an estimated 12 matches for "modelfit".

2023 May 09
1
RandomForest tuning the parameters
...h = "grid") {} > > > > customRF$fit <- function(x, y, wts, param, lev, last, weights, > classProbs, ...) { > > > > randomForest(x, y, maxnodes = param$maxnodes, ntree=param$ntree, ...) > > > > } > > > > customRF$predict <- function(modelFit, newdata, preProc = NULL, > submodels = NULL) > > > > predict(modelFit, newdata) > > > > customRF$prob <- function(modelFit, newdata, preProc = NULL, submodels = > NULL) > > > > predict(modelFit, newdata, type = "prob") > > > > cu...
2008 Aug 29
1
nls() fails on a simple exponential fit, when lm() gets it right?
...ot;)) cat("Logarithmic fit (here, the self-start and the 'simpler' way match):\n") tmp=getInitial(height~SSlogarithmic(dbh,aaa,bbb),data=data.frame(dbh,height)) cat("(Starting values for the logarithmic fit were: aaa=",tmp[1],"and bbb=",tmp[2],")\n") modelfit=nls(height~SSlogarithmic(x=dbh,aaa,bbb),trace=traceson,control=list(maxiter=maxint,tol=tolerance,minFactor=minstepfactor)) bfaaa=summary(modelfit)$coefficients[1];bfbbb=summary(modelfit)$coefficients[2] cat("Best logarithmic fit is (",ytxt,")=(aaa*log(",xtxt,")+bbb) with pa...
2006 Aug 08
1
Fitting data with optim or nls--different time scales
...s only available on days 0, 7, 12, 14, 17, and 20. I don't know how to set up optim or nls so that it takes out[,4] on the appropriate day, but still runs lsoda on a time scale of 0.01 day. Below is the function I've been using to run 'optim', at the course-grained time scale: Modelfit=function(s) { parms[1:4]=s[1:4]; times=c(0,7,12,14,17,20,25) out=lsoda(x0,times,Model,parms) mse=mean((log10(out[,4])-log10(i(times)))^2) # cat(times) return(mse) } #x0=c(T0,I0,V0) x0=c(2249,0,1) #parms(lambda, beta, d, delta, p, c) parms[5:6]=c(1.0,23) s0=c(49994,8456,6.16E-8,0.012) #initial...
2023 May 08
1
RandomForest tuning the parameters
...quot;, "ntree"))? customRF$grid <- function(x, y, len = NULL, search = "grid") {} customRF$fit <- function(x, y, wts, param, lev, last, weights, classProbs, ...) { ?randomForest(x, y, maxnodes = param$maxnodes, ntree=param$ntree, ...) } customRF$predict <- function(modelFit, newdata, preProc = NULL, submodels = NULL) predict(modelFit, newdata) customRF$prob <- function(modelFit, newdata, preProc = NULL, submodels = NULL) ? predict(modelFit, newdata, type = "prob") customRF$sort <- function(x) x[order(x[,1]),] customRF$levels <- function(x) x$cl...
2011 Dec 07
1
MIXED MODEL WITH REPEATED MEASURES
...specify a covariance matrix structure. Given the relatively high degree of correlation in consecutive years, an AR(1) structure seems like a good starting point. I have been trying to build the model in SPSS, but without success, so I've recently turned to R. My first attempt was as follows-- ModelFit <- lme(fixed = DepVar ~FixedVar1+FixedVar2, random = ~RandomVar1+RandomVar2 | Subject, na.action = na.omit, data = dataset, corr = corAR1()) I assume this can't be the right specification since it neglects the repeated measure aspect of the data, so I instead decided to employ the corCAR1 s...
2013 Jun 25
1
Correct scaling of axis in persp3d plot
Hi, I want to format my axis in my persp3d plot. With my data, which I attached I created a persp3d plot with the following code, which I summarized from different code snippets I found: library(rugarch)library(rgl)library(fGarch)fd <-as.data.frame(modelfit,which ='density')color <-rgb(85,141,85,maxColorValue=255)x <-seq(-0.2,0.2,length=100)y <-c(1:2318)f <-function(s,t){dged(s,mean=fd[t,'Mu'],sd=fd[t,'Sigma'],nu=fd[t,'Shape'])}z <-outer(x,y,f)persp3d(x,y,z,theta=50,phi=25,expand=0.75,col=color,ticktype=&...
2012 Dec 12
1
ggplot - adding regression lines
Hi I am using ggplot to overlay two regression lines on a scatter plot each corresponding to a treatment group. The default plot gives a different slope for each treatment group. However, in some cases i want the lines to be parallel -ie no significant interaction. My code: ggplot(data=df,X,Y,colour=treatment) + geom_point() + geom_smooth(method="lm") I think i use the
2010 Sep 25
2
Uncertainty propagation
I have a small model running under R. This is basically running various power-law relations on a variable (in this case water level in a river) changing spatially and through time. I'd like to include some kind of error propagation to this. My first intention was to use a kind of monte carlo routine and run the model many times by changing the power law parameters. These power laws were
2012 Nov 29
1
Help with this error "kernlab class probability calculations failed; returning NAs"
...Warning messages: 1: In train.default(x, y, weights = w, ...) : At least one of the class levels are not valid R variables names; This may cause errors if class probabilities are generated because the variables names will be converted to: X0, X1 2: In caret:::predictionFunction(method = method, modelFit = mod$fit, ... : kernlab class prediction calculations failed; returning NAs
2011 Aug 23
1
pMCMC and HPD in MCMCglmm
Dear R users, I?d like to pose aquestion about pMCMC and HDP. I have performed a mixed logistic regression by MCMCglmm (a very good package) obtaining the following results: Iterations = 250001:799901 Thinning interval = 100 Sample size = 5500 DIC: 10.17416 G-structure: ~ID_an post.mean l-95% CI u-95% CIeff.samp ID_an 0.7023 0.0001367 3.678 2126 R-structure: ~units post.mean l-95%
2011 Apr 19
3
How to program with colleagues
Dear all, my colleagues and I have to write some R code for some of our projects. I would like to ask you help to organize us a little. a. Do you know if there is any system that can convert our R scripts to html pages with some nice dependency graphs (which functions calls which). b. Could you please suggest me an easy way to exchange the R code with my colleagues. I know about these version
2013 Nov 15
1
Inconsistent results between caret+kernlab versions
I'm using caret to assess classifier performance (and it's great!). However, I've found that my results differ between R2.* and R3.* - reported accuracies are reduced dramatically. I suspect that a code change to kernlab ksvm may be responsible (see version 5.16-24 here: http://cran.r-project.org/web/packages/caret/news.html). I get very different results between caret_5.15-61 +