Displaying 20 results from an estimated 400 matches similar to: "[R-SIG-Finance] EM algorithm with R manually implemented?"
2011 Feb 26
0
A problem about realized garch model
Hi, I am trying to write the Realized GARCH model with order (1,1)
The model can be describe bellow:
r_t = sqrt( h_t) * z_t
logh_t = w + b*logh_(t-1) + r*logx_(t-1)
logx_t = c + q*logh_t + t1*z_t +t2*(z_t ^2 -1) + u_t
and z follow N(0,1) , u follow N(0, sigma.u^2)
But I'm troubled with the simulation check for my code.
After I simulate data from the model and estimate the data,
I
2012 Aug 01
1
optim() for ordered logit model with parallel regression assumption
Dear R listers,
I am learning the MLE utility optim() in R to program ordered logit
models just as an exercise. See below I have three independent
variables, x1, x2, and x3. Y is coded as ordinal from 1 to 4. Y is not
yet a factor variable here. The ordered logit model satisfies the
parallel regression assumption. The following codes can run through,
but results were totally different from what I
2012 Jul 11
2
nls problem: singular gradient
Why fails nls with "singular gradient" here?
I post a minimal example on the bottom and would be very
happy if someone could help me.
Kind regards,
###########
# define some constants
smallc <- 0.0001
t <- seq(0,1,0.001)
t0 <- 0.5
tau1 <- 0.02
# generate yy(t)
yy <- 1/2 * ( 1- tanh((t - t0)/smallc) * exp(-t / tau1) ) + rnorm(length(t))*0.01
# show the curve
2008 Apr 04
1
Problems with Unit Root testing using ur.df function
Hi All,
I'm new to R and am trying to run a unit root test on the vector "y" (a time
series of inflation (i.e. changes in the Consumer Price Index quarter on
quarter)).
I've run the Augmented-Dickey-Fuller Test below (R's URCA package). It gives
me an error that it cannot find the function ur.df unless I comment out the
third last line of code (see below).
I try to call
2009 Mar 27
1
General help for a function I'm attempting to write
Hello,
I have written a small function ('JostD' based upon a recent molecular
ecology paper) to calculate genetic distance between populations (columns in
my data set). As I have it now I have to tell it which 2 columns to use (X,
Y). I would like it to automatically calculate 'JostD' for all combinations
of columns, perhaps returning a matrix of distances. Thanks for any help
2012 Jul 12
0
Generate random numbers with nested Archimedean Copula
Hi everybody,
I try to simulate random numbers from a trivariate nested Archimedean
copula. My aim is to correlate two processes with, e.g. theta2, as the so
called child pair and then to correlate these two processes with a third one
with theta1 (parent). This "figure" tries to capture what I am explaining
theta1
theta2
2013 Mar 31
0
Skewness of fitted mixture not correct?
I fitted a gaussian mixture to my financial data. The data can be found
here: http://uploadeasy.net/upload/32xzq.rar
I look at the density with
plot(density(dat),col="red",lwd=2)
this has a skew of
library(e1071)
skewness(dat)
-0.1284311
Now, I fit a gaussian mixture according to:
f(l)=πϕ(l;μ1,σ21)+(1−π)ϕ(l;μ2,σ22)
with:
2017 Jun 04
0
Hlep in analysis in RWinBugs
Hi R User,
I was trying to use R for WINBUGS using following model and data (example), but I am new with WINBUGS and don't know how we perform the analysis. I wonder whether I can run the following the example data and Winbugs Model in R. Your help will be highly appreciated.
Sincerely,
SN PANDIT
===
library(R2WinBUGS)
#Model
model{
#likelihood
for(i in 1:N){
a1[i] ~ dnorm(a11[i],tau)
2017 Jun 04
0
Help in analysis in RWinBugs
Hi R User,
I was trying to use R for WINBUGS using following model and data (example), but I am new with WINBUGS and don't know how we perform the analysis. I wonder whether I can run the following the example data and Winbugs Model in R. Your help will be highly appreciated.
Sincerely,
SN PANDIT
===
library(R2WinBUGS)
#Model
model{
#likelihood
for(i in 1:N){
a1[i] ~ dnorm(a11[i],tau)
2008 Apr 09
0
Endogenous variables in ordinal logistic (or probit) regression
A student brought this question to me and I can't find any articles or
examples that are directly on point.
Suppose there are 2 ordinal logistic regression models, and one wants
to set them into a simultaneous equation framework. Y1 might be a 4
category scale about how much the respondent likes the American Flag
and Y2 might be how much the respondent likes the Republican Party in
America.
2010 Nov 30
1
confidence interval for logistic joinpoint regression from package ljr
I?m trying to run a logistic joinpoint regression utilising the ljr package. I?ve been using the forward selection technique to get the number of knots for the analysis, but I?m uncertain as to my results and the interpretation. The documentation is rather brief ( in the package and the stats in medicine article is quite technical) and without any good examples. At the moment I?m thinking
1)find
2009 Feb 21
0
density estimation for d>2 for the DPpackage
Dear List,
I am trying to estimate a 3 dimensional density through the DPpackage.
For example
# model
sigma <- matrix(c(0.1,0.05,0.05,0.05,0.1,0.05,0.05,0.05,0.1), ncol=3)
rnormm<- rmvnorm(n=100, mean=c(5,100,150), sigma=sigma)
sigma2 <- matrix(c(10,0.05,0.05,0.05,10,0.05,0.05,0.05,10), ncol=3)
rnormm2<- rmvnorm(n=100, mean=c(20,1,110), sigma=sigma)
rnormm<-rbind(rnormm,rnormm2)
2008 Apr 24
0
logit newbie question...
Hi, I'm new to the glm and logit world... and I'm reading some lecture notes
and examples. I would like to try and generate the same result in R.. but I
don't seem to be able to find the proper way to specify the formula....
let's say i have
Desire Using Drugs Not Using Drugs
Yes 219 753
No 288 347
Desire
2002 Aug 01
2
mdct.h - PI1_8, PI2_8 etc.
In vorbis/lib/mdct.h the following are defined:
for integer:
#define TRIGBITS 14
#define cPI3_8 6270
#define cPI2_8 11585
#define cPI1_8 15137
#define FLOAT_CONV(x) ((int)((x)*(1<<TRIGBITS)+.5))
for floats:
#define cPI3_8 .38268343236508977175F
#define cPI2_8 .70710678118654752441F
#define cPI1_8 .92387953251128675613F
#define FLOAT_CONV(x) = x
Could someone explain where these values
2009 Nov 02
1
need help in using Hessian matrix
Hi
I need to find the Hessian matrix for a complicated function from a certain
kind of data but i keep getting this error
Error in f1 - f2 : non-numeric argument to binary operator
the data is given by
U<-runif(n)
Us<-sort(U)
tau1<- 2
F1tau<- pgamma((tau1/theta1),shape,1)
N1<-sum(Us<F1tau)
X1<- Us[1:N1]
2012 Apr 11
2
What is a better way to deal with lag/difference and loops in time series using R?
Hello,
I am writing codes for time series computation but encountering some
problems
Given the quarterly data from 1983Q1 to 1984Q2
PI1<-ts(c(2.747365190,2.791594762, -0.009953715, -0.015059485,
-1.190061246, -0.553031799, 0.686874720, 0.953911035),
start=c(1983,1), frequency=4)
> PI1
Qtr1 Qtr2 Qtr3 Qtr4
1983 2.747365190 2.791594762
2000 May 10
4
Q: Problems with eigen() vs. svd()
At 01:37 PM 5/10/00 +0200, ralle wrote:
>Hi,
>I have a problem understanding what is going on with eigen() for
>nonsymmetric matrices.
>Example:
>h<-rnorm(6)
>> dim(h)<-c(2,3)
>> c<-rnorm(6)
"c" is not a great choice of identifier!
>> dim(c)<-c(3,2)
>> Pi<-h %*% c
>> eigen(Pi)$values
>[1] 1.56216542 0.07147773
These could
2002 Oct 17
0
Polar plot, circular plot (angular data)
Dear R-users,
Hereby a polar plot function for plotting angular data. I hope it will be usefull for some of you.
I had a need to plot frequencies of wind-directions. The not-that-cheap SigmaPlot software did not allow me to change the orientation of the angular axis to clockwise orientation (what is used for meteorological observations). I even tried the latest version availible at the time
2003 Jun 01
0
integrate
Im tryng to understand an error i get with integrate. this is 1.7.0 on
solaris 2.8.
##i am trying to approximate an integral of this function,
f<-function(b) exp(-(b-mu)^2/(2*tau2))/(p-exp(b))*10^6
##with
tau2 <- .005;mu <- 7.96;p <- 2000
##from -inf to different upper limits. using
integrate(f,-Inf,log(p-exp(1)))
##i get the following error:
##Error in integrate(f, -Inf, log(p -
2006 Sep 28
1
Nonlinear fitting - reparametrization help
Hi,
I am trying to fit a function of the form:
y = A0 + A1 * exp( -0.5* ( (X - Mu1) / Sigma1 )^2 ) - A2 * exp ( -0.5*
( (X-Mu2)/Sigma2 )^2 )
i.e. a mean term (A0) + a difference between two gaussians.
The constraints are A1,A2 >0, Sigma1,Sigma2>0, and usually Sigma2>Sigma1.
The plot looks like a "Mexican Hat".
I had trouble (poor fits) fitting this function to toy data