Displaying 20 results from an estimated 900 matches similar to: "Scoping issue with irf() from {vars}"
2007 Aug 09
0
Interpret impulse response functions from irf in MSBVAR library
Hello,
I am wondering if anyone knows how to interpret the values returned by irf
function in the MSBVAR library. Some of the literature I have read indicates
that impulse responses in the dependent variables are often based on a 1
unit change in the independent variable, but other sources suggest that they
are based on a a change of 1 standard deviation. Any ideas which irf uses to
compute the
2012 Oct 07
3
get: problem with environments
Dear R users,
I am running R-2.15.1 in Linux Slackware64-14.0. Here is my minimal working example:
testfun <- function (x) {
 a <- 0;
 sapply(X="a", FUN=get, envir=sys.frame(which=x));
}
Inside R, that is R called from within a Linux terminal, the following code works:
testfun(x=5)
print(testfun(x=6))
But within rkward the above code fails and the following works:
testfun(x=1)
2009 Sep 16
3
apply function across two variables by mult factors
Greetings,
I am attempting to run a function, which produces a vector and  
requires two input variables, across two nested factor levels.  I can  
do this using by(X, list(factor1, factor2), function), however I  
haven't found a simple way to extract the list output into an  
organized vector form.  I can do this using nested loops but it isn't  
exactly an optimal approach.
Thank you
2007 Sep 12
1
vars package, impulse response functions ??
I am fitting a reduced form VAR model using VAR in the vars library. I have
several endogenous variables, and two exogenous variables. I would like to
explore the effects of a shock to one of the exogenous variables on one of
the endogenous variables. Using irf in the vars library only calculates the
irf for the endogenous variables, this is obviously by design, is there some
theoretical
2007 Oct 12
0
irfs from a no intercept VAR
Dear R users,
I need perform structural analysis on a no intercept VAR model. Unfortunately the functions irf.VAR and dfev that come with the MSBVAR package only work with objects output by the reduced.form.var function, which seems to only evaluate VAR models with intercept. Is there a way to suppress the estimation of intercept term in reduced.form.var? Do I need to modify the code, and if I
2012 Oct 22
0
"Vars" package: impulse response function
Hello,
I'm using VAR models in R in order to obtain impulse responses of stock
market shock on US economy.
I have series of quarterly changes in real gdp, S&P 500 and quarterly level
of unemployment for 1985 - 2012 period.
My series are stationary. So I did all the steps below. However I don't
understand what do irf function results mean. These are the cumulative
orthogonal responses
2010 Nov 30
3
saving multiple panes to PNG
After searching multiple combinations of keywords over the past two  
days and downloading n R graphics tutorials, I have not been able to  
find anything online or in my R books about how to save multiple plot  
panes to PNG.
Specifically, I am using the irf() function in the vars package to  
generate plots of Impulse Response Functions:
 > x.data <-
