Tagged Questions

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

-1
votes
1answer
27 views

What does the Argument “type” in VAR() - function do?

Right now I am working with vector autoregressive models in order to make 3 months forecasts for a commodity good (sawlogs) y. I have several time-series of "follow-up-products" of sawlogs that should ...
0
votes
0answers
17 views

Logistic Regression in SAS [migrated]

I have the data below. I wish to apply logistic regression. Here the response variable is the proportion of dead. Here is how I analyzed the data in R: ...
0
votes
0answers
21 views

Which function can calculate my curve? [on hold]

i have a question about a special curve. Can you please have a look at the following picture. What i already have is the diagram without the green curve. It is done with R. No I need to implement ...
0
votes
0answers
17 views

group fixed-effects, not individual-fixed effects using plm in R

I am analyzing some data to evaluate the impact (causal effect) of a program that is delivered at group level (a village). The outcome of interest is measured at the individual level (individuals ...
1
vote
1answer
37 views

Testing Logistic Regression Classifier in R

I am testing the logistic regression classifier in R. I created some test data like this: x=runif(10000) y=runif(10000) df=data.frame(x,y,as.factor(x-y>0)) ...
0
votes
1answer
15 views

R - how to transform the similarity matrix to distance matrix for performing hierarchical clustering?

I am trying to cluster nodes (C1, C2, C3...) of a graph using hclust and my similarity metric is number of links between nodes. I have data like ...
2
votes
1answer
29 views

Type of inference to use with log-linear Poisson glm on contingency table frequency counts

I was doing some log-linear models to test for interactions/associations in multiway contingency tables (based on the tutorial here, http://ww2.coastal.edu/kingw/statistics/R-tutorials/loglin.html). I ...
0
votes
0answers
7 views

Produce a GLM intercept that does not include reference levels for categorical variables?

I realize that a similar question to this has been asked, but it was not ultimately resolved. I have tried the suggestions posted to that question here, but have had no success. I am using the ...
0
votes
0answers
9 views

R [nlme] Incrementing / Adding units to continuous covariates?

I'm trying to find out how I can change the beta estimates for a continuous covariate in my model from 1-increment to another increment. For example, if I have age in the model, and I want to ...
0
votes
0answers
10 views

How do I create 3 or four classes of diameter from a range of diameters in R? [migrated]

I would like some code that can help create 3 or 4 classes from a range of diameters of wood. For example if my three classes are 1-10cm, 10-20cm, 20-30cm, I would like to add a column to the below ...
2
votes
0answers
13 views

Testing semi-parametric versus parametric model

I am estimating a (semi)parametric and a parametric model for a panel data set, and I want to test the functional form by applying the method proposed by Henderson et al. (2008, p.267). In particular, ...
0
votes
0answers
17 views

Multilevel analysis, individual level and group level

I am investigating whether the air pollutant exposure during pregnancy has an impact on the infants' birth weight. The data I have include: 1)birth weight; 2)monthly air pollutant concentration ...
3
votes
1answer
55 views

impose an intercept on lm in r [duplicate]

I am converting a high-dimensional model to a lower dimensional model by fitting a sliding window of it to a linear (parametric) model and looking at the evolution of parameter values over time. I'm ...
0
votes
1answer
33 views

How to choose the best logit model using step function in R

I have the data below. I was wondering how I could choose the best model fit of logit model using step function in R. Here is the data in R format: ...
2
votes
0answers
34 views

Missing data not at random - Advice needed on method

I have been developing a logistic regression model based on retrospective data from a national trauma database of head injury in the UK. The key outcome is 30 day mortality (denoted as "Survive" ...
0
votes
1answer
28 views

An algorithm to predict one of two values based on a linear model

I would like to run by you an algorithm for predicting one of two values from a testing data set, based on a linear model applied to a training set. Please let me know whether this algorithm makes ...
0
votes
0answers
25 views

Deciding overall similarity measure at each step of hierarchical clustering in r

I want to decide the appropriate number of clusters after using hclust() and drawing a dendogram. I don't have any idea about how many clusters should be there ...
1
vote
0answers
11 views

Heckman's selection / switching model- selection variable as a regressor

I am conducting some analyses on the effects of membership and the membership rank on income. Everyone in the sample can choose to apply to join an organization. The membership is given upon ...
0
votes
0answers
20 views

Dealing with outliers: Clustering

I am working with a dataset in R that I will be doing cluster analysis on and I am trying to determine the best way to deal with the outliers.I have twelve variables and most variables have between ...
1
vote
0answers
30 views

How to statistically validate a threshold?

I have a set of 3 parameters that were measured for several individual (each dot of the dotplot is one individual). I am trying to define subpopulations of individuals based on these measurements. ...
0
votes
0answers
24 views

forcing certain parameters to be skipped during optim in R

I have a code which tests each possible order of ARIMA and selects the best model by choosing the one with the absolute minimum sum of lags from the PACF graph. The code then proceeds to add weight to ...
0
votes
0answers
22 views

R, Confusion Matrix in percent [migrated]

In R how to get Confusion Matrix in percent (or fraction of 1). The "caret" package provides useful function but shows absolute number of samples. ...
0
votes
0answers
9 views

Standard error of prediction MARS splines earth package

I'm using the earth package (using caret train function) MARS spline implementation in order to perform non - linear regression modeling. I would like to obtain a measure of prediction uncertainty ...
0
votes
2answers
38 views

Definitions of coefficients from Arima {forecast}

I'm trying to explain in detail step by step what my code does and I am stuck at explaining what the coefficients are in an Arima model and where they are from/what relevance they have. Could someone ...
0
votes
1answer
20 views

Retrain Time Series Models

I'm new to TS modeling, but have some experience in classic classification modeling. In classification I can train one model and use it for some time while some indices are stable (e.g. PSI). ...
0
votes
0answers
15 views

Methods for predictive modeling on continous target

I am trying to put a continuous target into predictive modelling method. The target is an amount that can range from 0 to unknown. I have roughly 1000 records (for modelling and validation ...
2
votes
1answer
81 views

Use QQplot to check if data fits exponential distribution

I have a dataset which contains about 10000 numbers(class numeric), I want to use QQ plot to see if the data fits the exponential distribution. This is what I did ...
0
votes
1answer
57 views

Learning R with Coursera's Data Science Specialization [closed]

I'm interested in moving into data science and I'd like to learn R. I've looked over previous questions and found a list of resources for learning R here and here. However, these questions were ...
0
votes
1answer
28 views

regarding the explanation of interaction plot

I was trying to draw an interaction plot for two predictor variables as follows: interaction.plot(xtest[,2],xtest[,8],y) I got the following plot. I do not know ...
0
votes
0answers
16 views

Loading data with missing values as numeric data [migrated]

I am trying to impute missing values using the mi package in r and ran into a problem. When I load the data into r, it recognizes the column with missing values as a factor variable. If I convert it ...
0
votes
1answer
37 views

R - glmnet - cross validated - AUC [closed]

I have just started working with the glmnet package in R. I have s a dataset which has about 130,000 features and about 32000 rows of data. Here is the code to create the model ...
1
vote
1answer
60 views

R - glmnet - Not all features being considered

I have just started working with the glmnet package in R. I have s a dataset which has about 130,000 features and about 100 rows of data (actually there are about ...
0
votes
0answers
22 views

Why does applying the “c” operator to a vector and a number produce a 1-dimensional vector? [closed]

So I tried running this code in R, and I realized I have no idea what the c function actually does. ...
0
votes
1answer
25 views

Constraining norms with inequalities [closed]

I have time-series data for N stocks. sample.data<-rep(10,rnorm(100)), where each column shows the returns of different stocks over time. I am trying to ...
0
votes
0answers
15 views

Creating a jpeg or TIFF for a loop of negative binomial GLMs in R [migrated]

I have made a loop to perform 4 negative binomial GLMs and now I want to graph them in a TIFF. What would be the best way to do this? ...
0
votes
0answers
10 views

Replaing NAs with correlated values in rows [migrated]

Hey All I have data frame with 5 Samples A,B,C,D,E. and what I want to do is firstly search for a mirna which is overall highly correlated with the miRNA having the missing value and taking a value ...
0
votes
1answer
35 views

Polynomial regression P value is getting altered

I am running following data and code for analyzing non-linear regression and to get simplest equation of curve that fits the data: ...
4
votes
3answers
144 views

Inconsistency between R and SAS for MLE on Weibull

I have the following data Y which I want to get an MLE estimate for the parameters using a Weibull distribution in R. 1468, 1872, 475, 1372, 3830, 1849, 978, ...
1
vote
1answer
41 views
0
votes
0answers
19 views

Generalized likelihood ratio test

Does anyone use the generalized likelihood ratio test for detecting a sudden change in time series forecasting (ARIMA Model)? A paper by Bonne Zhu uses this technique for anomaly detection, but I ...
0
votes
0answers
13 views

geeglm not recognizing clusters

I am fitting a geeglm model and it is not recognizing the clustering. my model is ...
0
votes
0answers
20 views

the reason that adding one more predictor variables will cause lm model to be all NA

I have a data set with multiple predictor variable candidates, and try to experiment with different combinations. During the experiment process, I tried using the first 9 variables, ...
0
votes
0answers
38 views

Plotting a graph in R that features several dependent values for every independent sample point

A class has 40 students. Each student has submitted 14 homework assignments. Each submission was given a grade in the set {1, 2, 3, 4, 5}, with 5 being the grade given to excellent submissions and 1 - ...
0
votes
0answers
27 views

Analysis of the Benjamini-Hochberg adjusted p-values

I have: Condition #1 : 5 independent objects (1 object = a time series) Condition #2 : 5 independent objects My GOAL: test H0 that using condition #1 gives different results from using condition ...
0
votes
1answer
30 views

Multilinear Model with fixed intercept

I would like to fit the following model Y (t) = m (t) + b * t + g * C (t) + N (t) with m (t) to be the long term mean monthly values (remove seasonal component), b ...
0
votes
0answers
34 views

Learning Decision Trees on Test Data Using R

How can I use R to learn classes on test data? I currently have a training set of about 1000 entries and a test set of about 10000 entries. I split it up so that the training set has the class label ...
2
votes
0answers
54 views

Simulation of Monte Carlo test

Using R, I am trying to simulate how the power of a Monte Carlo two-sample test for central tendency changes with sample size. However, my simulation results does not show power increasing with sample ...
1
vote
0answers
22 views

Visualizing time spans on a timeline as a horizontal histogram / bar chart [migrated]

I have a csv table of 6 events and the time span of their occurrence. My variables are begin date, end date, and event-ID. I intend to create a horizontal histogram / bar chart visualization that ...
0
votes
1answer
48 views

Prediction with categorical variables in Cox regression

I'm doing survival analysis with Cox PH. I have my final model based on averaged models and I have four categorical variables with multiple levels each. I computed the fitted values using ...
0
votes
0answers
8 views

Pairwise comparison of slopes from multivariate regression model in R

I am investigating size changes over time. I have five size variables in a multivariate linear model against year. I used the Anova() function in the car package to test whether the slopes are equal ...