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
0answers
1 view

Running repeated cross-validation for multiple models using same dataset (caret package)

I'm currently using the train() function in the caret package to run 10-fold repeated cv on a random forest model. I would also like to explore other statistical and machine learning models for use ...
0
votes
0answers
4 views

Interpreting Sign of Mediation Analysis

I am new to mediation analysis. I am analyzing observational data, specifically, congressional races between 1980 and 2008. I am examining whether the effect of congressional partisan votes on an ...
0
votes
0answers
2 views

auto.arima and DLM give different values for loglikelihood

I want to estimate an ARIMA model on my timeseries, then represent it in state space format, mainly because it will be more responsive to change in pattern. I used ...
0
votes
0answers
18 views

Transforming data to standard normal

I have a residual expression matrix upon which I want to conduct an eQTL analysis using a linear model: I know that a normal distribution is required to use a linear model; my question is can I use ...
0
votes
0answers
21 views

Output from lmer in r

I am trying to evaluate the change in a variable si measured at different time points within individuals. Therefore using the time points (of which there are 3) as ...
-1
votes
1answer
26 views

Logistic Regression modeling in R

Consider this model: $Y_i$ ~ Bernoulli($\pi_i$) $X_i$ = 0,1 logit($\pi_i$) = $\lambda^{X_i}$ * $\beta_0$ This model simplifies to logit($\pi_i$) = $\beta_0$ , when $x_i=0$ , and logit($\pi_i$) = ...
0
votes
0answers
2 views

Does the cvglm function in boot package have arguments for mean centering and normalizing?

