Displaying 20 results from an estimated 40000 matches similar to: "(no subject)"
2013 Jan 07
3
multiple versions of function
dear R experts:
I want to define a function the calculates the black-scholes value.
it takes 5 named parameters, BS <- function(S,K,dt,rf,sigma) {} .
let's presume I want to be able to call this not only with my 5
numeric vectors BS( sigma=0.3, S=100, K=100, dt=1, rf=0.1 ) and BS(
100, 100, 1, 0.1, 0.3), but also with a data frame that contains the
variables alll in a neat data frame
2011 Sep 26
2
Triangular matrix upper to down
Hi,
suppose that we have a triangular upper matrix A
test <- matrix(ncol = 4, nrow = 4)
test[1, ] <- c(NA,1,1,1)
test[2, ] <- c(NA,NA,1,1)
test[3, ] <- c(NA,NA,NA,1)
test[4, ] <- c(NA,NA,NA,NA)
I know how quickly set diagonal value diag(test) <- 1. But how quickly set
down value i.e. matrix is symmetrical? Is there in r project any quickly
function?
Thanks,
Best
Marcin
2012 Sep 11
2
splines package
Hello all,
I have been working with b-splines and noted that the splines package is
not available in CRAN. Does any body know what happened with it?
Or, is there any package that replaces it?
Thank you
Felipe Parra
[[alternative HTML version deleted]]
2010 May 13
1
GAM, GAMM and numerical integration, help please
I am trying to apply methods used by Chaloupka & Limpus (1997) (
http://www.int-res.com/articles/meps/146/m146p001.pdf) to my own turtle
growth data.
I am having trouble with two things...
1) After the GAM is fit, the residuals are skewed.
>m1 <- gam(growth~s(mean.size,
bs="cr")+s(year,bs="cr",k=7)+s(cohort,bs="cr")+s(age,bs="cr"),
data=grow,
2011 Nov 14
2
how to include integrate in a function that can be solved with uniroot?
Hallo,
I am trying to define expectation as an integral
and use uniroot to find the distribution parameter
for a given expectation.
However I fail to understand how to define properly
the functions involved and pass the parameters correctly.
Can anyone help me out?
Thanks,
Gerrit Draisma.
This what I tried:
=======
> # exponential density
> g <- function(x,lambda){ lambda
2008 Nov 18
2
error in function: nls (urgent)
Hi,all:
I am running a nonlinear regression and there is a problem.
There is a data frame: data
p s x t
1 875.0 12392.5 11600 0.06967213
2 615.0 12332.5 12000 0.06967213
3 595.0 12332.5 12000 0.06967213
4 592.5 12337.0 12000 0.06967213
5 650.0 12430.0 12000 0.06967213
6 715.0 12477.5 12000 0.06967213
.
.
.
.
str(data):
'data.frame': 234 obs. of 4 variables:
2011 Sep 03
1
Bootstrapping a covariance matrix
Dear all I am a bit new to R so please keep your swords sheathed!
I would simply like to bootstrap a covariance matrix from a multivariate
gaussian density. At face value that seemed like a very straightforward
problem to solve but I somehow could not get the boot package to work and
did not really understand the documentation so I tried to do the bootstrap
manually. Hence:
x<-rmvnorm(n = 5,
2012 Oct 06
3
vector is not assigned correctly in for loop
Hi there,
Here is a minimum working example:
----------------------------------------------------------------
lower = 0
upper = 1
n_bins = 50
interval = (upper - lower) / n_bins
bins = vector(mode="numeric", length=n_bins)
breaks = seq(from=lower + interval, to=upper, by=interval)
for(idx in breaks)
{
bins[idx / interval] = idx
}
print(bins)
2013 Oct 31
1
an rpy2, R cgi type question
Hi again.
I'm putting together a little project with R, python, and a website. So I
have an HTML file, a py file, an R file.
Here is the HTML file:
<form action="/cgi-bin/radio4.py" method="post" target="_blank">
<input type="radio" name="subject" value="Integrate" /> Integrate
<input type="radio"
2014 Jan 28
3
[PATCH 1/2] daemon: If /selinux exists in the guest, bind-mount /sys/fs/selinux to there.
Commit 72afcf450a78b7e58f65b4a7aaf94d71cd25fca5 was partially
incorrect. If the guest userspace is expecting /selinux to exist,
then we should bind-mount /sys/fs/selinux from the appliance kernel
there.
---
daemon/command.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/daemon/command.c b/daemon/command.c
index 1aa1a52..939bf87 100644
--- a/daemon/command.c
2011 Oct 18
2
About an integral univariate problem
Hello all R users
I want to calculate this univariate integral:
exp(-x)*sum(y^x) respect to x from 0 to 3 where y is a vector y=(2,3,5).
In fact, the original y vector has a large number of elements but I propose
with 3 elements.
I know that I can resolve this problem doing
fun <- function(x) exp(-x)*(2^x+3^x+5^x)
integrate(fun,0,3)
When the y vector has a large number of elements the
2012 Aug 21
5
[PATCH 1/2 v1] blkdrv: Add queue limits parameters for sg block drive
This patch adds some queue limit parameters into block drive. And inits them
for sg block drive. Some interfaces are also added for accessing them.
Signed-off-by: Cong Meng <mc at linux.vnet.ibm.com>
---
block/raw-posix.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++
block_int.h | 4 +++
blockdev.c | 15 +++++++++++++
hw/block-common.h | 3 ++
4 files
2012 Aug 21
5
[PATCH 1/2 v1] blkdrv: Add queue limits parameters for sg block drive
This patch adds some queue limit parameters into block drive. And inits them
for sg block drive. Some interfaces are also added for accessing them.
Signed-off-by: Cong Meng <mc at linux.vnet.ibm.com>
---
block/raw-posix.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++
block_int.h | 4 +++
blockdev.c | 15 +++++++++++++
hw/block-common.h | 3 ++
4 files
2012 Aug 02
2
Rd] Numerics behind splineDesign
On 08/02/2012 05:00 AM, r-devel-request at r-project.org wrote:
> Now I just have to grovel over the R code in ns() and bs() to figure
> out how exactly they pick knots and handle boundary conditions, plus
> there is some code that I don't understand in ns() that uses qr() to
> postprocess the output from spline.des. I assume this is involved
> somehow in imposing the boundary
2006 Feb 02
1
the meaning of the B-spline coefficients
Dear all,
I'm trying to figure out the exact meaning of the B-spline
coefficients generated by the R command bs(). After reading a
lot of things, I still have no clue...
Here's my data.
> test
time f0
1 1 94.76328
2 2 102.47954
3 3 105.01234
4 4 107.21387
5 5 108.63279
6 6 109.54507
7 7 113.87931
8 8 118.21356
9 9 121.08652
10
2009 Apr 22
2
integrate lgamma from 0 to Inf
Dear R users,
i try to integrate lgamma from 0 to Inf. But here i get the message "roundoff error is detected in the extrapolation table", if i use 1.0e120 instead of Inf the computation works, but this is against the suggestion of integrates help information to use Inf explicitly. Using stirlings approximation doesnt bring the solution too.
## Stirlings approximation
lgammaApprox
2012 Feb 13
3
mgcv: increasing basis dimension
hi
Using a ts or tprs basis, I expected gcv to decrease when increasing the
basis dimension, as I thought this would minimise gcv over a larger
subspace. But gcv increased. Here's an example. thanks for any comments.
greg
#simulate some data
set.seed(0)
x1<-runif(500)
x2<-rnorm(500)
x3<-rpois(500,3)
d<-runif(500)
linp<--1+x1+0.5*x2+0.3*exp(-2*d)*sin(10*d)*x3
2012 Jul 17
2
R2WinBUGS
Dear R users,
Can anyone tell me why I might get the error message
"the array index is greater than the upper bound for t" in WinBUGS ? t is a
vector I have defined. I have checked repeatedly that the array index for t
does match with the upper bound till which the loop is run. I am facing
this problem while calling the R2WinBUGS package and both in just WinBUGS
as
2011 Oct 04
2
About stepwise regression problem
First of all, I have GAMs
noxd<-gam(newNOX~pressure+maxtemp+s(avetemp,bs="cr")+s(mintemp,bs="cr")+s(RH,bs="cr")+s(solar,bs="cr")+s(windspeed,bs="cr")+s(transport,bs="cr"),family=gaussian
(link=log),groupD,methods=REML)
Then I type " summary(noxd)". and show
Family: gaussian
Link function: log
Formula:
newNO2 ~ pressure
2009 Feb 23
1
r: intergrate behaviour
hello R users
strange behavior of the integrate function!
i assume this occurs because of the way in which the quadriture is set up! (any comments.)
f=function(x){exp(-exp(-x)-5*x)/gamma(5)}
xx=seq(from=-20, to=20, length.out=1000)
plot(xx,f(xx),type="l")
integrate(f, lower=-Inf, upper= 1)
integrate(f, lower=-Inf, upper= 10)
integrate(f, lower=-10, upper= 11)
integrate(f,