Displaying 20 results from an estimated 53 matches for "par2".
Did you mean:
par
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 = 25))
df <- data.frame(par1, par2, fac1, fac2)
Now, I would like to calculate e.g. the &q...
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, g2, g3 may
appear to be in different orders. So that final effect of the passing is
f = function(X ) {
process1(X)
g1(X, par1)
g2(X, par2)
g3(X,...
2006 Feb 08
1
expand.grid without expanding
...ith 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.:
> expand.grid(par1=-1:1,par2=c('a','b'))
par1 par2
1 -1 a
2 0 a
3 1 a
4 -1 b
5 0 b
6 1 b
There is nothing wrong with this nice function except when you have too many
combinations to fit in your computer memory, and that was my problem: I
wanted to do something for each com...
2007 Dec 19
2
recode based on filter
...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")
par2=c(3,4,4,3,5,2,4,3,2)
DATA=data.frame(know1,par1,know2,par2)
it represents answers in a questionnaire, where respondents evaluate two
things (par1 and par2) but they also indicate, whether they have detailed
knowledge about those two things (know1 and know2).
I need to test correlations between...
2008 Aug 26
1
no output when run densityplot...
...(x$pending)
> bitmap(file="tmp")
> densityplot(~y,col="black",main="x")
> dev.off()
Basically, they are the same lines inside the script, I got the expected
output.
I appreciate you advice,
The script code:
totalgraphics <- function(server,status) {
par2 = '0'
par1 = '0'
filename <- paste(server,status,sep='.')
filename <- paste('./pre-processed/',filename,sep='')
v <- read.csv(file=filename,sep=',')
x <- v[[status]]
par1 <- as.numeric(par1)
par2 <- as.numeric(par2)
x <- as.ts(x)...
2009 Jun 16
1
Constrained Optimization, a full example
...d 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 into the range 0.0
<= par2 <= 1.0 and 0.0 <= par3 <= 1.0.
I am not at all sure that ui and ci are defined correctly.
The call to constrOptim returns normally, but without a solution
(apparently).
Any suggestions appreciated.
Thanks
Stu
# data
y <-
c(0.111111...
2000 Dec 29
0
Is this a bug? Having cex!=1 before setting par(mai=) gives strange line spacings.
...ld i know what to ask\nif the person answering was you\n\n(Ernst Jandl, stanzen)")
dev.off()
> windows(width=width, height=height, rescale="R")
>
> ## changing par(cex=) alone does NOT change par("csi")
> par(cex=1)
> par1 <- par()
> par(cex=2)
> par2 <- par()
> all.equal(par1, par2)
[1] "Component cex: Mean relative difference: 1"
> par1$cex
[1] 1
> par2$cex
[1] 2
>
> ## changing par(cex=) and par(mai=) DOES change par("csi")
> par(cex=1)
> par(mai=oldmai)
> par1 <- par()
> par(cex=2)
>...
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)
localfun1 <- function() fun1(n, p1)
localfun2 <- function() fun2(n, p2)
vp<-replicate(nsim,t.test(localfun1(), localfun2())$p.value)
return(vp)...
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
parms<-c(kel=kel,Vd=Vd)
C1.lsoda<-data.frame(lsoda(Dose/Vd,c(0,time),defun,parms))
cat("...
2012 Dec 16
1
nls for sum of exponentials
...am using DEoptim package to pick the
most optimal start values -
fm4 <- function(x) x[1] + x[2]*exp(x[3] * -dist) + x[4]*exp(x[5] * -dist)
fm5 <- function(x) sum((wcorr-fm4(x))^2)
fm6 <- DEoptim(fm5, lower=c(0,0.1,1,0.1,1), upper=c(10e7, 100, 300,100, 300
), control=list(trace=FALSE))
par2 <- fm6$optim$bestmem
names(par2) <- c("c", "A", "n1", "B", "n2")
fit2 <- nls(wcorr ~ (c + A*exp(n1 * -dist) + B*exp(n2 * -dist)),
start=par2,control
=list(maxiter=1000, warnOnly=TRUE))
However, I keep getting the following error -
Error...
2009 Nov 14
3
pan news reader
Does anyone know if the pan news reader works
on CentOS 5.4? I am considering installing
version 0.132 that I downloaded from
pan.rebelbase.com .
Thanks for your advice.
Mike.
2004 Dec 14
1
Multiple options for a package
...=value) and getOption("par")
I was aking myselft what would be the "better" strategy to handle a bunch
of options for a package.
I ended up with the idea of storing a list, as my options would also be
classified, with something like:
--
MyPkgOptions =
list(set1=list(par1=1,par2=2),set2=list(subset1=list(par1=11,par2=22),subset2=list(par1=111,par2=222)))
options(PkgName=MyPkgOptions)
--
Then, to make easier the access to an element, I tweaked a little bit
getOption, with the following version:
--
getOption <- function(x,...)
{
op = options(x)[[1]]
if (length(li...
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,"
That is what I did and I can't find the mistake. I just want to have "test" without quotes (to do eval(ausdruck...
2009 Dec 29
1
(no subject)
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 ) {
process(X)
...
process(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.
2012 May 09
0
Error in outer() : dimension mismatch
...ives an error which is due to the outer function. I have tested
the program with another simpler function and it works. So, I know that the
problem is in the function that I have written. Below I copy the error and the part of the
program (the function) which causes the error:
Error: outer(par1, par2, y1, y2, FUN = function.subplot, KERNEL = KERNEL,:
dims [product 25921] [1] does not match the length of the object.
par1 <- seq(-3,3,0.1)
par2<- seq(-3,3,0.1)
x<-cbind(par1,par2) # par1:parameter1,
par2: parameter2, sigma is the third parameter that I fix
densityfunction <- f...
2009 May 20
1
SEM:Standard error of std.coef estimates?
...es someone know how to get
std.coef to show the standard error of the standardized path coefficients as
well?
Thanks,
Bastiaan
PS:
When I use std.coef, all I get is this:
std.coef(path.model.SSI4)
Std. Estimate
par1 par1 0.39499 com_veg <--- tempm
par2 par2 0.35231 SNutBili <--- tempm
par3 par3 -0.68170 S_SSI4 <--- tempm
par4 par4 -0.39145 com_veg <--- Wdeficit
par5 par5 -0.60025 SNutBili <--- Wdeficit
par6 par6 -0.20562 S_SSI4 <--- Wdeficit
par7 par7 0.14871 SNutBili <--- com_veg
par8...
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
Zipf 0.11033 -0.74705 61.0465 340.9567 346.0219
Mande...
2001 Jan 15
1
Re: AW: par(par()) corrupts devices (PR#807)
...oldpin))
> plot(1,1)
> }
>
> windows(5,3)
>
> par(pty="s")
> plot(1,1)
> # square
> par(pty="m")
> plot(1,1)
>
> # which settings do we have before
> par1 <- par()
>
> somefunc()
>
> # which settings do we have now
> par2 <- par()
> # do they differ: yes on plt
> all.equal(par1, par2)
>
> # reset plt
> par(plt=par1$plt)
>
> # which settings do we have now
> par2 <- par()
> # do they differ: no
> all.equal(par1, par2)
>
> par(pty="s")
> plot(1,1)
> #still n...
2012 May 15
0
Indexing in summaryBy
...simulation runs.
I need to calculate the root mean squared error. For each estimate I extract
the corresponding parameter value from the column name of the estimates:
rmse <- function(est){
parname <- deparse(substitute(est))
par1 <- unlist(strsplit(parname, c("\\.")))[1]
par2 <- eval(parse(text=par1))
sqrt(sum((par2- est)^2) /length(est))
}
This works well for subsets (i.e. given parameter combinations), but not
inside the summaryBy function because I cannot index properly.
data1 <- subset(mydata, X==1)
rmse(data1$b0.m1)
summaryBy(b0.m5 X, data=mydata, FUN=c(...
2001 Jan 15
1
Memory problem 2 (PR#815)
Dear R-developer,
Just some more details on the problem I reported several minutes ago.
On an NT machine (4.0 SP6) I got the following for the same task:
> version
_
platform i386-pc-mingw32
arch x86
os Win32
system x86, Win32
status
major 1
minor 2.0
year 2000
month