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

0
votes
1answer
9 views

Monte-Carlo: R script not returning anything

My R script is mcnorm.R <- function(M,N) { library("mvtnorm", lib.loc="~/R/win-library/3.2") R <- as.matrix(read.csv("Data.csv", header=FALSE)) mu <- colMeans(R) ...
0
votes
0answers
7 views

F-Test for Equality of Variances with Weighted Survey Data

I would like to use an F-Test for Equality of Variances on a variable for two groups. Normally, this would be done with an sdtest command in Stata or a ...
0
votes
1answer
15 views

Best ways to model 'big data' given limited computing resources

Suppose I have a large data set(10 GB), with a response variable and multiple independent variables. What is the best way to utilize the data to build a model on? If the full data set includes 10 ...
0
votes
0answers
13 views

Standard deviation error bars and kruskal.test in R

I need to test if there is a significant difference between two groups of data, each with three replicates. (Multiple groups) I used the following approach: ...
0
votes
1answer
25 views

Histogram in R from two vectors

how can I create a histogram in R from known values and counts? Thing is, I need to change manually h\$counts in my data set, so I have no data for that new histogram with changed values in h\$counts. ...
0
votes
0answers
12 views

Variable selection via mutual information

I am building a SVM model and was wondering whether filtering variables based on mutual information between response variable(binary 0/1 variable)is a good approach? Also, would the condinformation ...
0
votes
1answer
15 views

How to return all a particular column in a data frame

Suppose I have a data frame mysample. When I try to access only the second column using mysample[,2] I get a single element. How do I return the second column of the data frame?
-1
votes
0answers
14 views

How do you do a log-linear analysis in r?

I can't seem to find anything on log-linear analysis. Does anybody know how to do them in r? I have two variables: one a dependant one (yes or no recoded as 1 or 0) and an independant one with 5 ...
0
votes
0answers
6 views

JAGS dmstate markov specification

Does any one have experience in running multi state models in jags? I am trying to run a msm on my dataframe with activity being 1/0 time from diag being times observation of the activity and patient ...
0
votes
1answer
30 views

How to randomize order by sets in r? [on hold]

I need to randomize a list of words by sets. I have a list of 5 pairs of words and in each pair there are two words: one word in position 1 (1w1) and another word in position 2 (1w2). These pairs are ...
1
vote
0answers
23 views

Method for fitting censored data in R

I have 320 data points - each has a redshift and a turnover-frequency, and I want to fit a correlation between them (a linear fit). However, 120 of the turnover-frequency values are upper limits. As ...
0
votes
0answers
16 views

Any R packages for mixed logit or probit? [on hold]

I have choice data sets and choice is decided within pairs (Choice A or B). If I have 100 pairs and each pair has each decision values but each pair has different situation, I would need to use mixed ...
0
votes
0answers
8 views

remove factor level if factor level has outlier in any of other columns in R dataframe

Hello I have a dataframe with one column a factor of patient id's, other columns of continous variables. I want to remove patients from the dataframe if they have an outlier observation in any of the ...
3
votes
1answer
16 views

What is a paired observation or paired variable?

The question kind of asks itself, can anyone explain what a paired observation or paired variable is in basic terms? My data consist of the number of words learnt in a week for 19 different ...
0
votes
0answers
21 views

What type of statistical analysis would be best to use?

I'm awful at statistics so could really use some help regarding statistical analysis and which approach to use. Here is what I know - I need to determine, based on stats I have been given, whether ...
1
vote
0answers
23 views

Error in R's pbeta function with log=TRUE. Why could it be? [on hold]

R's function pbeta is supposed to calculate the incomplete regularized Beta function. If the flag log=TRUE is passed as an ...
0
votes
0answers
9 views

Using predictive algorithms for descriptive purposes? Correct? Any resources?

Newbie here. I've been learning lots of predictive modeling with R/python using the well-known algorithms: decision trees, random forests, SVM, logistic/linear regression, k-Means, k-NN. But I'm new ...
0
votes
0answers
10 views

How to fit an logistical autoregression in R?

I modeled the relationship of $X$ and $Y$ by the logistic function. The residual plot displays autocorrelation which I'd like to rid. I want to try adding trend component to $X$, thus the model ...
0
votes
0answers
24 views

linear regression - what tests will support my results?

I have collected data about daily bitcoin returns to the US-Dollar and calculated an online sentiment value with data from a social media platform. I further made a linear regression on that data ...
0
votes
2answers
47 views

How to interpret this interaction in R?

How would you interpret this interaction? The structure of the data is all integer variables. Inc.fix= income, age.fix=age, profit99= profit ...
0
votes
0answers
14 views

R: plotting decision tree with leaves text labels [on hold]

I use a package mvpart (MS -species in sites, TTE - parametres of environment) ...
0
votes
0answers
12 views

Regression with caret and uknown levels [on hold]

I'm trying to perform a cross-validated linear regression with caret. Unfortunately it always fails as some values for levels are not to common and therefore the prediction fails with the error ...
-1
votes
0answers
12 views

Need better guesses for nls [on hold]

I got need better guesses for this nls function, I was wondering if anyone could help me find better guesses. Sorry I don't know how to post code correctly, everything below here is code. ...
-1
votes
0answers
23 views

Structural Equation Modeling in R throws an error: system is computationally singular [on hold]

I am using Structural Equation Modeling in R. Below is the model that I have specified. The error that I am getting while training the model is: system is computationally singular: reciprocal ...
2
votes
1answer
36 views

Putting less weight on certain data points in a series for forecasting

I have a data set that contains outliers (big orders) i need to forecast this series taking the outliers into consideration. I already know what the top 11 big orders are so i dont need to detect them ...
1
vote
0answers
9 views

Is E-Divisive with Medians (the Twitter BreakoutDetection algo) robust and efficient?

There are quite a few algorithms to detect changepoints, outliers, mean shifts, trend shifts etc. out there. Recently I've stumbled upon BreakoutDetection and while it's new and shiny I'd like to know ...
0
votes
1answer
28 views

Adding observations by aggregating existing data

Question I'm aware that generating features from existing data can be a valid method for adding new features for a regression/ML algorithm*, but can you add observations generated from existing data? ...
0
votes
1answer
9 views

What do the the lsmeans (from lsmeans package in r) represent when calculated over a poisson linear mixed-effect model (fit with glmer)

I am analyzing the eye-tracking data from a designed experiment. A simplified version of my data looks like this (You can get the dput() data here), ...
-3
votes
2answers
56 views

Priors in Bayesian MCMC

I am trying to understand how the choice of priors affects a Bayesian model estimated using MCMC. At a basic level I understand that the product of the prior and the likelihood are proportional to the ...
0
votes
0answers
15 views

disease progression R markov chains

hello i have a dataframe, some of the columns include: remission,height,weight,time from diagnosis, age ethnicity, age, patient id remission is 1 or 0 just to be clear i want to fit an appropriate ...
0
votes
0answers
35 views

How to simulate an ARCH / GARCH model in R? [on hold]

Considering a standard form for a ARCH model: How can I replicate the process in R not using the functions such as garchSim? ...
0
votes
0answers
4 views

r : Need content_transformer() called by tm_map() to change non-letters to spaces [migrated]

In the following code, any characters matching "/|@| \|") will be changed to a space. ...
1
vote
0answers
11 views

