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

0
votes
0answers
20 views

Simplifying explanatory model using Vegan adonis in R

I am a newbie to multivariate statistics, so please forgive me if this question is naïve, or if I have missed something important. I'd like to know whether it would be valid to approach using adonis ...
1
vote
0answers
51 views

time series forecasting with 53 weeks in a year

I am building a time series model in R. I have four years of data from 2010 to 2013 and doing forecasting fro 2014. According to the calendar that my organisation follows, In 2014 , there would be 53 ...
1
vote
1answer
45 views

R: partial dependency plots from GBM package. Values and y-axis

I'm using the gbm.step package in R to look at the influence of three continuous variables on my continuous response variable. I have 234 observations. The model: ...
4
votes
1answer
181 views

R: equivalence between an aov between-within repeated measures model and an lmer mixed model

I have some trouble obtaining equivalent results between an aov between-within repeated measures model and an lmer mixed model. ...
6
votes
1answer
99 views

Should auto.arima in R ever report a model with higher AIC, AICC and BIC than other models considered?

I have used auto.arima to fit a time series model (a linear regression with ARIMA errors, as described on Rob Hyndman's site ) When finished - the output reports that the best model has a (5,1,0) ...
0
votes
1answer
69 views

When should I use nonlinear-regression model

I have the following table: ...
0
votes
0answers
52 views

Data Research Tool For Statistical Analysis and Data Exploration

I'm about to embark on a data analysis project that will involve the following activities: Build a database that includes approximately 5 to 6 tables (sql) or collections(nosql) Building queries for ...
0
votes
0answers
20 views

Align Boxplot and Barplot in R [migrated]

I am very new to R. For my studies i need to plot the number of animals I found during 16 transects into a boxplot and a barplot. I want to combine both plots to one image using mfrow. The x axis ...
0
votes
0answers
24 views

How to increase Accuracy in Age model on Mobile operator dataset (Call log)?

I know question is too lengthy, but it need description. I am currently working on predictive analysis project. Which predict customer age, gender, etc. demographics attributes from their data set. ...
0
votes
0answers
7 views

Quantile normalize a single column in R [migrated]

I have a column in my dataframe in R, data$height. The values range from 0- 400. I want to normalize the values in the column such the resultant values lie between 0-1 and are quantiles, i.e the ...
1
vote
2answers
124 views

Is it fine to get this results in binary logistic regression?

I wanted to check whether the level of satisfaction relates to the level of support to the value of democracy. Dependent variable (support) is binary variable (Good/Bad) and independent variable is ...
-1
votes
1answer
28 views

backward selection but regression coefficients not significative? [closed]

I'm running a logistic regression with backard selection method. I get coefficients with p-values>.10. Here's an example: ...
1
vote
1answer
41 views

TBATS: why set seasonal periods?

While trying to estimate the level, trend, and seasonal components with the TBATS model (forecast pkg in R), I notice that the ...
0
votes
0answers
22 views

K-medoids clustering with Manhattan distance

I have 17 numeric and 5 binary (0-1) variables, with 73 samples in my dataset. I read about Gower distance and applied it in R with "daisy" function. After having distance matrix I used K-medoids to ...
0
votes
0answers
36 views

Gower distance with R

I have 17 numeric and 5 binary (0-1) variables, with 73 samples in my dataset. I know that the Gower distance is a good metric for datasets with mixed variables. When I use daisy function in cluster ...
1
vote
0answers
29 views

Principal components analysis on nested data

I'm working on a piece of analysis that requires identifying a small set of variables that summarize the variation found in a larger set of principal observations on teacher practice. Given the nature ...
0
votes
0answers
63 views

Multilevel analysis in R and Stata

I am trying to replicate a multilevel logistic analysis which uses a dyadic time series data set and R. As for my part, I am using the same data set but Stata. The original syntax has the following ...
0
votes
0answers
46 views

3 month forecast for commodity prices in R - general help for approach

In the following I'll describe my undertaking as detailed as possible in order to provide you enough information. Please keep in mind (when answering) that neither I'm a matematician nor a ...
1
vote
0answers
52 views

Analyzing time series in depth

I want to create a code which tests absolutely everything for time-series forecasting accuracy. The current tests that I do are: bptest() - tests against ...
0
votes
0answers
19 views

correlation between factors in a glm

My model looks like this: mdl<-glm(yld ~ rain + stage + rain*stage) A hypothetical data for the above model is: ...
2
votes
0answers
57 views

Understanding output of qqPlot in R

I was trying to understand qqPlot and found that for finding Normal Distribution of data , qqPlot is a good tool. Then I ran 2 set of examples and got the following output where in both the case, all ...
0
votes
0answers
13 views

Running prop.table on entire DF [migrated]

So I am trying to run frequencies on a customer survey. The survey had 108 variables, and the responses are coded 1-5, with 9 being our NA. A few of the variables are text based. The raw data looks ...
1
vote
1answer
53 views

variable selection with missing values

I have a dataset with count dependent variables such as greetings and ordinal independent variables like education and ...
3
votes
1answer
26 views

Is there any Goodness of fit tests for Vine copulas?

Is there any goodness of fit tests like those based on probability integral transform (PIT) of Rosenblatt available for Vine copulas as a built in function in R? I know we can use ...
0
votes
1answer
27 views

How to extract output values from piecewise linear regression in segmented package [closed]

I am using the segmented package to run a piecewise linear regression. My regression model is called fmod, and I use: fmod$psi[1] to extract the first ...
0
votes
0answers
11 views

how can I get critical value trough qt function without knowing the degrees of freedom

a) Obtain the point estimate, sample size, sample standard deviation and critical value (tn-1) needed to construct a 95% confidence interval for the mean number of (self-reported) hours spent ...
0
votes
0answers
29 views

