plm() with maximum likelihood estimation? - instrumentation

I would like to estimate a panel data model with instrumental variables using maximum likelihood estimation. Is this possible in R?
With the plm() function from the plm package, I can instrument for endogenous variables in a panel data model with OLS, but --- as far as I know --- not MLE. By contrast, if I use the treatReg() function from the sampleSelection package, I can fit a model with IVs using MLE, but it is not built to work with panel data.
Any help would be appreciated.

Related

Estimating short- and long-run elasticities for dynamic panel with short T and large N

I want to estimate short- and long-run price elasticities for energy demand using a dynamic panel regression. My data contains of large N (>1000) and small T (12). I started with an ARDL representation as follows:
$EC_{it} = c + \sum_{j=1}^p \phi EC_{i,t-j} + \sum_{i=0}^q \theta X_{i, t-i} + \epsilon_{it}$
To estimate the parameters I would use the ARDL-PMG estimator, however the literature tells me these are biased for small T. For small T dynamic panel models the Arellano-Bond estimator is proposed, however, is it possible to estimate short-run elasticities using this estimator and furthermore I cannot find how this estimator deals with I(0)/I(1) variables (which is clear for the ARDL specification).
Thanks in advance
Hein

Feature Selection for Text Classification with Information Gain in R

I´m trying to prepare my dataset ideally for binary document classification with an SVM algorithm in R.
The dataset is a combination of 150171 labelled variables and 2099 observations stored in a dataframe. The variables are a combination uni- and bigrams which were retrieved from a text dataset.
When I´m trying to calculate the Information gain as a feature selection method, the Error "cannot allocate vector of size X Gb" occurs although I already extended my memory and I´m running on a 64-bit operating system. I tried the following package:
install.packages("FSelector")
library(FSelector)
value <- information.gain(Usefulness ~., dat_SentimentAnalysis)
Does anybody know a solution/any trick for this problem?
Thank you very much in advance!

Minimize a cost function?

I have a cost function and its gradient calculated with finite element discretization (values at integrations points) and I have the data in a text file.
The problem is the cost function and its gradient not mathematically explicit, calculated numerically at some points xi in volume V at each increment of time t using the finite element method. The results for the function and its gradient are stored in a text file.
How to minimize this function? any idea?
Thanks for your help
I don’t think you can do what you’re thinking to do. If your finite element simulations are already done then the only thing you can do is to create a proxy model of your results as a function of your parameters. One possibility is to model your results by interpolating them (using for example SciPy griddata https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.griddata.html) and use that as your proxy model.
Then you select your favorite optimization algorithm, specify your parameters (that have to be part of the griddata interpolant) and you’re ready to go. Depending on how many finite element simulations you have done you can expect very bad/meaningless outcomes (if you have too few) or very good ones (if your finite element simulations cover almost the entire optimization space).

Learning parameters of each simulated device

Does tensorflow-federated support assigning different hyper-parameters(like batch-size or learning rate) for different simulated devices?
Currently, you may find this a bit unnatural, but yes, such a thing is possible.
One approach to doing this that is supported today is to have each client take its local learning rate as a top-level parameter, and use this in the training. A dummy example here would be (sliding the model parameter in the computations below) something along the lines of
#tff.tf_computation(tff.SequenceTyoe(...), tf.float32)
def train_with_learning_rate(ds, lr):
# run training with `tf.data.Dataset` ds and learning rate lr
...
#tff.federated_computation(tff.FederatedType([tff.SequenceType(...), tf.float32])
def run_one_round(datasets_and_lrs):
return tff.federated_mean(
tff.federated_map(train_with_learning_rate, datasets_and_lrs))
Invoking the federated computation here with a list of tuples with the first element of the tuple representing the clients data and the second element representing the particular client's learning rate, would give what you want.
Such a thing requires writing custom federated computations, and in particular likely defining your own IterativeProcess. A similar iterative process definition was recently open sourced here, link goes to the relevant local client function definition to allow for learning rate scheduling on the clients by taking an extra integer parameter representing the round number, it is likely a good place to look.

Labview optimization VIs

I am trying to minimize a specific spectral coefficient in respect to a set of parameters involved in my array, using the global optimization VI, and the process gets stuck. Maybe I am using the wrong VI I don't know. Here are screenshots of my code:
and the sub-VI that's referenced:
Basically it averages an array (which values are a linear function of three parameters) over one dimension then gets a certain coefficient of its power spectrum, after that the main VI tries to minimize that coefficient in respect to the three aforementioned parameters. Any ideas?