similar to: Quicker way to apply values to a function

Displaying 20 results from an estimated 3000 matches similar to: "Quicker way to apply values to a function"

2012 Mar 23
1
Vectorize (scalar) function
Hi all, myint=function(mu,sigma){ integrate(function(x) dnorm(x,mu,sigma)/(1+exp(-x)),-Inf,Inf)$value } x=seq(0,50,length=3000) x=x[-1] plot(x,myint(4,x)) # not working yet I think I have to 'Vectorize' it somehow? What's a scalar function? and a primitive function? Thanks. casper ----- ################################################### PhD candidate in Statistics School
2009 Aug 12
2
Using bold font with bquote
I'm trying to annotate a density plot and I'm using bquote to paste the sigma symbol next to the numeric text of the standard deviation calculation that I am performing. I have been able to successfully turn the sigma symbol and numeric output the color blue, but when I try to change the font of the text to bold, R doesn't seem to recognize the "font=" command in the same way
2009 Aug 12
2
Plotting sigma symbol with unicode and turning into pdf
Paul, You solution worked out really well when I ran my code in R. However, when I try to turn the plot into a pdf, the unicode string no longer seems to function and instead of the sigma symbol there are just two periods (See example code below). The following is the code working in the R environment just like I want it to look: set.seed(1) Data=rnorm(100,sd=10000) plot(density(Data))
2012 Mar 23
3
R numerical integration
Hi all, Is there any other packages to do numerical integration other than the default 'integrate'? Basically, I am integrating: integrate(function(x) dnorm(x,mu,sigma)/(1+exp(-x)),-Inf,Inf)$value The integration is ok provided sigma is >0. However, when mu=-1.645074 and sigma=17535.26 It stopped working. On the other hand, Maple gives me a value of 0.5005299403. It is an
2006 May 08
1
Calling C++ code fom R --How to export C++ "unsigned" integer to R?
Hello all, Is there a way to export C++ "unsigned" integer to R? (I am trying to parse files in "BPMAP" format, and some variables are of type unsigned int (first declared in C++) ). I know that to export signed integer to R, I can do the following in C++: int Some_INTEGER = 5; int *p_myInt; SEXP myInt; PROTECT(myInt=NEW_INTEGER(1)); myInt[0] = Some_INTEGER;
2012 Oct 20
1
Logistic regression/Cut point? predict ??
I am new to R and I am trying to do a monte carlo simulation where I generate data and interject error then test various cut points; however, my output was garbage (at x equal zero, I did not get .50) I am basically testing the performance of classifiers. Here is the code: n <- 1000; # Sample size fitglm <- function(sigma,tau){ x <- rnorm(n,0,sigma) intercept <- 0 beta
2008 Mar 19
1
Problem in using typedef with c++
Hi My code is as follows :- example.h #include"iostream.h" using namespace std; typedef int MYINT; void sum(MYINT a, MYINT b); example.cpp #include"example.h" void sum(MYINT a, MYINT b) { MYINT c; c=a +b; cout<<c; } example.i %module example %{ #include"example.h" extern void sum(MYINT a, MYINT b); %} #include "example.h"
2005 Apr 14
1
question about "R get vector from C"
Dear ALL-R helpers, I want to let R get vector from c ,for example :numeric array ,vector .I saw some exmple like this : /* useCall3.c */ /* Getting an integer vector from C using .Call */ #include <R.h> #include <Rdefines.h> SEXP setInt() { SEXP myint; int *p_myint; int len = 5; PROTECT(myint = NEW_INTEGER(len)); // Allocating
2016 Dec 01
2
Placement new and TBAA
On Sat, Nov 26, 2016 at 12:07 AM, Sanjoy Das <sanjoy at playingwithpointers.com > wrote: > So if you: > > 1. override operator delete to do nothing for that type (so that the > placement new actually has unfreed backing storage to re-use). > 2. have an empty destructor. > So, void *operator new(decltype(sizeof 0), void *) noexcept; struct MyInt { static void
2004 Feb 03
1
Error in f(x, ...) : subscript out of bounds
R-Listers: I am doing a quasi-maximum likelihood estimation and I get a "subscript out of bound" error message, Typically I would think this means that a subscript used in the function is literally out of bounds however I don't think this is the case. All I change in the code is a constant, that is hard-wired in (not data dependent and not parameter dependent), furthermore,
2010 Nov 10
1
par mfrow in "function" problem
Hi all, I defined the following ############################# myhist=function(x){ hist(x,xlab="",main="") h=hist(x) xfit=seq(min(x),max(x),length=100) yfit=dnorm(xfit,mean(x),sd=sd(x)) yfit=yfit*diff(h$mids[1:2])*length(x) lines(xfit, yfit, col="blue", lwd=2) } ############################# individually, it worked fine however, if I used par(mfrow=c(2,2))
2012 Apr 18
0
Numerical integration again
Hi all, Here is an integration function require(pracma) # for 'quadinf' myint=function(j) { quadinf(function(x) (1/(1+exp(-x)))^j*(1-1/(1+exp(-x)))^(k-j)*dnorm(x,mu,casigma),-Inf,Inf) } in any optimization routine. It works fine most of the time but failed with some particular sets of values, say one of the following: k=20 mu=-1.978295 casigma=0.008326927 >
2018 Mar 22
2
Broken relocation for generating offsets?
Hello, I append another clue I found out: The problem is definitely not caused by "__ImageBase" the problem comes with the "OFFSET". I generated another object file which crashed. The commonality: mov edx, DWORD PTR ?normalPlanschbecken@@3HA ; normalPlanschbecken lea rcx, OFFSET FLAT :??_C at _0CC@LCMJAIPO at Reading?5?$CCnormalPlanschbecken?$CC?5?$CFi@
2004 Jun 11
1
ROC for threshold value, biometrics
Hello, I am just a beginner of R 1.9.0. I try to construct a predictive score for the development of liver cancer in cirrhotic patients. So dependant variable is binanry (cancer yes or no). Independant variables are biological data. The aim is to find out a cut-off value which differentiate (theoratically) from normal to pathological state for each biological data. How can I step in procedue to
2018 Mar 22
0
Broken relocation for generating offsets?
I wouldn't be surprised if JITing COFF files on Windows doesn't work so well, since the object file format assumes most symbols are dllimport or within the local 2GB module address range. I'm not familiar with the current JIT state of the art, though. On Thu, Mar 22, 2018 at 1:45 AM via llvm-dev <llvm-dev at lists.llvm.org> wrote: > Hello, > > I append another clue I
2009 Aug 11
1
Paste symbol and calculation in plot
I'm trying to annotate a density plot and I would like to have R calculate the standard deviation and place it in the plot next to the standard deviation symbol "sigma". I can successfully use the text command to paste "StDev =",round(sd(Data),digits=3)) on the plot. However, I have trouble when I want to replace "StDev" with the Greek symbol sigma (See code
2009 Sep 12
0
[LLVMdev] [proposal] Extensible IR metadata
On Sep 11, 2009, at 3:23 PM, David Greene wrote: > I have a few questions and comments about Chris' initial proposal as > well. > > - I don't like the separation between "built-in" metadata and > "extended" > metadata. Why not make all metadata use the RegisterMDKind > interface and > just have the LLVM libraries do it automatically for
2009 Sep 11
4
[LLVMdev] [proposal] Extensible IR metadata
On Friday 11 September 2009 15:20, Jeffrey Yasskin wrote: > I've got a suggestion for a refinement: > > Right now, we have classes like DILocation that wrap an MDNode* to > provide more convenient access to it. It would be more convenient for > users if instead of > > MDNode *DbgInfo = Inst->getMD(MDKind::DbgTag); > Inst2->setMD(MDKind::DbgTag, DbgInfo); >
2011 Feb 17
1
Integration with an Indicator Function in R
Hi all, I have some some problem with regard to finding the integral of a function containing an indicator function. please see the code below: func1 <- function(x, mu){ (mu^2)*dnorm(x, mean = mu, sd = 1)*dgamma(x, shape=2)} m1star <- function(x){ integrate(func1, lower = 0, upper = Inf,x)$val} T <- function(x){ 0.3*dnorm(x)/(0.3*dnorm(x)+0.7*m1star(x))} func2 <-
2011 Feb 17
1
Integrate with an indicator function
Hi all, I have some some problem with regard to finding the integral of a function containing an indicator function. please see the code below: func1 <- function(x, mu){ (mu^2)*dnorm(x, mean = mu, sd = 1)*dgamma(x, shape=2)} m1star <- function(x){ integrate(func1, lower = 0, upper = Inf,x)$val} T <- function(x){ 0.3*dnorm(x)/(0.3*dnorm(x)+0.7*m1star(x))} func2 <-