Displaying 20 results from an estimated 100 matches similar to: "optim seems to be finding a local minimum"
2009 Mar 03
1
repeated measures anova, sphericity, epsilon, etc
I have 3 questions (below).
Background: I am teaching an introductory statistics course in which we are
covering (among other things) repeated measures anova. This time around
teaching it, we are using R for all of our computations. We are starting by
covering the univariate approach to repeated measures anova.
Doing a basic repeated measures anova (univariate approach) using aov()
seems
2012 Nov 05
1
Error message in nmkb()
Hallo together,
I am trying to use the nmkb() optimizer and I have problems using the
function, as it causes the following error message
Fehler (error)* in while (nf < maxfeval & restarts < restarts.max & dist >
ftol & :
Fehlender Wert (missing value)* , wo (where)* TRUE/FALSE n?tig ist (is
required)*
*translation
Do I need to adjust the control ?
2016 Oct 08
4
optim(…, method=‘L-BFGS-B’) stops with an error message while violating the lower bound
Hello:
The development version of Ecdat on R-Forge contains a vignette
in which optim(?, method=?L-BFGS-B?) stops with an error message while
violating the lower bound.
To see all the details, try the following:
install.packages("Ecdat", repos="http://R-Forge.R-project.org")
Then do "help(pac=Ecdat)" -> "User guides, package
2020 Oct 28
2
R optim() function
Hi R-Help,
I am using R to do functional outlier detection (using PCA to reduce to 2 dimensions - the functional boxplot methodology used in the Rainbow package), and using Hscv.diag function to calculate the bandwidth matrix where this line of code is run:
result <- optim(diag(Hstart), scv.mat.temp, method = "Nelder-Mead", control = list(trace = as.numeric(verbose)))
Within the
2017 Aug 06
1
Help with optim function in R, please?
Hi all,
Many thank in advance for helping me.? I tried to fit Expectation Maximization algorithm for mixture data. I must used one of numerical method to maximize my function.
I built my code but I do not know how to make the optim function run over a different value of the parameters.? That is,
For E-step I need to get the value of mixture weights based on the current (initial) values of
2008 May 10
2
substitute in graphics - Uwe's help desk
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?...
Nom : non disponible
URL : <https://stat.ethz.ch/pipermail/r-help/attachments/20080510/28c07d4e/attachment.pl>
2011 Nov 20
2
Adding two or more columns of a data frame for each row when NAs are present.
I am fairly new to R and would like help with the problem below. I am
trying to sum and count several rows in the data frame yy below. All works
well as in example 1. When I try to add the columns, with an NA in Q21, I
get as NA as mySum. I would like NA to be treated as O, or igored.
I wrote a function to try to count an NA element as 0, Example 3 function.
It works with a few warnings,
2003 Dec 10
0
dyn.load for c code
I am learning how to load C code into R-1.8.0 on Windows 98. To this end I wrote
a small c program, downloaded the tools, perl, and mingw on the "building
R for windows" page, and proceeded to create libR.a & libRblas.a as explained
in the readme.packages. I started with a simple c program called mysum.c that can
be found on:
2013 Jan 16
1
How to call Java main method using rJava package?
Hi,
I am trying to integrate my Java program with R using rJava package. I want
to execute the whole Java program from R. The main() method in my Java code
calls all the other defined methods. So, I guess I have to call the main()
method in .jcall.
An example Java code:
*class A {
public static int mySum(int x, int y) {
return x+y;
}
public static void
2007 Jun 28
3
Function call within a function.
I am trying to call a funtion within another function
and I clearly am misunderstanding what I should do.
Below is a simple example.
I know lstfun works on its own but I cannot seem to
figure out how to get it to work within ukn. Basically
I need to create the variable "nts". I have probably
missed something simple in the Intro or FAQ.
Any help would be much appreciated.
EXAMPLE
2007 Dec 07
4
Using R function in Excel
Does anyone know a way that an function written in R can be called within a cell of an Excel spreadsheet. I would like to use the R function much as I use the native Excel functions, e.g. instead of using the excel function sum, =sum(A2,A6), I would like to use the function mysum written in R, e.g. =mysum(A2,A6).
Thanks,
John
John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
2011 Mar 30
3
optim and optimize are not finding the right parameter
Dear all,
I have a function that predicts DV based on one predictor pred:
pred<-c(0,3000000,7800000,15600000,23400000,131200000)
DV<-c(0,500,1000,1400,1700,1900)
## I define Function 1 that computes the predicted value based on pred
values and parameters a and b:
calc_DV_pred <- function(a,b) {
DV_pred <- rep(0,(length(pred)))
for(i in 1:length(DV_pred)){
DV_pred[i] <- a *
2005 Apr 15
4
function corresponding to map of perl
Is there a function in R that corresponds to the
function ``map'' of perl?
It could be called like:
vector.a <- map( vector.b, FUN, args.for.FUN )
It should execute for each element ele.b of vector.b:
FUN( vector.b, args.for.FUN)
It should return a vector (or data.frame) of the results
of the calls of FUN.
It nearly works using:
apply( data.frame( vector.b ), 1, FUN,
2006 Jun 01
4
A coding question
Dear List:
I have the follow code:
y <- replicate(10,replicate(8,sum(rnorm(rpois(1,5)))))
Now I need to apply the following condition to _every_ randomly generated
Normal number in the code above:
x - max(0,x-15) + max(0,x-90), where x represents the individual Normal
numbers.
In other words, the said condition needs to be applied before
replicate(...(replicate(...(sum(...))) takes place.
2009 Mar 08
3
Thread creation in Wine
Hi guys,
I was looking at the thread creation API.
Exactly, why do we use PTHREAD_SCOPE_SYSTEM instead of PTHREAD_SCOPE_PROCESS ?
http://source.winehq.org/git/wine.git/?a=blob;f=dlls/ntdll/thread.c#l611
What is the technical difference?
I remember, some years ago, that on SunOS 8 setting the latter it would make one thread only scheduled globally for the process, instead, using the first would
2008 Dec 07
5
How to force aggregate to exclude NA ?
The aggregate function does "almost" all that I need to summarize a datasets, except that I can't specify exclusion of NAs without a little bit of hassle.
> set.seed(143)
> m <- data.frame(A=sample(LETTERS[1:5], 20, T), B=sample(LETTERS[1:10], 20, T), C=sample(c(NA, 1:4), 20, T), D=sample(c(NA,1:4), 20, T))
> m
A B C D
1 E I 1 NA
2 A C NA NA
3 D I NA 3
4 C I
2008 May 09
1
substitute in graphics
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?...
Nom : non disponible
URL : <https://stat.ethz.ch/pipermail/r-help/attachments/20080509/4eaa6b46/attachment.pl>
2009 Jul 14
1
Incorrect comment about ISNA(x) in Arith.h (PR#13826)
R-2.9.0/include/R_ext/Arith.h has:
int R_IsNA(double); /* True for R's NA only */
int R_IsNaN(double); /* True for special NaN, *not* for NA */
int R_finite(double); /* True if none of NA, NaN, +/-Inf */
#define ISNA(x) R_IsNA(x)
/* True for *both* NA and NaN.
The first and last lines are contradictory - if R_IsNA is true only
for NA, not NaN, then ISNA should be the same.
2006 Oct 30
2
[LLVMdev] "fork" and "sync" for LLVM thread support - any comments?
Dear all,
Recently I've wanted to add support for threads to LLVM (motivated by
OpenMP, more or less), but before jumping in and implementing anything,
I thought it might be a good idea to describe what I have in mind and
ask for comments. Hence this email - if anyone has any comments, I'd be
very glad to hear them.
WHAT I'M PROPOSING:
The addition of two instructions - fork
2011 Dec 26
4
Summary tables of large datasets including character and numerical variables
Hello !
I am attempting to switch from being a long time SAS user to R, and would
really appreciate a bit of help ! The first thing I do in getting a large
dataset (thousands of obervations and hundreds of variables) is to run a SAS
command PROC CONTENTS VARNUM command - this provides me a table with the
name of each variable, its type and length; then I run a PROC MEANS - for
numerical