Displaying 20 results from an estimated 8000 matches similar to: "Displaying Results in Two Columns"
2010 Aug 19
0
Displaying of Results
I apologize if this posting shows up again, for some reason I wasn't able to post from a different account. So, here I am (reborn). Could I have some suggestions as to how I can display my results and their respective CIs in an aesthetically pleasing manner?
Below is the example code.
rm(list = ls())
set.seed(1)
func <- function(d,t,beta,lambda,alpha,p.gamma,delta,B){
d <-
2006 Dec 01
2
Non central chi squared bug (PR#9406)
Full_Name: Alan Bain
Version: 2.4.0
OS: XP
Submission from: (NULL) (155.140.122.227)
Code for pnchisq contains following
if (tSml) {
if (x> f+ theta+ 5*sqrt(2*(f+2*theta) ))){
return 1.; /* better than 0 --- but definately FIXME */
}
}
This needs to check which tail has been requested; it is only correct if the
default lower_tail=1 has been requested; for upper tail should return 0
2009 Aug 17
2
Newbie that don't understand R code
I got some R code that I don't understand.
Question as comment in code
//where is t comming from, what is phi inverse
rAC <- function(name, n, d, theta){
#generic function for Archimedean copula simulation
illegalpar <- switch(name,
clayton = (theta < 0),
gumbel = (theta < 1),
frank = (theta < 0),
BB9 = ((theta[1] < 1) | (theta[2] < 0)),
GIG = ((theta[2] < 0) |
2010 Feb 03
1
legend help
i=1
for(rate in c(2,4) ){
for(shape in c(1,3,5) ){
curve(dgamma(x,rate,shape),xlim=c(0,3),ylab="",col=i,lty=i,add=T)
i=i+1
}
}
How can I add some legend to represent these lines?
i.e. the legend is displayed as
col=1 lty=1 lambda=2 theta=1
col=2 lty=2 lambda=2 theta=3
col=3 lty=3 lambda=2 theta=5
col=4 lty=4 lambda=4 theta=1
col=5 lty=5 lambda=4 theta=3
col=6 lty=6 lambda=4 theta=5
2010 Jun 15
2
Integration problem: error in invoking an outside function
Dear all,
Currently I am trying to integrate a function which depends on four
variables, two of which are given, one is given in the integrate function,
so there is one variable to integrate on.
The code is as follows:
Pmatrix =
function(th) {
P = matrix(nrow=6, ncol=6, data=0)
P[1,1] = P[2,1]=P[3,2]=P[4,3]=P[5,4]=P[6,5]= exp(-th)
P[,6] = 1-exp(-th)
return(P)}
lim.verd =
2005 Mar 24
1
How to stop the minimization when the condition does not hold
Dear experts!
I have a minimization problem with non-linear constraint and Objective
function(theta)=lambda*(Constr)^2-f(x,theta). Theta is a vector of
parameters.
I'd like to stop the optimization after the value of the constraint is less
or equal some constant value, say d, and save the last computed value of the
function.
For this purpose, I thought to define the Objective function like
2011 Aug 18
3
Error message: object of type 'closure' is not subsettable
Dear R-users
I need to calibrate kappa, rho, eta, theta, v0 in the following code, see
below. However when I run it, I get:
y <- function(kappahat, rhohat, etahat, thetahat, v0hat) {sum(difference(k,
t, S0, X, r, implvol, q, kappahat, rhohat, etahat, thetahat, v0hat)^2)}
> nlminb(start=list(kappa, rho, eta, theta, v0), objective = y, lower =lb,
> upper =ub)
Error in dots[[1L]][[1L]] :
2005 Mar 03
2
regression on a matrix
Hi -
I am doing a monte carlo experiment that requires to do a linear
regression of a matrix of vectors of dependent variables on a fixed
set of covariates (one regression per vector). I am wondering if
anyone has any idea of how to speed up the computations in R. The code
follows:
#regression function
#Linear regression code
qreg <- function(y,x) {
X=cbind(1,x)
m<-lm.fit(y=y,x=X)
2011 Nov 10
1
Gibbs sampler
I have the following code,
gibbs <-function(m,theta = 0.25, lambda =0.55, n =1){
alpha <- 1.5
beta <- 1.5
gamma <- 1.5
x<- array(0,c(m+1, 3))
x[1,1] <- theta
x[1,2] <- lambda
x[1,3]<- n
for(t in 2:(m+1)){
x[t,1] <- rbinom(1, x[t-1,3], x[t-1,1])
x[t,2]<-rbeta(1, x[t-1,1] + alpha, x[t-1,3] - x[t-1,1] + beta)
x[t,3]
2011 Nov 07
3
Correction in error
Hello R community, following is my code and it shows error, can some one
fix this error and explain why this occurs?
gibbs <-function(m,n, theta = 0, lambda = 1){
alpha <- 1.5
beta <- 1.5
gamma <- 1.5
x<- array(0,c(m+1, 3))
x[1,1] <- theta
x[1,2] <- lambda
x[1,3]<- n
for(t in 2:m+1){
x[t,1] <- rbinom(x[t-1,3], 1, x[t-1,1])
2006 Feb 13
2
Sweave, mle and curve
I am trying to write a lesson on maximum likelihood with Sweave. I get
a surprising result with the following code, lec4.Snw:
\documentclass[a4paper,12pt]{article}
\usepackage[latin1]{inputenc}
\title{Maximum likelihood}
\author{G伱伓ran Brostr伱伓m}
\begin{document}
\maketitle
<<fig=TRUE>>=
## Simulate Y:
n <- 25
Y <- sum(rpois(n, lambda = 1))
Y
## Define minusloglik:
2010 Dec 16
1
Optim function with meta parameters
Hi guys.
I have a dataset with 4 columns. In the first and second column I have the
same qualitative variable referred to different teams of people. There are
10 teams in total and they compete against each other to perform a certain
task whose result is stored in the third column for the team recorded in the
first column, and in the fourth column for the team in the second column.
For example,
2012 Jul 20
1
fitting Ornstein-Uhlenbeck process by MAXIMUM LIKELYHOOD
Dear friends
i am trying to fit an Ornstein-Uhlenbeck process by MAXIMUM LIKELYHOOD
method.
i found these formulas on
http://www.sitmo.com/article/calibrating-the-ornstein-uhlenbeck-model/
this is the mean-reverting process
http://r.789695.n4.nabble.com/file/n4637271/process.txt process.txt
and this is the script that i am using.......
ouFit.ML=function(spread) {
n=length(spread)
2006 Nov 27
0
How to simulate data from copulas?
Dears,
I am writing sice having question about your R package "copula".
I am using this package to fit my data with some of the 22 copulas mentioned
in Nelsen 1999.
However, when trying random number generator I have got some difficulties.
For example when I have familie number A13 where cupola is equal to
C(u,v) = exp(1-((1-log(u))^theta+(1-log(v))^theta-1)^(1/theta))
devuv =
2007 Apr 29
1
probl with optimization
hi everyone!
i've got a problem in optimizing the following function
fun <- function(theta){
theta <- rbind(beta,lambda)
fun <- sum(exp(h(beta)%*%lambda))
fun
}
where h(beta) is
h <- function(beta,...){
g1 <- matrix(0,b,M)
g2 <- matrix(0,b,M)
h1 <- matrix(0,b,1)
h2 <- matrix(0,b,1)
for(f in 1:M){
for(F in 1:b){
g1[F,f] <-
2006 Jan 19
1
numericDeriv() giving a vector when multiple variables input
R Help List --
I have defined two time-series-vector-valued-functions, let them be f and g,
and want to find the numeric derivative of f with respect to the variable x
where f depends on x through g:
(d/dx)(f (g(x) )
Moreover, x is a vector
I tried this out the long way (naming every element of the x vector and then
making the 'theta' argument in numericDeriv() the character vector of
2008 Aug 12
2
Maximum likelihood estimation
Hello,
I am struggling for some time now to estimate AR(1) process for commodity price time series. I did it in STATA but cannot get a result in R.
The equation I want to estimate is: p(t)=a+b*p(t-1)+error
Using STATA I get 0.92 for a, and 0.73 for b.
Code that I use in R is:
p<-matrix(data$p) # price at time t
lp<-cbind(1,data$lp) # price at time t-1
2008 Jan 04
2
R2WinBUGS sending variables as factors
Hello R and BUGS users,
I am writing a heirarchical model in R to send to BUGS via R2WinBUGS and
I am finding it difficult to get the model to run. I seem to be having
two problems.
1) I can't seem to send variables classed as factors (Month), is there a
way do this?
2) Checking the Log in WinBUGS I can see that the model is Syntactically
correct, but Bugs is not able to recognise the the
2004 Mar 19
3
Incomplete Gamma Functions and GammaDistribution Doc errata.
Hello all,
In the course of trying to implement the CDF of an
InverseGammaDistribution, I have run across the need for an igamma()
function. Several others have needed this function but the answers I
have found so far are not totally clear to me. I'm writing for three
reasons:
1) to present a small error in the docs
2) to clarify the approach we are expected to take
3) to request,for the
2009 Dec 30
1
Fwd: Negbin Error Warnings
Dear Clara,
Thanks for the reply. I am forwarding your message to the list, ok.
When I wrote was a way of get further information to help the helpers.
happy holidays,
milton
---------- Forwarded message ----------
From: Clara Brück <clara_brueck@web.de>
Date: 2009/12/30
Subject: Re: [R] Negbin Error Warnings
To: milton ruser <milton.ruser@gmail.com>
Dear Milton,
Thanks for