prediction

VAR model with exogenous variable doesn't work in Shiny

无人久伴 提交于 2020-01-06 06:52:00
问题 Let's consider a VAR model with an exogenous variable to distinguish two periods. This model works perfectly as follows: library(shiny) library(vars) #--- Create Exogenous Variable 'periods' data(Canada) canTS <- Canada periods <- as.matrix(data.frame(period=ifelse(index(canTS)>1996, 1, 0 ) ) ) #--- Fit the Model fit1 <- VAR(Canada, p = 2, type = "none", exogen=periods) coef(fit1)[[1]] #-- Make Prediction period2 <- as.matrix(data.frame(period = rep(1, 12)) ) # Future Exogen Values = 1

Early Detection of peaks with Neural Network

£可爱£侵袭症+ 提交于 2020-01-05 08:23:26
问题 I am using Neural Network technique(Backward Learning). As a output for example I am giving the 18 point ahead value and as input I gave the latest 5 point to train.(I tried the many combinations of input data 5,10, 20 ,30...). For example, the way I trained my data: t, t+1, t+2, t+3, t+4... => t+22(4+18) t+1, t+2, t+3, t+4, t+5... => t+23 Exponential inputs: t, t+1, t+2, t+4, t+8... => t+26(8+18) t+1, t+2, t+3, t+8, t+9... => t+27 After I trained, I have done forward learning with the my

Kalman filter always predicting origin

╄→гoц情女王★ 提交于 2020-01-05 05:28:25
问题 I am learning kalman filters for the purpose of trajectory prediction. Right now, I am able to track the ball. For my first practical attempt with prediction and kalman filter, I used an example of drawing lines as given here: Is there any example of cv2.KalmanFilter implementation? Here is the complete code: import cv2 import numpy as np import math cap = cv2.VideoCapture('videoplayback (1).mp4') loHue = 0 loSaturation = 50 loValue = 50 high_hue = 0 high_saturation = 255 high_value = 255

Role of frequency parameter in ts

前提是你 提交于 2020-01-04 02:35:31
问题 How does the ts() function use its frequency parameter? What is the effect of assigning wrong values as frequency ? I am trying to use 1.5 years of website usage data to build a time series model so that I can forecast the usage for coming periods. I am using data at daily level. What should be the frequency here - 7 or 365 or 365.25? 回答1: The frequency is "the" period at which seasonal cycles repeat. I use "the" in scare quotes since, of course, there are often multiple cycles in time series

ggvis scatter plot with 95% prediction interval

回眸只為那壹抹淺笑 提交于 2020-01-04 01:19:13
问题 library(ggvis) mtcars %>% ggvis(~wt, ~mpg) %>% layer_points() %>% layer_model_predictions(model = "lm", se = TRUE) The above produces a scatter plot with a fitted regression line and 95% confidence limits on . Question : How to draw a scatter plot with a fitted regression line and 95% prediction limits on ? 回答1: Here is an idea. It probably needs more work to get exactly what you're after though. mtcars.pi = data.frame(mtcars, predict(lm(mpg~wt,data=mtcars), interval="prediction")) mtcars.pi

how to merge two linear regression prediction models (each per data frame's subset) into one column of the data frame

六眼飞鱼酱① 提交于 2020-01-03 04:25:27
问题 I would like to build 2 linear regression models that are based on 2 subsets of the dataset and then to have one column that contains the prediction values per each subset. Here is my data frame example : dat <- read.table(text = " cats birds wolfs snakes 0 3 8 7 1 3 8 7 1 1 2 3 0 1 2 3 0 1 2 3 1 6 1 1 0 6 1 1 1 6 1 1 ",header = TRUE) First I have built two models: # one is for wolfs ~ snakes where cats=0 f0<-lm(wolfs~snakes,data=dat,subset=dat$cats==0) #the second model is for wolfs ~ snakes

Training an LSTM neural network to forecast time series in pybrain, python

…衆ロ難τιáo~ 提交于 2020-01-02 23:15:35
问题 I have a neural network created using PyBrain and designed to forecast time series. I am using the sequential dataset function, and trying to use a sliding window of 5 previous values to predict the 6th. One of my problems is that I can't figure out how to create the required dataset by appending the 5 previous values to the inputs and the 6th as an output. I am also unsure of how exactly to forecast values in the series once the network is trained. Posting my code below: from pybrain

train() in caret package returns an error about names & gsub

故事扮演 提交于 2020-01-02 09:28:25
问题 I am using caret package to predict the improvementNoticed variable library(caret) head(trainData) improvementNoticed V1 V2 681 0 0.06451613 0.006060769 1484 0 0.77924586 0.331009145 1356 0 0.22222222 0.017538684 541 0 0.21505376 0.011102470 2214 1 0.59195217 0.064764408 1111 0 0.97979798 0.036445064 V3 V4 V5 681 0.008182531 0.05263158 0 1484 0.316603794 0.88825188 0 1356 0.016182822 0.20000000 0 541 0.012665610 0.10000000 0 2214 0.051008693 0.55000000 0 1111 0.034643632 0.93333333 0 and I

train() in caret package returns an error about names & gsub

ぃ、小莉子 提交于 2020-01-02 09:28:04
问题 I am using caret package to predict the improvementNoticed variable library(caret) head(trainData) improvementNoticed V1 V2 681 0 0.06451613 0.006060769 1484 0 0.77924586 0.331009145 1356 0 0.22222222 0.017538684 541 0 0.21505376 0.011102470 2214 1 0.59195217 0.064764408 1111 0 0.97979798 0.036445064 V3 V4 V5 681 0.008182531 0.05263158 0 1484 0.316603794 0.88825188 0 1356 0.016182822 0.20000000 0 541 0.012665610 0.10000000 0 2214 0.051008693 0.55000000 0 1111 0.034643632 0.93333333 0 and I

Latent Dirichlet Allocation (LDA) implementation

纵饮孤独 提交于 2020-01-01 07:25:09
问题 does someone know if there exists some implementation of LDA algorithm (no matter if library or application) for Win32 platform? Maybe in C/C++ or other language that can be compiled? 回答1: Well, honestly I just googled LDA because I was curious of what it was, and the second hit was a C implementation of LDA. It compiles fine with gcc, though some warnings show up. I don't know if it's pure ANSI C or not, but considering that there is gcc for windows available, this shouldn't be a problem. If