similar to: (no subject)

Displaying 20 results from an estimated 2000 matches similar to: "(no subject)"

2009 Dec 29
2
pass functions and arguments to function
Hi, I wonder how to pass several functions and their arguments as arguments to a function. For example, the main function is f = function(X ) { process1(X) ... process2(X) } I have a few functions that operate on X, e.g. g1(X, par1), g2(X, par2), g3(X, par3). par1, par2 and par3 are parameters and of different types. I would like to pass g1, g2, g3 and their arguments to f and g1,
2009 Jun 16
1
Constrained Optimization, a full example
After a few days of work, I think I nearly have it. Unfortunately, theta is unchanged after I run this (as a script from a file). I thought that theta would contain the fitted parameters. The goal here is to find the least squares fit according to the function defined as "rss" subject to the constraints defined as ui and ci. I defined ui and ci to (hopefully) force par2 and par3
2006 Feb 08
1
expand.grid without expanding
Dear list, I've recently came across a problem that I think I've solved and that I wanted to share with you for two reasons: - Maybe others come across the same problem. - Maybe someone has a much simpler solution that wants to share with me ;-) The problem is as follows: expand.grid() allows you to generate a data.frame with all combinations of a set of values, e.g.: >
2009 May 20
1
SEM:Standard error of std.coef estimates?
Hi, I am currently working with the sem package in R, to create pathway diagrams. Id like to use the standardized path coeffcients. To get these, I use std.coef. However, using this yields only the standardized coefficients, but does not give me the standard error. Does someone know how to get std.coef to show the standard error of the standardized path coefficients as well? Thanks, Bastiaan
2011 Feb 04
2
vegan and sweave using xtable
Dear all, Using: library(vegan) data(BCI) mod <- radfit(BCI[1,]) mod RAD models, family poisson No. of species 93, total abundance 448 par1 par2 par3 Deviance AIC BIC Null 39.5261 315.4362 315.4362 Preemption 0.042797 21.8939 299.8041 302.3367 Lognormal 1.0687 1.0186 25.1528 305.0629 310.1281
2005 Mar 02
1
Rounding parameter values in genoud(), Rgenoud package
I would like to limit the significant figures of the calibrated parameters determined by genoud() in the Rgenoud package. Below is some example output, where column 1 is model run number, columns 2-7 are the parameter values, and columns 8-12 are model fit statistics. I would like genoud to internally limit parameters to 4 decimal places as shown in this output. It is clear that the function is
2007 Oct 30
2
flexible processing
Hello, unfortunately, I don't know a better subject. I would like to be very flexible in how to process my data. Assume the following dataset: par1 <- seq(0,1,length.out = 100) par2 <- seq(1,100) fac1 <- factor(rep(c("group1", "group2"), each = 50)) fac2 <- factor(rep(c("group3", "group4", "group5", "group6"), each =
2007 Dec 19
2
recode based on filter
Hi, I have a data frame DATA, which (simplified of course) looks like this: know1 = c("Y","N","N","Y","N","N","Y","Y","N") par1=c(1,4,5,3,3,2,3,3,5) know2 = c("Y","Y","N","Y","N","N","N","Y","Y")
2011 Apr 07
2
Two functions as parametrs of a function.
Hi R users: I'm trying to make a function where two of the parameters are functions, but I don't know how to put each set of parameters for each function. What am I missing? I try this code: f2<-function(n=2,nsim=100,fun1=rnorm,par1=list(),fun2=rnorm,par2=list()){ force(fun1) force(fun2) force(n) p1<-unlist(par1) p2<-unlist(par2) force(p1) force(p2)
2005 Dec 05
1
how to save output all together
Dear R users: I have a problem about catch the value from function. I have following two functions (part): sbolus1 <- function() { ....... for( i in 1:Subject) { kel<-par1 Vd<-par2 PKindex<-sbolus1.out(PKtime,kel,Vd,defun,par1,par2,Dose,i) } savefile(PKindex) } sbolus1.out<-function(PKtime,kel,Vd,defun,par1,par2,Dose,i) { time<-PKtime$time
2004 Dec 14
1
Multiple options for a package
Hi R-devel, I am facing a situation where the number of options I would like to propose to the user is somewhat big (and could easily increase more and more as I will code up a little more - even coming to a point where an user should be able to implement his own options). What we have to handle options is the couple: options(par=value) and getOption("par") I was aking myselft what
2009 Dec 11
4
get the enclosing function name
Hi, Is there a way to get the enclosing function name within a function? For example, I would like to have a function getEnclosingFunctionName(). It works like below f = function(){ print(getEnclosingFunctionName()) } f() # will print "f" Thanks Jeff
2005 Nov 22
1
problem with "parse"
Hi there again, I have a problem with the "parse"-command. First of all, I show you in a simplified way, what I am trying to do and what "R" answers: > test [1] "u.g$par1, u.g$par2" > mode(test) [1] "character" > ausdruck <- parse(text = test) Error in parse(file, n, text, prompt) : syntax error in "u.g$par1,"
2009 Jun 17
0
Curve fit a nonlinear equation with box constraints: success, many thanks!
Dear R Helper Community! Thank you for all your help and suggestions. For your reference and any future person searching the archives, here is the solution that did what I wanted it to do. As background, my goal was to find the coefficients for the following equation form: y ~ c1 * x1 * x2 ^ -c2 *x3 ^ c3 where y, x1, x2, and x3 are observed data, and c1, c2 and c3 are regression
2012 Feb 13
0
Error from GNLS (undefined columns selected)
 Dear R-helpers, I'm a new R-user and I was trying to gain some experience with the GNLS function of the NLME package.  This is an extract from my dataset (it's a 432x6 data.frame) called "input", in the first column I have the values that I need to fit, while the remaining columns are input variables for the theoretical model, the function "mymodel" (which returns a
2009 Nov 16
8
extracting the last row of each group in a data frame
Hi, I would like to extract the last row of each group in a data frame. The data frame is as follows Name Value A 1 A 2 A 3 B 4 B 8 C 2 D 3 I would like to get a data frame as Name Value A 3 B 8 C 2 D 3 Thank you for your suggestions in advance Jeff
2012 Jun 06
1
error calling Winbugs using R2WinBugs to run a multi-level model
Dear all, I'm calling Winbugs (1.4.3) through R2WinBugs (2.1-18 coda_0.14-7) to fit a switching random walk model, but come up with an instant trap with the log only displaying 'check('. I will paste the trap with session info below; I'd be very grateful for any ideas. Couple of leads: 1. I presume the problem relates to the r package itself or the way I call bugs(), because I
2009 Dec 02
4
sort a data frame by a vector
Hi, I have a a vector and a data frame with two columns vec = c("C", "A", "B") dataDF = data.frame(A1 = c("B", "A", "C"), A2 = c(1,2,3)) I would like to sort the data frame by column A1 such that the order of elements in A1 is as the same as in vec. After the ordering, the data frame would be A1 A2 C
2004 Feb 11
6
lapply and dynamically linked functions
Hi all, I'm trying to use lapply on a list with the following command: out<-lapply(mylist,myfun,par1=p,par2=d) (1) where myfun<-function(x,par1,par1) {.....} (2) now this function is in fact a wrapper for some Fortran code I have written so I think this might be the problem. When I call lapply() as in (1) I get the following message: Error in get(x,
2011 Mar 15
1
Problem with nls.lm function of minpack.lm package.
Dear R useRs, I have a problem with nls.lm function of minpackl.lm package. I need to fit the Van Genuchten Model to a set of data of Theta and hydraulic conductivity with nls.lm function of minpack.lm package. For the first fit, the parameter estimates keep changing even after 1000 iterations (Th) and I have a following error message for fit of hydraulic conductivity (k); Reason for