Use this tag for any *on-topic* question that (a) involves `R` either as a critical part of the question or expected answer (b) is not *just* about how to program in `R`.

learn more… | top users | synonyms

0
votes
0answers
12 views

Advanced R Programming Questions. Variable Names in Environments [migrated]

I wrote 2 functions to archive objects from R (with their names - that's really important for me) and, if an object is of class lm, to archive data used to conduct ...
4
votes
1answer
97 views

chi square test or Z test?

SO I have an outcome from a biological experiment, where I have counted the number of dead cells upon a mutation. For example, in once case - out of 120 cells we saw 16% of the dead cells, but our ...
1
vote
1answer
30 views

Cross-correlation in R – dealing with missing values

I have two time series. One is an environmental variable (n = 108) organized by year and month. The other is a biological variable, also organized by year and month, but I have no data for some months ...
-1
votes
0answers
17 views

Using for loop to find a string in a varying coefficient AR [on hold]

I am trying to output the following text: s(a[i,j,k], by=data[,c(2)])+s(a[i,j,k], by=data[,c(3)]) + s(a[i,j,k], by=data[,c(4)])+s(a[i,j,k], by=data[,c(5)]) My ...
0
votes
1answer
23 views

MAPE is high for daily sale prediction

I have daily sales data from 2011 to 2013. I have to do prediction for 2014.I have used arima and exponential method to predict the daily sale, but it is not giving the better result. MAPE is around ...
0
votes
1answer
17 views

Getting expected value of future value with time varying data (credit card revolving and fee data) . Customer lifetime value

I have a credit card data and that contains monthly amount of revolving and amount of fee for each customer. As a bank perspective, I want to get the expected value of future revolving amount and fee ...
2
votes
0answers
45 views

In R, what does anova(f1, f2, f3) compare?

I'm trying to understand the reason why anova(f1, f2, f3) and anova(f1, f2) gives me different result while anova(f1, f2, f3) and anova(f2, f3) gives me the same. Here's the code: ...
3
votes
1answer
62 views

comparing OLS, ridge and lasso

I am trying to compare OLR, ridge and lasso in my situation. I could calculate SE for OLR and lasso but not for ridge. The following is Prostrate data from ...
2
votes
1answer
61 views

how to calculate effective degrees of freedom in ridge regression in R

Here is example to workout: ...
1
vote
1answer
37 views

Compute mode of a quadratic regression with confidence intervals

I have a quadratic regression y against x and I'm interested in the value x where y is the maximum (ymax->x). I can compute x(ymax) but I'm also interested in the standard error or confidence ...
0
votes
1answer
44 views

How to do multivariate regression in R?

I need to preform a multivariate normal regression in R. The question is: Let $Y_1$, $Y_2$, and $Y_3$ follows multivariate normal distribution. What is the conditional of $Y_3$ given ...
0
votes
0answers
13 views

How to bin x,y,z vectors into matrix (R) [migrated]

This is probably a basic question, but I haven't been able to Google anything helpful after trying for days. I have an R dataframe with x,y,z tuples, where z is a response to x and y and can be ...
0
votes
0answers
26 views

Homogeneity Test [on hold]

Has anybody used R for data homogeneity testing. I want to use the SNHT (standard normal homogeneity test $^{[1]}$), Pettitt$^{[2]}$, Buishand$^{[3]}$ and Von Neumann$^{[4]}$ tests for the ...
0
votes
0answers
39 views

Calculate the average of hourly data of three sensors

I am trying to calculate the average of hourly data of three sensors but the hourly timestamps of all three sensors are different. How is it possible to measure the average of hourly data of all three ...
0
votes
0answers
39 views

How to plot more than 6 shapes on ggplot in R? [on hold]

I have data that I would like to plot and use shapes to symbolise the data . In total I have 20 potential different pieces of data to be represented by shapes. e.g they are labeled such as R/Hand ...
0
votes
0answers
8 views

FNN package for R - possible to use manhattan or other distance metrics? [closed]

It is possible to change the algorithm, but I am stuck trying to change the distance metric. I know it usually makes little difference, but in this case I need it!
6
votes
1answer
89 views
+50

Bayesian lasso vs ordinary lasso

Different implementation software are available for lasso. I know a lot discussed about bayesian approach vs frequentist approach in different forums. My question is very specific to lasso - What are ...
1
vote
1answer
56 views

Why do ANOVA p and F values change?

I am currently conducting a two-way ANOVA on a dataset and have noticed how significance and F values change dependent on the type of ANOVA I use in R. Why is this? For instance, if I run a two-way ...
0
votes
0answers
23 views

Finding rules in a dataframe in R [closed]

If I have a file like this start end [1,] 1 1 [2,] 2 2 [3,] 4 4 [4,] 5 5 [5,] 7 7 [6,] 8 8 Is it possible to make rules ...
3
votes
0answers
38 views

Mixed effects modelling; what to do when model is over-specified?

I'm trying to use mixed-effects modelling to analyse some data. There are a number of variables that I need to specify within the model, two of which are between-participants (...
0
votes
0answers
33 views

How to perform proper data mining on time-series data?

I have some daily data from city A, B, C. Values from city A are highly correlated with values from other cities for lag -1,-2,-3 and -4. I want to use Random Forest, SVM and ANN to predict values ...
0
votes
0answers
13 views

Cross-sectional SUR in R

Is there a package in R that can estimate panel data with cross-sectional seemingly unrelated regression generalized least squares weights (like in EViews)?
0
votes
0answers
10 views

How to identify contributors in groups of people

I have a set of 120,000 people. These people are assigned to 10 million groups. Each of these groups have a target variable indicating the kind of output it made (A, B, C or D). I'd like to identify ...
4
votes
1answer
46 views

Hyper-volume of the $\alpha$ contour of a multivariate Gaussian

I'm looking for the assymptotic ($n\rightarrow \infty$) value of (the log of the determinant of) the covariance of the $\alpha$% of observations with smallest Eucledian distance to the origin in a ...
0
votes
0answers
29 views

How to separate distributions from weighted dataset?

I’m trying to separate two component distributions of an apparent finite mixture from a weighted dataset (determined by a weighted.histogram). I've a set of data and weights only for a part of the ...
3
votes
3answers
118 views
+200

ARIMA Intervention Transfer Function - How to Visualize the Effect

I have a monthly time series with an intervention and I would like to quantify the effect of this intervention on the outcome. I realize the series is rather short and the effect is not yet concluded. ...
2
votes
1answer
43 views

LASSO in the data with large number of variables (p) with lower number of samples (n)

I would like to fit LASSO in the following type of data where there are large number of variables (p > n). My y variable is y ...
1
vote
0answers
27 views

code assistance - how to bootstrap and plot paths with a mixed model

I created an Arima (3,1,1) model using the steps below. I was able to create a nonparametric model, but now I would like bootstrap for the created model (model 3). Also I'd like to plot the paths of ...
2
votes
0answers
28 views

R GLM verifying performance statistics for validation

I do not want to say my AUC is 0.77 and find out I am overlooking a lot. Below is my code and a two question at the bottom: ...
0
votes
1answer
35 views

test validation versus k-fold cross validation

I am attempting to use a neural network, after using other machine learning algorithms. I am using the RSNNS package (I am willing to use / evaluate other packages) that's part of R. I would like to ...
2
votes
1answer
27 views

How to get percentiles from empirical density in R?

The density() function in R allows me to enter observations and get an empirical density that I can plot x and y values. I like it because it allows me to weight observations according to how ...
0
votes
0answers
15 views

Finding duplicate values in a single string of characters in r [closed]

So, I have a string like this. "1101101101" Now, here as we can see, the number '1' is appearing at positions ...
0
votes
0answers
6 views

“Error in drop(y %*% rep(1, nc))” error for cv.glmnet in glmnet R package [migrated]

I have a function to return the auc value for a cv.glmnet model and it often, although not the majority of the time, returns the following error when executing the cv.glmnet function: Error in ...
1
vote
0answers
9 views

is.constant() function in auto.arima() R [migrated]

In R, while viewing the source code of auto.arima() I noticed a function called is.constant(). What is the functionality of ...
0
votes
0answers
16 views

How to use the Huber/White estimator of covariances in a generalized linear mixed model (glmmPQL) in R?

An analysis was implemented in SPSS 22 that uses the "Generalized Linear Mixed Models" feature of the program. Now I am looking for a way to port this to R. I use the glmmPQL() function of the MASS ...
0
votes
0answers
29 views

Forecasting agricultural commodity prices with R

I would like to create a predictive model in order to forecast the price of an agricultural raw material. I got time series for the prices and the production of this raw material, and also for the ...
1
vote
0answers
19 views

Clarification on interpreting Wald's test and Likelihood ratio tests

I am running multinomial logistic regression analysis on my data. The response variable is the number of calves produced each year (0,1, or 2). I am trying to evaluate the influence of the X ...
1
vote
0answers
14 views

which regression model: nested, censored data

I have the following data structures and would like to know your opinion which regression models are most suitable (and available in R) model 1: - 20,000 cases - nested in 500 spatial units (only ...
0
votes
0answers
37 views

Trend: Linear or exponential

I am trying to forecast data using ARIMA. I have read articles which say that I should first take the log of the series, if my series follows an exponential trend. My question is: Is there a ...
1
vote
1answer
35 views

importance of predictor variables in multiple linear regression

I am running multiple linear regression with R. mod=lm(varP ~ var1 +var2+var3+var4) The table is: ...
0
votes
0answers
6 views

Maxent Markov models in R

Is there a package that implements Maxent Markov Models in R? (http://en.wikipedia.org/wiki/Maximum-entropy_Markov_model). I understand that package crf implemets conditional random fields which are ...
0
votes
1answer
30 views

Interpretation of Output

Here is the R code that produced the output below: ...
2
votes
2answers
88 views

How to visualize this data?

Here I have shown the first two lines of my data frame. It goes on for a number of lines. I am wanting to make plots to show what is happening over time . e.g a plot showing the sequence of grip ...
2
votes
2answers
57 views

What is the right way to analyze a nested design in R?

I know that there are already a host of questions about nested designs but many of them haven't been answered or come from biological domains which I sometimes find hard to transfer to my domain. I ...
1
vote
0answers
12 views

Testing for heteroskedasticity of time series in R

I wish to test my time series data for volatility clustering, i.e. conditional heteroskedasticity. So far, I have used the ACF test on the squared and absolute returns of my data, as well as the ...
1
vote
1answer
22 views

ARIMA modeling with more than one Categorical Variable

I am using auto.arima for forecasting. I have more than one categorical variables having more than one level. My questions are : Do I need to do dummy coding ? ...
1
vote
0answers
19 views

How to approach time series regression with one continuous variable and one “ almost Boolean” variable?

I am working in R with daily time series data and have daily observations of two variables. The first is continuous. The second is zero for every day except one, in which it is a number (I'm not sure ...
0
votes
0answers
12 views

R - power.prop.test, prop.test, and unequal sample sizes in A/B tests

Say I want to know what sample size I need for an experiment in which I'm seeking to determine whether or not the difference in two proportions of success is statistically significant. Here is my ...
0
votes
0answers
14 views

Imputation using caret package vs imputation without it

In the caret package, there is the option to impute missing data using decision trees. I already imputed my data by sampling the missing data from a distribution. ...
-2
votes
0answers
32 views

Understanding logistic regression in R [closed]

I am trying to understand logistic regression. I found this link. I understood up until the part at the bottom of the page (where they analysed the UCBA admissions dataset) where they applied the ...