search for: npar

Displaying 20 results from an estimated 37 matches for "npar".

Did you mean: near
2012 Apr 05
4
Appropriate method for sharing data across functions
...ht be the proper way. An onAttach() approach was suggested by Paul Gilbert and tried, but it has so far not succeeded and, unfortunately, does not seem to be usable from source() i.e., cannot be interpreted but must be built first. JN Example using <<- rm(list=ls()) optstart<-function(npar){ # create structure for optimization computations # npar is number of parameters ?? test?? OPCON<<-list(MAXIMIZE=TRUE, PARSCALE=rep(1,npar), FNSCALE=1, KFN=0, KGR=0, KHESS=0) # may be other stuff ls(OPCON) } add1<-function(){ OPCON$KFN<<-1+OPCON$KFN...
2013 Mar 13
0
SR-IOV vs nPAR
Hi, (Already asked this on the intel wired forum: http://communities.intel.com/message/185413#185413 but some of those questiones are XEN specific, which might be why theres no response ;-) I have doubts if SR-IOV will provide the required features compared to nPAR. SR-IOV seems more flexible, but I''m not sure if performance and features are the same as nPAR. Servers will be Dell M620 with either Intel X520 or Broadcom 57810, running Linux kernel 3.8, XEN 4.2 and openvswitch 1.7 Tutorials like http://wiki.xen.org/wiki/RHEL5_CentOS5_Xen_Intel_SR-IO...
2005 Oct 23
1
Coloring leaves, twigs and labels in plot.dendrogram()
...horiz = FALSE, leafcounter = leafcounter, ...) { #cat('.') uncomment this for debugging... inner <- !is.leaf(subtree) && x1 != x2 yTop <- attr(subtree, "height") bx <- plotNodeLimit(x1, x2, subtree, center) xTop <- bx$x hasP <- !is.null(nPar <- attr(subtree, "nodePar")) if (!hasP) nPar <- nodePar if (getOption("verbose")) { cat(if (inner) "inner node" else "leaf", ":") if (!is.null(nPar)) { cat(" with node pars...
2002 Feb 11
0
profile
...;, 'eta2') simparj.fm <- nls(Y.simulated ~ Y.model(gN, MnmN, OptN, DIs, beta, eta1, eta2, Popn, Dmax, AWC, SumEp, PotYield3, Nsupply), start = simparj.st, trace =T) pr1<-profile(simparj.fm) # define a new profile function pr2<- function (fitted, which = 1:npar, maxpts = 100, alphamax = 0.01, delta.t = cutoff/5) { f.summary <- summary(fitted) std.err <- f.summary$parameters[, "Std. Error"] npar <- length(std.err) nobs <- length(resid(fitted)) cutoff <- sqrt(npar * qf(1 - alphamax, npar, nobs - npar))...
2004 Oct 31
2
Obtaining fitted model information
...st, I am brand new to R and using Dalgaard's (2002) book Introductory Statistics with R (thus, some of my terminology may be incorrect). I am fitting regression models and I want to use Hurvich and Tsai's AICC statistic to examine my regression models. This penalty can be expressed as: 2*npar * (n/(n-npar-1)). While you can obtain AIC, BIC, and logLik, I want to impose the AICC penalty instead. After fitting a model. Is there a way of obtaining the "npar" and then assigning it to a variable? Essentially, I want to then write a simple function to add the AICC penalty to (-2...
2003 Jul 18
3
question about formulating a nls optimization
...ta <- data.frame(xEx,tEx,yEx) And I do the nls: aux <- nls( ~ objFun(yEx,xEx,tEx,gamma,theta,kappa), data=data, start=list(gamma=0.085, theta=8.62*10^(-5), kappa=4.45*10^(-3)), trace=TRUE) I get the following error: 179.8911 : 8.50e-02 8.62e-05 4.45e-03 Error in sum(rr[-(1:npar)]^2) : subscript out of bounds One problem that I identified is that the algorithm does not change the values of the parameters at all. It calculates the objective function OK, but the parameters are not updated. The function pdfDY is a Fourier integral with parameters xEx, tEx, gamma, theta,...
2010 Sep 15
1
optim with BFGS--what may lead to this, a strange thing happened
...-matrix(0,n,nt) v8 <-matrix(0,n,nt) regw<-matrix(0,n,nt) wden<-matrix(0,n,nt) lia<-matrix(0,n,nt) ccl<-matrix(1,n,ns) eta<-c(0,0) # setup the parts for loglikelihood q1<-exp(par[1]) pr1<-q1/(1+q1) pr2<-1-pr1 eta[2]<-par[2] a<-par[3:6] b<-par[7:11] w<-par[12:npar] for(m in 1:ns){ regw<-exp(w[1]+w[2]*eta[m])*actr+exp(w[3]+ w[4]*eta[m])*acwrk vbar2=a[1]+ eta[m]+regw*a[2]+acwrk*a[3]+actr*a[4] vbar3=b[1]+b[2]*eta[m]+regw*b[3]+acwrk*b[4]+actr*b[5] v8=1+exp(vbar2)+exp(vbar3) lia<-ifelse(home==1,1/v8, ifelse(wrk==1...
2008 Mar 27
1
A faster way to compute finite-difference gradient of a scalar function of a large number of variables
...overhead for repeated evaluation of gradient in iterative schemes is quite significant. I was wondering whether there are better, more efficient ways to approximate the gradient of a large scalar function in R. Here is an example. grad <- function(x, fn=func, eps=1.e-07, ...){ npar <- length(x) df <- rep(NA, npar) f <- fn(x, ...) for (i in 1:npar) { dx <- x dx[i] <- dx[i] + eps df[i] <- (fn(dx, ...) - f)/eps } df } myfunc <- function(x){ nvec <- 1: length(x) sum(nv...
2004 Nov 17
1
Re: variations on the theme of survSplit
...)) { n.covs <- 1 covs <- as.matrix(covs) }else{ n.covs <- 0 } } ordered.t <- t(apply(cbind(onset,time.dep),1,sort,na.last=TRUE)) tot.time.dep <- apply(ordered.t,1,function(x) sum(!is.na(x))) ordered.t <- cbind(rep(0, nrow(ordered.t)), ordered.t) npars <- 4+n.time.dep+n.covs nrecs <- sum(tot.time.dep) new.x <- as.data.frame(matrix(nr=nrecs, nc=npars)) names(new.x) <- c("start", "stop", "event", names(time.dep),names(covs),"episode") this.rec<-0 for(i in 1:length(onset)) { for(j...
2008 Aug 20
3
bug in lme4?
Dear all, I found a problem with 'lme4'. Basically, once you load the package 'aod' (Analysis of Overdispersed Data), the functions 'lmer' and 'glmer' don't work anymore: library(lme4) (fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)) (gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd), family = binomial, data
2003 Nov 21
1
: BIC for gls models
Hi all, I would like to know how the BIC criterion is calculated for models estimated using gls( ) function. I read in Pinheiro & Bates (2000) p84 that BIC = -2logL + npar*log(N) (for the ML method), or BIC = -2logLR + npar*log(N-p) (for the REML method) but when I use any of these formulae I don't obtain the result given by R. Thanks in advance for any help. Eve CORDA Office national de la chasse et de la faune sauvage (http://www.oncfs.gouv.fr) BP 20 78612...
2005 Apr 18
0
Discrepancy between gam from gam package and gam in S-PLUS
Dear Trevor, I've noticed a discrepancy in the degrees of freedom reported by gam() from the gam package in R vs. gam() in S-PLUS. The nonparametric df differ by 1; otherwise (except for things that depend upon the df), the output is the same: --------- snip ------------ *** From R (gam version 0.93): > mod.gam <- gam(prestige ~ lo(income, span=.6), data=Prestige) > summary(mod.gam) Call: gam(formula = prestige ~ lo(income,...
2008 Nov 14
0
VGAM package released on CRAN
Dear Prof. Thomas Yee I$B!G(Bm very interested in your R program VGAM. I tried below your data: # Nonparametric proportional odds model data(pneumo)pneumo = transform(pneumo, let=log(exposure.time))vgam(cbind(normal,mild,severe) ~ s(let), cumulative(par=TRUE), pneumo) However, the results by Version of VGAM are different; ----------The result by Version 0.7-7 ----------------------------- Call:...
2010 Sep 07
5
question on "optim"
...;-matrix(0,n,nt) v8 <-matrix(0,n,nt) regw<-matrix(0,n,nt) wden<-matrix(0,n,nt) lia<-matrix(0,n,nt) ccl<-matrix(1,n,ns) eta<-c(0,0) # setup the parts for loglikelihood q1<-exp(par[1]) pr1<-q1/(1+q1) pr2<-1-pr1 eta[2]<-par[2] a<-par[3:6] b<-par[7:11] w<-par[12:npar] for(m in 1:ns){ ?for(i in 1:nt){ ?? regw[,i]<-w[1]+ w[2]*eta[m]+exp(w[3]+w[4]*eta[m])*actr[,i]+w[5]*acwrk[,i] ??? vbar2[,i]=a[1]+???? eta[m]+regw[,i]*a[2]+acwrk[,i]*a[3]+actr[,i]*a[4] ??? vbar3[,i]=b[1]+b[2]*eta[m]+regw[,i]*b[3]+acwrk[,i]*b[4]+actr[,i]*b[5] ??? v8[,i]=1+exp(vbar2[,i])+exp(vbar...
2003 May 20
3
a quick Q about memory limit in R
Hello, there, I got this error when i tried to run " data.kr <- surf.gls(2, expcov, data, d=0.7);" "Error: cannot allocate vector of size 382890 Kb Execution halted" My data is 100x100 grid. the following is the summary of "data": > summary(data); x y z Min. : 1.00 Min. : 1.00 Min. :-1.0172 1st Qu.: 26.00
2018 Apr 17
1
Minor glitch in optim()
...infinity. Here's an example: # optim-glitch-Ex.R x0<-c(1,2,3,4) fnt <- function(x, fscale=10){ yy <- length(x):1 val <- sum((yy*x)^2)*fscale } grt <- function(x, fscale=10){ nn <- length(x) yy <- nn:1 # gg <- rep(NA,nn) gg <- 2*(yy^2)*x*fscale gg } npar <- 4 lower <- -Inf l2 <- rep(-Inf,npar) a1 <- optim(x0, fnt, grt, lower=lower, method="BFGS") # works a1 a1a<- optim(x0, fnt, grt, lower=l2, method="BFGS") # changes method! a1a The first call uses BFGS method without warning. The second gives a warning that L-B...
2007 Sep 07
1
negative value for AIC and BIC
Hi all, I obtained negative values for AIC and BIC criteria for a particular model that I have developped... I don't remember to have negative values for these crietria for others applications, so I am a little suprised... Could anyone tell me if something is wrong or his conclusion concerning my model? Best regards, Olivier.
2010 Feb 01
0
Building a plotmath string in a function
...of as.expressions, substitutes, evals in a loop that loops through the list of parameters sent to the function but am getting nowhere. Could someone point me to some references beyond the standard documentation that might help. Here's my latest attempt: BuildParString = function(params) { nPar = length(params) # params is a vector of numerical values s = NULL if(nPar < 1) { return } pNames = c("R","P[m]","k[a]","alpha[r]","beta[r]","phi") vparams = format(params,digits=3) s = as.expression(substitute(pp==...
2008 Dec 19
0
What BIC is calculated by 'regsubsets'?
...BIC). The following code defines a function that illustrates the issue. Thanks -Paul script.ic <- function() { library(datasets) print(names(airquality)) # Ozone Solar.R Wind Temp Month Day # Fit a model with two predictors mod1 <- lm(Ozone ~ Wind + Temp, data=airquality) npar <- length(mod1$coef)+1 # no. parameters in fitted model, # including s2, is 4 nobs <- length(mod1$fitted) # no. of observations = 116 s2 <- summary(mod1)$sigma2 # MSE = 477.6371 logL <- as.vector(logLik(mod1)) # log l...
2007 Oct 23
0
API for optimization with Simulated annealing
...ptry[i] = p[i] + scale * norm_rand(); /* new candidate point */ - } + else + genptry_default(n, p, ptry, scale, ex); } /* par fn gr method options */ @@ -275,7 +280,7 @@ } else { PROTECT(OS->R_gcall = R_NilValue); /* for balance */ } - samin (npar, dpar, &val, fminfn, maxit, tmax, temp, trace, (void *)OS); + samin (npar, dpar, &val, fminfn, &genptry, maxit, tmax, temp, trace, (void *)OS); for (i = 0; i < npar; i++) REAL(par)[i] = dpar[i] * (OS->parscale[i]); fncount = npar > 0 ? maxi...