Syntax error when fitting generalized non-linear model with gnm

I am trying to fit functions to generated data using nms. I don't have much experience fitting these models. The data is binomial which is why I'm using nms instead of nls. First I want to generate ...
0
votes
0answers
43 views

R programming: cleaning data [migrated]

I have a question about R programming. If I have a dataset like the following: LA NY MA 1 2 3 4 5 6 3 5 4 (In other words, not all rows are the same.) I am ...
0
votes
1answer
38 views

Coding of categorical random effects in R: int vs factor

I have a problem with coding of a 2-level categorical predictor variable in R, and subsequently using it as a random slope in lmer(). I can keep the factor as numeric, coded using the treatment ...
-1
votes
0answers
18 views

How do I count / display the number of each outcome from a random sample? [migrated]

I'm taking a sample of size 1000 of different (pet) animals. My code is pet <- sample(c("dog","cat","hamster","goldfish"), 1000, replace = TRUE) I want to ...
0
votes
0answers
30 views

Specifying a State Space Model with the MARSS package

I would like to use the state space technique outlined in the paper by Mokinskia et al. (https://www.american.edu/cas/economics/research/upload/2013-4.pdf) to estimate time varying and asymmetric ...
0
votes
1answer
43 views

Nested data analysis using nlme: Analysis leaves out factor levels

Nested data analysis using nlme: Analysis leaves out factor levels I have a few questions regarding the analysis of nested data from an experiment. In the study, participants viewed 50 stimuli for 3 ...
0
votes
0answers
18 views

Initializing in arima.sim in R [migrated]

I want to simulate from an ARMA(1,2) series. I need to initialize $X_0$ = 9. How do I do it in R? I cannot find any provision for initialization in arima.sim
1
vote
1answer
64 views

Weekly seasonality model by ARIMA+Fourier terms+dummies

This is a long post but it is not conceptually difficult. Please bear with me. I am trying to model the seasonality of production volume of an agricultural commodity. I do not care about the ...
2
votes
1answer
158 views

Logistic Regression with regression splines in R

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" ...
1
vote
1answer
23 views

quantile regression with e.g. gamma distribution and log link

I have a basic question about quantile regression (I'm new to it): Why doesn't it seem possible to do a quantile regression with a specified family (e.g. gamma) and link function (e.g. log), as in a ...
0
votes
0answers
11 views

GAM-style effects plots for interpreting qrnn model

how to analyse GAM-style effects plots for interpreting qrnn models. I couldn't quite understand it from R documentation.
0
votes
0answers
15 views

Compute Transition Matrix [duplicate]

I am studying Markov Chain. I want to compute transition matrix. Is this the right way to do it ...
1
vote
0answers
28 views

What do the dip test output parameters mean?

This may sound like a silly question, but I'm not a statistician, mathematician, or programmer, really. I did quite a bit of googling, including looking into Stack Exchange, but couldn't find a clear ...
0
votes
0answers
4 views

How to plot the US maps with selected locations (longitude and latitude of the locations are known)? [migrated]

I've been struggling with the following R plotting of the US map and wonder if any of you have suggestions on how the plot should be done. Here is what I have tried: ...
2
votes
1answer
68 views

Maximizing likelihood versus MCMC sampling: Comparing Parameters and Deviance

I am working in R. I use lm() for maximizing the likelihood in the first analysis, and STAN to sample from the posterior in a second analysis. ...
1
vote
0answers
33 views

Interpreting output from cvFit(), understanding cross-validation in classification tree model

I am trying to understand how to interpret the output for cvFit(). The data is from UCI's ML repository. This is my model ...
0
votes
0answers
8 views

Y axes on the logit scale and centered in gbm.plot [migrated]

I am currently exploring the gbm functions in the package dismo to create boosted regression trees for species distribution modeling. I have been using the dismo vignettes as well as the 2008 paper "A ...
0
votes
0answers
11 views

r- pnn- error in smooth function

enter code hereI'm using pnn package. Here's an example of my table. I've converted everything to numeric except for the class, that is a factor. head(todo6) ...
1
vote
0answers
37 views

Fit a VAR model with R

I have a bivariate time series z_t where z_1t is the change in monthly US treasury bills (maturity 3 months) and z_2t the inflation rate,in percentage, of the U.S. monthly consumer price index ...
6
votes
1answer
198 views

How to use delta method for standard errors of marginal effects?

I am interested in better understanding the delta method for approximating the standard errors of the average marginal effects of a regression model that includes an interaction term. I've looked at ...
1
vote
0answers
46 views

How to determine if GLM quadratic term should be set up orthogonal or non-orthogonal

I am setting up a GLM in R where I have only one predictor variable and its quadratic form. I understand that in R I have 2 options. ...
2
votes
1answer
81 views

How can I remove multicollinearity from my logistic regression model?

I am working on Sales data. i have binary variable win/loss the opportunities and rest are the activities done by sales force (sales guys) with 40+ variables (different types of activities done for ...
1
vote
1answer
32 views

Why does the null deviance in glm.nb differ between models of the same response variable?

I'm struggeling to understand the topic of deviance. Let's have two models as follows: ...
1
vote
1answer
47 views

How to analyze elastic net fitted model coefficients

SOLVED: an elastic net model, as any other logistic regression model, will not generate more coefficients than input variables. Check Zach's answer to understand how from an (apparent) low number of ...