Displaying 5 results from an estimated 5 matches for "funb".
Did you mean:
fun
2008 May 15
1
logistic transformation using nlminb
...<- nlminb(rep(0,4), lower=rep(0,4), upper=c(0.35, 1, 1, 1) ,
obj.funA, mat=mat)
opt.x <- opt$parameters
opt.x <- c(opt.x, 1-sum(opt.x))
opt.x
# Result
[1] 0.34999902 0.06475651 0.00000000 0.16561760 0.41962686
However, I don't get the same result from the logistic transformation
obj.funB <- function(opt, mat) {
opt <- c(opt, 0)
opt <- exp(opt)/sum(exp(opt))
LinearComb <- mat%*%opt
obj <- -min(LinearComb)
obj
}
opt <- nlminb(rep(0,4), upper=c(log(0.35), NA, NA, NA), obj.funB, mat=mat)
opt.x <- opt$parameters
opt.x <- c(opt.x, 0)
opt.x <- exp(op...
2024 Aug 09
3
If loop
...available outside the function. I don't speak functional
> programming articulately enough but basically
>
> v <- 1
>
> funA <- function() {
> v <- v+1
> }
>
> funA()
> cat (v)
>
> # 1
>
> You either return the v from the function so
>
> funB <- function() {
> v <- v+1
> return (v)
> }
>
> v <- funB()
> cat (v)
> #2
>
> Or use <<- assignment I think. (I usually return, but return can only
> return one object and I think you want two or more
>
> v <- 1
> funC <- function() {
&g...
2024 Aug 09
2
If loop
...to update the values of an object from within the function,
and have them available outside the function. I don't speak functional
programming articulately enough but basically
v <- 1
funA <- function() {
v <- v+1
}
funA()
cat (v)
# 1
You either return the v from the function so
funB <- function() {
v <- v+1
return (v)
}
v <- funB()
cat (v)
#2
Or use <<- assignment I think. (I usually return, but return can only
return one object and I think you want two or more
v <- 1
funC <- function() {
v <<- v+1
}
funC()
cat (v)
#2
On Fri, 9 Aug 2024, 09:03...
2011 Sep 06
2
Generalizing call to function
Hello guys,
I would like to ask for help to understand what is going on in
"func2". My plan is to generalize "func1", so that are expected same
results in "func2" as in "func1". Executing "func1" returns...
0.25 with absolute error < 8.4e-05
But for "func2" I get...
Error in dpois(1, 0.1, 23.3065168689948, 0.000429064542600244,
2024 Aug 09
1
If loop
Thanks. Hmm. The loop is doing what it is supposed to do.
> try1<-function(joint12=FALSE,marg1=FALSE,marg2=FALSE,
+??????????????? cond12=FALSE,cond21=FALSE){
+ # ***************************************************
+ # Testing if loop
+ # ***************************************************
+ if(joint12){
+?? {print ("joint12"); cat(joint12,"\n")}
+?? {print