Displaying 20 results from an estimated 900 matches similar to: "constructing a formula"
2016 Jun 30
2
Calling C implementations of rnorm and friends
Hi all,
Looking at the body for the function rnorm, I see that the body of the
function is:
.Call(C_rnorm, n, mean, sd)
I want to implement functions that generate normal (and other) random
variables. Now, I understand that I can perfectly well just call the R
wrapper for these functions and that will be almost indistinguishable for
most purposes, but for whatever reason I wanted to try and
2016 Jul 01
2
Calling C implementations of rnorm and friends
Gabriel,
Thanks for that! I guess I really should have figured that one out sooner,
huh?
I understand why that wouldn't be CRAN-compliant. But then, what *is* the
proper way to do it? Is there any way I can call unexported functions from
another package and have it accepted by CRAN?
Also, if I instead re-write the random variable generating functions, do
you have any idea of where the
2016 Jul 01
1
Calling C implementations of rnorm and friends
Well,
For this particular use case why not just transform the parameters at the R
level and then call the existing function? Is there not a closed form
mapping?
~G
On Jul 1, 2016 2:50 PM, "Joshua Ulrich" <josh.m.ulrich at gmail.com> wrote:
> On Fri, Jul 1, 2016 at 6:13 AM, Luis Usier
> <luis.henrique.usier at gmail.com> wrote:
> > Gabriel,
> >
> >
2017 Nov 22
2
function pointers?
We have a project that calls for the creation of a list of many
distribution objects. Distributions can be of various types, with
various parameters, but we ran into some problems. I started testing
on a simple list of rnorm-based objects.
I was a little surprised at the RAM storage requirements, here's an example:
N <- 10000
closureList <- vector("list", N)
nsize = sample(x
2016 Jun 30
0
Calling C implementations of rnorm and friends
Luis,
C_rnorm is a symbol but it's not exported. This means that you *can* do
this by using stats:::C_rnorm.
That said, it's not exported, which means that it's not supported to do
this. So your package likely would not be allowed on CRAN, for example.
Best,
~G
On Jun 30, 2016 2:08 PM, "Luis Usier" <luis.henrique.usier at gmail.com> wrote:
> Hi all,
>
>
2016 Jul 01
0
Calling C implementations of rnorm and friends
On Fri, Jul 1, 2016 at 6:13 AM, Luis Usier
<luis.henrique.usier at gmail.com> wrote:
> Gabriel,
>
> Thanks for that! I guess I really should have figured that one out sooner,
> huh?
>
> I understand why that wouldn't be CRAN-compliant. But then, what *is* the
> proper way to do it? Is there any way I can call unexported functions from
> another package and have it
2006 Aug 16
2
About scaffold mean
Hello All!
I''m novice at ROR. Would you like to explain what mean such constuction in
Ruby.
1: class DemoController < ActionController::Base
2: scaffold :item
3: end
Is 2th line calling of method ''scaffold''? If it is so, when it called? For
all instances of class, or only for class?
I watch sources of ActionController, but don''t understand completely.
2003 Apr 16
2
Jackknife and rpart
Hi,
First, thanks to those who helped me see my gross misunderstanding of
randomForest. I worked through a baging tutorial and now understand the
"many tree" approach. However, it is not what I want to do! My bagged
errors are accpetable but I need to use the actual tree and need a single
tree application.
I am using rpart for a classification tree but am interested in a more
unbaised
2002 Jun 13
1
assign to data.frame
I have two large data.frames which I would like to combine. Merge works, but
is slow and a "merge" is not really required. Rather a rbind will do the
trick. However, there are a number of variables which need to be created in
each data.frame to make the columns of the two data.frames similar.
say,
d1 <- data.frame(ind1=1:10,ind2=letters[1:10],c_rnorm(10))
d2 <-
2004 Aug 27
0
questions and recommendations
Hi Yawl,
After about 6 months of prattting about I've convinced my boss that we
should be installing * into our currently under constuction Data Center in
Somerset NJ. There will be 10 permanent people and DR space for another
50.
My plan is as follows;
ATAComm dual XEON server with quad T1 board. A handfull of ATA's for fax
machines, job lot of X-Pro softphones for the DR bit, Polycom
2008 Oct 02
0
constructing appropriate non-intercept formula
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Trying to work out a model formula that will do what I want ... suppose
I want to model
y = b_i x + epsilon
(i.e. a linear model with zero intercept and with slopes differing
by groups), and I want to parameterize the slopes
in the "usual" way of having a baseline slope value
for the first level of the factor b and (n-1) values
2007 Sep 12
0
constructing an lm() formula in a function
I'm working on some functions for generalized canonical discriminant
analysis in conjunction with the heplots package. I've written a
candisc.mlm function that takes an mlm object and computes a
candisc object containing canonical scores, coeficients, etc.
But I'm stumped on how to construct a mlm for the canonical scores,
in a function using the *same* right-hand-side of the model
2001 Dec 05
2
paste doesn't appear to paste?
Sorry to be posting another question, but my learning curve is starting to
flatten some now.
What am I missing here?
> temp _ name[reis==toupper(location[order(Vgrablow2)][N])]
> temp
[1] "Lawton"
> paste(temp,g)
[1] "Lawton" # WHERE IS THE SECOND ELEMENT?
> g
[1] 0.29
> a _ "Lawton"
> paste(a,g)
[1] "Lawton 0.29"
2002 Nov 07
2
combinations
I need to construct all possible combinations of an vector of length N taken
X at a time for simulation purposes. Taking a a small vector as an example:
>input <- c('a','b','c','d')
>somefunction(input)
a,b,c
a,b,d
a,c,d
b,c,d
my only solution thus far is:
somefunction <- function(x){
...a series of grotesque and horribly inefficient loops
2002 May 01
2
predict assistance
I have a question regarding application of model coefficients between
datasets. In particular, I have several datasets which I would like to apply
a model estimated from only a single dataset (sort of a crude - out of sample
application - to show the variances).
lets say,
names(a)
[1] "stdnoi" "momentum" "tbm3" "metcons" "premium"
2004 Jan 08
2
Sweave & xtable
I am just starting to learn Sweave (really neat tool). I am pretty
early in the learning curve (I had to think a moment ago whether a # or
% was the appropriate comment character).
I have successfully incorporated simple graphics and outputs, but am
having trouble getting a latex (xtable) table to function properly.
Latex is seemingly treating the xtable code as input or verbatim text.
That
2002 Mar 18
3
function design
I have a, no doubt, simple question. I wish to write a function such
that
a <- 9
b <- 10
changer _ function(x,y) { if (y>x){ x <<- Y+1}}
Of course there are easier ways to accomplish the task above, but I am
more interested in how to have the "x <<- Y+1" part of the function to
change x in place for purposes of a much larger function.
I have been wrestling with
2012 Aug 08
3
help, please! matrix operations inside 3 nested loops
hello, this is my script:
#1) read in data:
daten<-read.table('K:/Analysen/STRUCTURE/input_STRUCTURE_tab_excl_5_282_559.txt',
header=TRUE, sep="\t")
daten<-as.matrix(daten)
#2) create empty matrix:
indxind<-matrix(nrow=617, ncol=617)
indxind[1:20,1:19]
#3) compare cells to each other, score:
for (s in 3:34) { #walks though the matrix colum by colum, starting at
2001 Nov 27
3
Equations as arguments to functions
I am trying to pass an equation as an arguement to a function, which seems
pretty straightforward given lazy evaluation.
I constructed the following little test to make sure I sort of knew what I
was doing:
go <- function(X,eq) { C <<- X*2; d <<- eq}
a _ rnorm(100)
go(10,eq=a[.5*length(a)]+C+1)
> C
[1] 20
> d
[1] 21.10551
> a[.5*length(a)]
[1] 0.1055086
Everything
2006 Jan 06
0
Constructing a query from an object
Hi,
Apart from checking each field in an object created from form
params, is there an easy way I can construct a query from an object? For
example, I''m doing this:
@candidate = Candidate.new(params[:candidate])
And go on to check each attribute if it''s blank and thereby constructing
a query. It''s pretty common, so I''m guessing there should be a easier