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 use `R`.

learn more… | top users | synonyms

3
votes
0answers
30 views

Decomposition of SARIMA models

I use R for time series analysis. I would like to evaluate decomposition algorithms. decompose and stl from "stats" package lead ...
-1
votes
0answers
14 views

Adding 2 vectors without loops in R [migrated]

I am trying to write a function that inputs 2 vectors and returns a matrix where each element [i,j] is x[i]+y[j] For example, let's say x is 2 3 5 7 And y is ...
4
votes
1answer
92 views

Why is my kalman filter trusting so much my observations?

This question follows the one asked there. I am trying to filter an equity index (Stoxx 600) time series using kalman filter. I'm using the R package dlm and my code is inspired from the dlm ...
1
vote
0answers
15 views

Best step pattern for unconstrained/subsequence DTW(Dynamic Time Warping)

I am implementing an unconstrained/subsequence DTW algorithm (in R). The query of data which I am trying to find a match within the reference data is much smaller (as compared to reference). I have ...
0
votes
0answers
11 views

Critical point in time series and pattern comparison

I have some data from a recent experiment. Two factors, each had 2 levels, resulting in 4 conditions. In each condition there were 12 participants, so 48 participants in total. Each participant ...
0
votes
0answers
23 views

Interpreting log likelihood

I have difficulty interpreting some results. I am doing an hierarhical related regression with ecoreg. If I enter the code I receive output with oddsratio's, ...
0
votes
0answers
22 views

Which analysis to be used in case of time dependencies?

So i will give you a background of the study im trying to do. Im trying to model status of the customer booking a particular vacation. They would either get cancelled or they would get a confirmed ...
0
votes
0answers
6 views

Long-tailed random effect posterior distribution from unbalanced design

I am using MCMCGLMM to estimate the effect of some factors on a trait. The model is constructed with $Y \backsim B*S$ to find an interaction effect of factor B ...
0
votes
0answers
9 views

how to achieve function criterion to be close to zero [on hold]

I wrote this R script to solve solve this system of nonlinear equations using nleqslv package. ...
0
votes
0answers
9 views

Find a significance difference between two models

I am trying to determine if immigration status is a determinant of risk preferences. To do this, I am using the 2014 Health and Retirement Study data which has approximately ~20,000 participants and ...
1
vote
0answers
50 views

Strange predictions from GAMs

I am fitting a GAM to data of capture success in trapping sites using the mgcv package in R. The independent variables are proportions of land cover types. Here ...
0
votes
0answers
7 views

How to create linear model by group and then predictions for each individual group [on hold]

I'm new with R and have used Stata before. I've found solutions in Stata for this problem but can't seem to find an efficient solution in R. First, I need to predict a metric with itself ...
0
votes
0answers
14 views

Cross validated loglikelihood?

This is probably a silly question: I was playing around with penalized package and cvl outputs a cross validated loglikelihood and another measure just called loglikelihood which is suppose to be ...
0
votes
1answer
23 views

Difficulties fitting a Cox PH model with categorical interactions to complex survey data

I'm attempting to fit a Cox proportional hazards model to a set of NHANES data; the code to load and clean the data is here, and the resulting dataset is here. The difficulty I'm having is ...
0
votes
0answers
17 views

R: Logistic Regression with L2-Penalty and output of coefficient significance

I'm trying to run a logistic regression with a L2-Penalty on a dataset I have. For the regression coefficient I also want to have the p-values of the signifance or at least the standard errors. My ...
0
votes
0answers
29 views

Achieve multiple random effects and interactions with lme4 in R

I am trying to replicate a mixed effect analysis where the authors claim that they used the following scheme: Fixed effects treatment, year of observation Random effects block, interaction ...
0
votes
0answers
20 views

How to plot a vglm/propodds regression in R

Hi I'd like some help plotting the following regression in "r": fit1_usesrp <-vglm(rp ~ is.native + is.male + oh + cjs + age2 + tw ,propodds, data = dummydata ...
0
votes
0answers
15 views