Does a factor-by-factor interaction term have any literal interpretation?

Following the explanations in What is the baseline level in a factor-by-factor interaction?, it is my understanding that a factor-by-factor interaction term has no literal interpretation. At the very ...
0
votes
0answers
18 views

Determining the optimal lookback length for an arima forecast

How can I determine the optimal lookback length for an arima forecast? ...
1
vote
0answers
17 views

An Algorithm for Maximal Correlation

Given a pair of random variables $(X,Y)$ over a product space $\mathcal{X}\times \mathcal{Y}$, the maximal correlation coefficient is defined as ...
1
vote
0answers
14 views

Binomial regression does not give coefficients for all IVs [duplicate]

I have a dataset with the dependent variable presence / absence (0 and 1) for a certain species. I have three categorised IV's (2 IV's with 3 categories and 1 with 2 categories). To test the response ...
1
vote
0answers
12 views

How to use caret to perform regularization with large data? [on hold]

I have a very large data set, with about few million rows and 10K columns, where the data is formatted in a wide-format. So I tried to do regularization with Caret, using the following line: ...
0
votes
0answers
8 views

fportfolio package in R [on hold]

I have been trying to use some of the rolling efficient frontier functions (in package fPortfolio) but I need to feed them with ...
0
votes
0answers
10 views

Binary data available in R [on hold]

I was wondering whether there are any packages in R that contain binary data to work with. The purpose is to fit a probit model. I have looked at several packages and have not found any. I was hoping ...
0
votes
0answers
12 views

Why are results different from R mixed effect logistic regression models with nested random effects?

I have a dichotomous outcome on 2500 individuals. From 18 geographical areas, and many households nested within areas. I need to assess the association between various predictors and my outcome, ...
1
vote
0answers
16 views

How can I plot (multiple) linear regression residual plot “for each coefficient” in R

As a result of linear regression, we can have its residual and see its plot to check whether it shows normal distributed or not as follows : ...
3
votes
1answer
43 views

How to to find and evaluate optimal discretization for continuous variable with $\chi^2$ criterion?

I have a data set with continuous variable and a binary target variable (0 and 1). I need to discretize the continuous variables (for logistic regression) with respect to the target variable and ...
0
votes
0answers
5 views

R: lsa package with the function fold_in() [on hold]

I've got a lsa object, based on a term-document matrix, and now I want to add a new query but still keeping the original lsa space. So I want to use the fold_in() function in the package lsa. But now ...
0
votes
0answers
31 views

Puzzling average of correlated measurements [on hold]

I want to average correlated measurements. Given a set of measurements: x = ( x1, x2, x3 ) whose internal correlations are given by the covariance matrix C. A ...
1
vote
0answers
19 views

How should I treat my covariate in R?

This is covariate age in my logistic regression. How should I treat it? Gets a little insecure. Have tried to read, but still insecure. Right now I treat it as if it were linear. A polynomial is not ...
0
votes
0answers
20 views

Survey Data Cleaning using R [on hold]

R is free software with great performance. In a complex survey, I want to clean data using R. How can I do this? Could any body suggest me some documents or books for cleaning survey data using R?
0
votes
0answers
12 views

Obtaining significance for variables in a linear discriminant function analysis

I have run a linear discriminant function analysis using the lda() function in the MASS library to determine which of 6 ...
0
votes
1answer
49 views

r - choosing correct nnet model

Language: R Background data = 1800 observations (rows) x 5 variables (columns) I am using library(caret) and training regression models using ...
0
votes
0answers
19 views

Predictive model decision tree [migrated]

I want to build a predictive model using decision tree classification in R. I used this code: ...
0
votes
0answers
8 views

Successfully simulated physical process, matches truncated/incomplete data…now what?

What's Being Simulated I have data from a device that tests a physical process. The data are independent Bernoulli trials. Each test series yields a distribution of these trials with different N and ...