2009 Jun 20
2
Special characters in Rd example section will cause errors
Hi (Duncan?),
The other day I noticed some characters will cause errors in R CMD
CHECK because of parse_Rd(), and AFAIK, these chars include '%', '{'
and '}'. For example, note the comments in the example section:
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
\name{testfun}
\Rdversion{1.1}
\alias{testfun}
\title{
A Test
}
\description{
A test
}
\usage{
testfun()
}
\value{
NULL
}
2012 Jul 09
1
Using loops to create matrices where the variables is called with $
Hi there,
I am trying to make a VECM model which does a loop to pull of long run
impact coefficients. The problem is that to calculate these for a,b,c I use
the irf() function and they are stored in irf$a, irf$b, irf$c. What I would
really like is to be able to call irf$[variablename(x)] where I can loop
through i:n for x and it will pull out the right variable. This is a bit of
a waste of time
2007 Oct 13
2
a question on impulse responses
Dear R users,
I am using the vars package to calculate the impulse response functions and the forecast error variance decomposition of a VAR model. Unfortunately I do not know whether these functions assume unit or one standard deviation shocks. I tried to look into the code of these functions, but in vain: neither irf, nor vars::irf, nor vars:::irf output the code of the functions. Does someone
2012 Aug 08
1
random number generator with SNOW/ Parallel/ foreach
Dear All,
I have three classes of questions about generating random numbers with
different packages (windows xp 32bit R).
.
1. Suppose I would like to use package *foreach*, can I use current
Sys.time as a seed?
Although I can get the time up to1e-6 second precesion, the code below dose
not work well on a local machine with two cores. #################
library(foreach)
library(snow)
2011 Jul 12
2
foreach not recognizing functions in memory
All,
I am not understanding the scoping used in foreach when it is used
inside a function.  I keep getting "could not find function" errors for
functions that are in memory when I try to use foreach within a function
call.  I have a simple example below.  "testFun" is in memory and works
when called by foreach directly, but when I place foreach in a function
called
2015 Feb 18
0
Different serialization of functions in interactive vs. batch mode
On Wed, 18 Feb 2015, Holger Hoefling wrote:
> Hi Luke,
>
> Ah - I see - thank you! This at least points me to a way on how to
> "fix" this. I tried setting the srcref attribute to NULL, but the hash
> value is still different and so is the serialization. So this looks
> like it is one difference, but not all of them
when source attributes are attached they are
2015 Feb 18
4
Different serialization of functions in interactive vs. batch mode
Hi Luke,
Ah - I see - thank you! This at least points me to a way on how to
"fix" this. I tried setting the srcref attribute to NULL, but the hash
value is still different and so is the serialization. So this looks
like it is one difference, but not all of them
Even if all differences were identified - it still leaves me with
different behavior between interactive and batch-mode,
2015 Feb 18
0
Different serialization of functions in interactive vs. batch mode
Add
attributes(testfun)
and you will see where the two functions differ.
luke
On Wed, 18 Feb 2015, Holger Hoefling wrote:
> Hi,
>
> I posted this question to the regular help list, but it seems to be
> this is probably a question that is better addressed on r-devel. Sorry
> for the double posting.
>
> I am using hash-values to cache certain results in R. This caching
>
2015 Feb 18
0
Different serialization of functions in interactive vs. batch mode
Holger,
For me (see session info) using
digest(as.list(f))
gets around this problem.
~G
> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9]
2006 Dec 20
4
R windows crash (PR#9426)
Full_Name: Robert Denham
Version: R-2.4.1
OS: Windows Xp
Submission from: (NULL) (61.88.57.1)
R gui exits without warning when I run a function which has an argument with a
default that is not found.  
This was a result of an error in a function I wrote, but I thought that it
should exit more gracefully than it does. Here is an example:
testfun <- function(aa=aa) {
    aa <-
2015 Feb 18
1
Different serialization of functions in interactive vs. batch mode
Hi Gabriel,
thanks for your reply - it does solve the problem of my toy function,
but does come with some other problems though.
a) as.list(f)[[1]] yields an expression, not a function. In order to
go the route you are suggesting, I would more likely use "deparse" in
order to get the original back
b) and more seriously - as.list strips the environment of the function
(and thus
2007 Oct 12
1
calculate impulse responses
Dear R users,
I need perform structural analysis on a no intercept VAR model. Unfortunately the functions irf.VAR and dfev that come with the MSBVAR package only work with objects output by the reduced.form.var function, which seems to only evaluate VAR models with intercept. Is there a way to suppress the estimation of intercept term in reduced.form.var? Do I need to modify the code, and if I
2015 Feb 18
2
Different serialization of functions in interactive vs. batch mode
Hi,
I posted this question to the regular help list, but it seems to be
this is probably a question that is better addressed on r-devel. Sorry
for the double posting.
I am using hash-values to cache certain results in R. This caching
also depends on the hash-value of the function that is being cached
(calculated using the digest package). I noticed that computations
that should already be cached