How to interpret the results from regularized canonical analysis?

I am analyzing two sets of data (X, Y), which each has 19 samples and 26 variables (columns). Now I am looking for the correlations between the same columns of X and Y, ...
1
vote
1answer
31 views

Results from rfe function (caret) to compute average metrics - R

I am computing a SVM-RFE model with the rfe function of the caret package, but I am a bit confused about the results. My code ...
0
votes
0answers
11 views

Negatively Correlated Predictors in Arima Model

If a predictor is negatively correlated with a variable you are trying to forecast in an Arima model, will Arima pick up the negative correlation when you add the predictor in the xreg argument? Is ...
0
votes
0answers
5 views

Combining Lower Correlation Predictors to Create Higher Correlation Predictors

I'm working on an Arima model to forecast a given variable and so I'm looking in my data for variables with correlation to the variable I'm trying to predict, to add as predictors in the xreg ...
0
votes
0answers
30 views

Sum of two different probability functions [on hold]

I'm have some problems estimating the marginal distribution from data. I found three different distributions that explain the data quite well: two log-normal (black) and one normal distribution (red). ...
-1
votes
1answer
23 views

How do I convert the result of individual result vectors to a long vector in R [on hold]

say I have the following sapply call which results in the following: > sapply(1:3,function(x) (x+3):(x+x)) [[1]] [1] 4 3 2 [[2]] [1] 5 4 [[3]] [1] 6 What ...
0
votes
0answers
12 views

How do I convert a Matrix in R to a Vector [migrated]

Say I have the following matrix a (dput below): ...
1
vote
0answers
15 views

Sum of two different probability functions [duplicate]

I'm have some problems estimating the marginal distribution from data. I found three different distributions that explain the data quite well: two log-normal (black) and one normal distribution (red). ...
1
vote
2answers
45 views

Lag-free filter methods for time series

I'm currently working with accelerometer based raw data (100 hz). Now I want to low pass filter this timeseries of accelerations for further analyses. I tried different filters like the simple moving ...
0
votes
0answers
38 views

Web Scraping of Google News using R [on hold]

I am trying to scrap data from Google news for a particular topic using XML and Curl Package of R. I am able to extract the ...
0
votes
0answers
35 views

New data mining models that R can do but SAS cannot? [on hold]

I'm going to give a talk on R and SAS to a group of SAS experts from industries, who are interested in frontiers of researches in data mining models and reasons why R is preferred by researchers. I'm ...
1
vote
1answer
45 views

Interpreting PCA results when a lot of PCs are needed to reach 95% of variance

I'm working on a simple classification project to better understand PCA, but I don't understand the results. My dataset has 10 features, and I'm trying to predict the label (SeriousDlqin2yrs). ...
0
votes
0answers
19 views

Nested ANOVA alternative for heteroscedastic data (Nested Welch ANOVA)

Question: Is there an equivalent of Nested -ANOVA for data which fails ANOVA requirement? Is it possible to perform in R? Many thanks, Savani I am doing an analysis of large data set. I have ...
0
votes
0answers
14 views

Logistic regression in R when data when variable is a number of observations in a set of categories, not indicator (dummy variable) [on hold]

I have data in the form, let's say, factor1 | factor2 | number of observations in given levels of fctr1, fctr1. How do I perform logistic regression?
0
votes
0answers
10 views

Understanding vglm/propodds regression output in R

I was wondering if I could have some help analyzing the output from a regression. Some background on what I'm trying to find/my data: I am trying to determine if immigration status is a determinant ...
1
vote
1answer
47 views

Can you test for normality for a (0,1) bounded distribution?

I have a vector of observations called MyData which is a percentile score that is >= 0 and <= 1. I would like to test the ...
0
votes
0answers
14 views

Survey scoring: count set of possible results