Does the cvglm function in boot package have arguments for mean centering and normalizing? If not, how can I run k-fold cross validation with mean centering and normalizing in R ?(especially for ...
1
vote
0answers
10 views

Visualizing multi-class ROC analysis

I am running a multinomial logistic regression model (with 3 possible outcomes) in R. I am trying to find the best way to assess the predictive power/accuracy of the model, and the best thing I've ...
0
votes
1answer
10 views

Bivariate K function for inhomogeneous spatial point processes

I have some inhomogeneous spatial point patterns of individuals in a cactus population. I also have marks, such as "diseased"x "healthy" individuals, and "adult" x "juvenile". I've already computed ...
0
votes
0answers
16 views

FORECASTING AR(1) Autoregressive Form

Ive been implementing a little exercise to obtain the first 2 forecasting points of an AR(1) process. And i want to have the forecasting ponts using the three forms: Im folowing this pdf ...
0
votes
0answers
14 views

How ARIMAX model is presented in R

I have a relatively simple problem, but yet taking some time to solve it. I am suing ARIMAX{TSA} function. This is the model ...
0
votes
0answers
12 views

How to fix dim(X) error in MICE (R)? [on hold]

I am trying to compute multiple imputation using the MICE package in R. I am working with a large scale study which includes 38 countries. For most countries I get reasonable results, but for some I ...
1
vote
0answers
12 views

rpart classification: why is my predict() output not adhering to type=“class”?

I have a dataframe, 'datas', with 200 observations and a series of columns (some numeric, dummy, etc) and a binary class variable to be predicted that is called "bad_econ." I would like to get the ...
0
votes
0answers
10 views

Simulation and Bootstrapping of Wald Confidence Interval for Proportion

I want to investigate the performance of Wald Confidence Interval for Proportion through simulation and bootstrapping. I just want to check with experts that I'm following right strategy. Simulation ...
0
votes
1answer
13 views

R: MLE estimation of transition probability density (CIR)

I am trying to replicate the model Zhang and Zhu (http://onlinelibrary.wiley.com/doi/10.1002/fut.20209/epdf) used to get the parameters of a stochastic volatility model. Therefore, I determinded the ...
0
votes
0answers
6 views

How does unbiased cov.wt compute its value?

What is exactly the calculation used when calling cov.wt((faithful,c(1,2,3,4))$cov)? (Say the data faithful has 4 rows and 2 columns, coordinates x,y) I.e.: What ...
0
votes
0answers
14 views

Custom Tables: How does SPSS treat multi response sets differently from categorical vars?

I have come across an SPSS-specific scenario where I cannot understand how SPSS is calculating its proportions test results. The scenario only takes place when applying t-tests and z-tests on "SPSS ...
0
votes
0answers
15 views

Rejecting Null hypotesis with t-test: excluding the mean [on hold]

So the question is: can we reject that median can be larger than 900. doing t-test in R, which gives correct answer?: t.test(x, mu=900, alternative="greater") t.test(x, mu=900, alternative="less") ...
0
votes
1answer
13 views

Confusing results on kpss.test() for stationarity

I've got a dataset which clearly shows a trend. However, I want to assess wether this trend is deterministic or stochastic. If I understood it right, I would need to use differences if the trend is ...
1
vote
0answers
25 views

Statistical significance between group sums

How can we state that there is a significant difference between total amounts of donations of two sample groups in the following scenario. Control group A has donated lots of smaller denominations ...
2
votes
0answers
24 views

Power of a Interaction term in R

I have analysed a dataset with a linear regression model, including an interaction term between a binary variable and a continuous variable. The interaction was significant. Afterwards, I have fitted ...
0
votes
0answers
11 views

Are the data stationary or non-stationary and seasonality?

I want to use Arima model for forecasting wind speed.I plot my data. Then i plot ACF and PACF. I used ADF test and KPSS test and they said that data are stationary and doesnt need differencing but ...
0
votes
1answer
24 views

Could anyone help me check my gibbs sampling code? [on hold]

I am now trying to write a Gibbs Sampling code based on the posteriors from a paper "Bayesian Regularization via Graph Laplacian", writer: Fei Liu, et. When I run the code, it always show the error: ...
-1
votes
0answers
12 views

How do you combine data with multiple datasets? [migrated]

I'm having trouble combining a bunch of different data sets together. When I combine them, the variables v1, v2, and id combine into two separate columns where there's 3 different numbers per cell ...
0
votes
0answers
18 views

Instrumental variable analysis after (propensity) matching

I am trying to replicate the methods used in this paper by Paul Rosenbaum and colleagues (Near-Far matching). I have been studying the methods in the referenced papers by Michael Baoicchi. My work ...
0
votes
0answers
7 views

How can I obtain the Simulations in CausalImpact package? [on hold]

Currently we are using your package CausalImpact to evaluate the effect of different interventions over the accident occurrence in different firms. I address to you in order to ask you if there is any ...
0
votes
0answers
6 views

r ggplot 2 - set different fill colors for different facets [migrated]

Using ggplot2 in R, I want to set the fill parameter to be different for each facet. Here is some simplified code (Also ...
0
votes
0answers
13 views

How to perform Sensitivity Analysis of Bayesian network using R?

I know there are similar techniques for Sensitivity Analysis for Random Forests. I am looking for something similar for Bayesian Networks. I have built the Bayesian Network using bnlearn package in R. ...
1
vote
0answers
14 views

RandomForest MeanDecreaseAccuracy interpretation

I know there are already some questions regarding the interpretation of the MeanDecreaseAccuracy metric of the randomForest-package, but it's still unclear to me. My assumption was that each variable ...
0
votes
0answers
16 views

How to draw a efficient sample variogram using gstat package in R?

I have a csv file named seoul3112, contains PM10 concentrations. please, download..I have tried to plot sample variogram and fit a model on it. ...
4
votes
0answers
20 views

How to calculate uncertainty in bacterial growth rates (or in the slope of any local regression)?

I'm using a plate reader to measure optical density of different bacterial strains so I can compare their responses (growth rates and changes in them over time) to stress conditions. The growth curves ...
1
vote
0answers
46 views

Why can't my (auto.)arima-model forecast my time series?

For testing I generated a very simple time series with a clear recurring pattern. I expected that auto.arima will generate a model, that can forecast that pattern, but óbviously it doesn't. Can anyone ...
-4
votes
1answer
58 views

what's wrong with my data? [on hold]

Sorry,owing to my reputation,I have to delete the above word. Originally I just want to copy this page's method,the author use titanic data to analyze relationship between fare and survivor. And I ...
0
votes
0answers
13 views

How do I make a piecewise constant formula term? [migrated]

I can produce a model matrix for a piecewise linear spline like this: ...
0
votes
0answers
16 views

How to visualize a significant interaction between two linear predictors using the rms package?

Two linear predictors interact significantly (see below). How can I visualize this interaction in a plot? ...
0
votes
1answer
29 views

How do you turn the output of a nnet neural network model into an equation?

Assuming the output of the above nnet feedforward model (nnetModel) is such that the following summary is produced: ...
0
votes
0answers
17 views

Different quantile values for a predictor between the root data and and the data of a Predict() object

I want to plot a continous predictor using restricted cubic splines and indicating the distribution of the linear predictor using a box-and-whisker plot. However, the quantile values differ from those ...
0
votes
0answers
13 views

extract the idosyncratic error of a factor model

I want to extract the idosyncratic error $e$ of a factor model which has the form $X = F \Lambda' + e$. I estimated the factors $F$ and the loadings $\Lambda'$ by principal components in ...
3
votes
1answer
33 views

Why can't we use top-down methods in forecasting grouped time series?

As I asked in here I was trying to forecast grouped time series with two grouping variables and I find some limitation of hierarchical forecasting methods. In particular, using hts package from R, we ...
-2
votes
0answers
20 views

mfp implementation in Stata and R [on hold]

I am applying multivariate fractional polynominals on data, which have 30000 (observations) x 20 (variables). Surprisingly, mfp in R is quite fast (10 minutes), but mfp in Stata is very slow (stuck ...
0
votes
2answers
24 views

Grouping customers together into like groups based on multiple variables without a categorical variable

I am looking for a little guidance as to the correct approach to this problem. We have a list of IDs and roughly 8 different numerical variables such as quantity and revenue. Each ID is unique to the ...
1
vote
0answers
29 views

Tennis Analytics: How to Build Model Predicting Player Service Point Win %

I have collected a large amount of tennis match data including player names, court surface, player ranking points at time of match, handedness of player, point by point breakdown of match etc. I ...
0
votes
1answer
19 views

Iris dataset and a-priori probabilities

I have been playing around with two R packages for naive Bayes classification (e1071 and klaR) using the Iris dataset as an example. During the training phase, the outpur of the apriori probabilities ...
0
votes
0answers
17 views

Does anyone know if the portable version of R works on both Windows and MAC? [on hold]

I installed the portable version on my USB. I was wondering if anyone knows whether it will work on both my windows pc and Mac?
2
votes
1answer
34 views

How to compare two spatial points patterns in R?

I have two spatial points data sets (relocations of animal A and distribution of plant B). How can I investigate if animal A is more likely to be where plant B is present? With the animal ...
1
vote
1answer
32 views

R - moderated mediation using the lavaan package

I am interested in determining the conditional indirect effects of X on Y at a series of values for a third variable Z. I was able to use the lavaan package to calculate some initial indirect ...
0
votes
0answers
36 views

Daily Category Revenue Stacked Bar Chart in ggplot2 [on hold]

I am trying to use the ggplot2 to build a daily Category Revenue chart. The chart would look similar to this, but with date on the x-axis, and total revenue on the y axis. The fill would be the ...
0
votes
0answers
8 views

Cox model with known measurement error

I am trying to perform a univariate Cox PH survival analysis in R. My covariate was generated from another analysis, meaning that I have a 95% CI range (between 0 and 1) for the values. Right now, I ...
0
votes
1answer
36 views

Comparing regression models with different coding of the same linear predictor

How can I determine whether one coding of a linear predictor leads to a better fit of the corresponding regression model than the other? In the following example, the restricted cubic spline coding of ...
1
vote
2answers
84 views

significance test for yes/no data in R

I have the following data format: ...