Suppose I have a survey with eight questions. Each question has four possible responses (i.e. 'a', 'b', 'c', 'd'), but four of the questions map to one set of answer weights, and the other four map to ...
0
votes
1answer
21 views

xgboost parameters - how can we use max.depth parameter with binary:logistic objective

I'm new to xgboost package and here is the doc on the parameters of this library for your reference. My question is, logistic regression doesn't do binary splitting and build a tree unlike decision ...
0
votes
0answers
19 views

How to use a regression lm function used for prediction [migrated]

I apply a linear regression over a data set: ...
-1
votes
0answers
23 views

Numerical integration of a function containing nonparametric pdf and CDF in R [on hold]

I'm trying to integrate the following function: $\int_x^{\overline{x}}t ( ( 1 - F(t) )^{( ( 1 - .75* b ) / (.75 * a ) ) )} f(t) dt$ in a finite interval between the realization of the random variable ...
0
votes
1answer
18 views

SOM based on a not euclidean distance

Suppose one has trained a SOM on a certain number of data. Without explaining all the procedure, one can say that the SOM algorithm produces a certain number of prototypes and the new elements coming ...
3
votes
1answer
40 views

Forecasting elections by using survey data (in R)

In advance: my sincere apologies for any incompleteness, lack of knowledge and general stupidity in this post. I am doing my ultimate best to be as complete and thorough as possible - but I ...
0
votes
1answer
35 views

What's the interpretation of ranef, fixef, and coef in mixed effects model using lmer?

I have two observations from a person each, where every observation corresponds to a different treatment. The treatments are fixed effects, the persons are random effects. I use the command: ...
0
votes
1answer
43 views

Model selection: testing the need for random-effects terms in longitudinal data

I have longitudinal data set where each participant was observed for 12 weeks. I followed this paper: Bliese, Paul D., and Robert E. Ployhart. "Growth modeling using random coefficient models: Model ...
0
votes
0answers
36 views

Linear regression from two meta-analysis outcomes in R metafor

First of all, I am sorry if this question sounds very basic, but I am new in meta-analysis and statistics and I don’t know how to execute what I have in mind. I have a dataset of 60 experiments with ...
0
votes
1answer
44 views

What is the minimum sample size for kaplan meier

I used the "survival" package in R to calculate a Kaplan Meier estimate for survival. An example of my output is like this: ...
0
votes
0answers
14 views

Two-way ANOVA on mixed linear model in R, homogeneity of variance assumption

I am a bit confused with a two-way ANOVA that I want to perform in R. I have a mixed linear model that I want to perform an ANOVA for: ...
0
votes
0answers
14 views

Create Number and percentage table for Latex with R [on hold]

I want to create a table with R for LAtex. (I know how to do with quantitative variable (mean , sd and NAs).) For qualitative variable (with 2 or more levels), I want to have a table with "count ...
0
votes
0answers
15 views

Interpretation of J-test results in R

I am trying to compare two non-nested models in R (A and B) using a J-test. I already conducted the BIC and AIC and based on that it seems that model A is better than model B. However, when conducting ...
2
votes
1answer
49 views

Can logistic regression be used with “years” as a continuous variable?

We are currently collecting data for a study whose purpose is to show whether scientists are focusing more or less on a specific subject with time. To keep some privacy let's say the subject is jelly ...
0
votes
0answers
10 views

Correlation of Error terms v/s Auto Correlation

Is Correlation of Error terms and Auto Correlation same thing ? On page 93 of Statistical Learning the author describe the correlation of error terms but didn't describe how to check for correaltion ...
0
votes
0answers
8 views

How to sample from Conditional Density Estimation estimated using hdrcde package in R? [on hold]

I wanted to use ARMS sampling technique (MCMC method) available in "HI" package in R. I'm not understanding how to give input for ARMS.
0
votes
1answer
44 views

Are numerical variables must for random forest algorithm?

I am trying to find the variable importance on a credit scoring database. I have categorical inputs as well as numerical inputs. My question is does the random forest algorithm works the same way when ...