Use this tag for any *on-topic* question that (a) must have an `R`-based solution yet (b) is not *just* about how to program in `R`.

learn more… | top users | synonyms

0
votes
0answers
2 views

Difference in AIC and BIC values between sem and lavaan packages in R

I ran the same SEM model in sem and lavaan. I got the same parameters and - generally - very close test values, with the exception of AIC and BIC which were immensely different between the two ...
0
votes
1answer
45 views

Finding the state for Markov chain in R based on a generated sample

I am looking for a R code of discrete Markov chains. I have done the following: ...
3
votes
0answers
17 views

How can IRT-Models be understood in GLM/ SEM Framework? (Predict Learning with added Paradata-Covariates)

I'll be working with data from an intelligent tutor system similar to one studied in the KDD-Cup 2010 on student performance prediction and plan to use IRT models to infer item and ability parameters. ...
5
votes
2answers
228 views

Modelling for soccer scores

In Dixon, Coles (1997), they have used the maximum likelihood estimation for the two modified independent Poisson models in (4.3) to model the scores in soccer. I am trying to use R in order to ...
1
vote
1answer
26 views

R - How to convert from Mann-Whitney U to Z (or other effect size )?

I'm looking at multiple studies. I do not have the original data. One study I'm looking at provides means, standard deviations, and Mann-Whitney U values (with p). (How) can I convert from ...
3
votes
1answer
39 views

Not sure I understand how R calculates the covariance

Please forgive this silly question, I'm fairly new to statistics. Consider this R code: ...
6
votes
2answers
94 views

How to properly handle Infs in a statistical function?

Suppose I have a function such like: f <- function(x){ exp(x) / (1 + exp(x)) } it's supposed to work for any real value of x, but actually it returns NaN ...
1
vote
0answers
7 views

lmer() parametric bootstrap testing for fixed effects

I am performing a parametric bootstrap to test whether I need a specific fixed effect in my model or not. I have mainly done this for exercise and I am interested if my procedure so far is correct. ...
2
votes
1answer
143 views

How to use error term in AR (2) model for predicting future values?

We use turbidity to estimate suspended-sediment concentration (SSC)- our data was serially correlated. We ran an ARMA process and ended up with a AR (2) model. Our equation in log form is: ...
0
votes
0answers
14 views

Cummulative Mixed Model in R variable names.

I'm trying to fit a cumulative link mixed model clmm() in Rstudio. I'm currently having issues with the diagnosing what is wrong with my model from the output I am getting. The output I got from my ...
8
votes
2answers
626 views

Are there any libraries available for CART-like methods using sparse predictors & responses?

I'm working with some large data sets using the gbm package in R. Both my predictor matrix and my response vector are pretty sparse (i.e. most entries are zero). I was hoping to build decision trees ...
4
votes
0answers
21 views

R packages that work with biased samples

I'm working with a biased sample of web users. I'm only able to track responses of users who have navigated my site in a certain way, and I'd like to run an analysis to determine how certain factors ...
0
votes
1answer
24 views

Cluster with distance threshold in R

I'd like to get clusters with a maximum inner distance threshold. Now I use hc <- hclust(d) and cutree(hc, numofclasses). ...
1
vote
0answers
5 views

Evaluate deviation from negative binomial model

I'm trying to figure out how to determine to what extent a sample deviates from a negative binomial model fitted to a larger population. As an example, I generated counts of doctor visits for a ...
0
votes
0answers
11 views

Difference in memory usage between gbm and blackboost [migrated]

I'm working on a database with around 250000 observation and 50 predictors (some are factors so in the end around 100 features) and I have trouble using the blackboost() function (from mboost package) ...
1
vote
1answer
28 views

Dealing with different time series data in Machine Learning

I am trying to create a stock market model based on fundamental variables for the US economy. I am using R. Some of the variables I am looking to include are: GDP, Unemployment Rate, Initial Claims, ...
0
votes
0answers
30 views

How to do multilevel classification using R

I am trying to do a multilevel text classification using R. Is there any package in R which I can use to do it? If not, then how can I proceed using the svm or ...
1
vote
1answer
63 views

Using R to simulate a sampling distribution under $H_0$

We wonder if the colors (of which there are 6) in “Fun Pack” of M & Ms are distributed at random. Let us define as our test statistic $T$ (and there are many ways we could choose to do this) as ...
0
votes
0answers
9 views

How To Fix a Non-Representative Sample Using Ordinal Logistic Regression and Predict Appropriately?

After searching for this question, I did find this -- but it didn't seem to be asking the same question and I'd like to extrapolate on it if possible to get more into fixing it generally and the ...
0
votes
0answers
29 views

How Can I Make Sure All My .CSV Data Gets Imported as NA instead of Blank in R? [migrated]

In my dataset, I'm using have four assessments I'm trying to predict: 1 [Good] to 4 [Bad]. My model seems to be working using the polr function to predict values ...
2
votes
1answer
47 views

Can R substitute PRIMER efficiently and effectively?

Quite a simple question, looking to see if anybody has experience using both. I have no knowledge of PRIMER, but wondering if R (currently) has the same capacity for data analysis specifically for ...
1
vote
1answer
142 views

Accuracy rate in naive Bayes classification

I am trying to use a naive Bayes classification technique to predict fraudsters (Caller). My training set of 138 instances has 5 columns viz. ...
2
votes
2answers
95 views

Why is the Pearson correlation 1 when only two data values are available?

I am trying to obtain a Pearson correlation between 6 different variables (represented by columns in the matrix below) with two datapoints each (rows). This is the matrix: ...
2
votes
1answer
33 views

Observed variables in R's lavaan

I am running a SEM on lavaan in R. The model consists of latent variables [N1 to N3], two dummy choice variables [du1 and du2] and observed satisfaction variable [SV] (beside the observed variables). ...
0
votes
1answer
29 views

Confirmative Factor Analysis with R lavaan

i tried to do a cfa with lavaan package in R. I'm not sure, if SO is the right stackexchange plattform, if mathematics fits better just tell me and i will move it. Here is my model: I know how to ...
5
votes
1answer
78 views
0
votes
0answers
17 views

Detecting heterogeneity in groups

This is a mockup of a dataset I am currently working on: ...
4
votes
1answer
71 views

Alternatives to one-way ANOVA for heteroskedastic data

I have data from 3 groups of algae biomass ($A$, $B$, $C$) which contain unequal sample sizes ($n_A=15$, $n_B=13$, $n_C=12$) and I would like compare if these groups are from the same population. ...
0
votes
0answers
26 views

simulating distributions with non-symmetrical confidence intervals in R

I have a software package that outputs estimates that have non-symmetrical confidence intervals. I am simulating these distributions for further Monte-Carlo estimates. In the below example I am trying ...
2
votes
1answer
330 views

How to validate and compare models predicting a binary variable?

I have a question about determining which models are "better" and how to assess that info. Let's say I have three models, each which predicts our bid on won ping. Our bid is a continuous variable and ...
0
votes
0answers
10 views

Does Boruta feature selection (in R) take into account the correlation between variables?

I am a bit of a novice in R and feature selection, and have tried the Boruta package to select (diminish) my number of variables (n= 40). I thought that this method also took into account the possible ...
0
votes
1answer
173 views

Choosing one variable from each of 3 buckets of variables

I have a regression model that looks like the following glm.nb(formula = y ~ Gender + Age + x1 + x2 + x3, data = df) In my problem, there are 20 possible choices ...
2
votes
1answer
62 views

Non parametric Wilcoxon Signed Rank test

I have the following data vector(in fact its 2392 data points long): ...
2
votes
1answer
44 views

Meaning of Qqnorm plot in R

I am testing the normality of a sample with R using qqnorm. I obtain this: I understand that the meaning of this plot is that the sample has fat tails. But what is the meaning of the values on the ...
1
vote
0answers
33 views

R: What do I see in partial dependence plots of gbm and RandomForest?

Actually, I thought I had understood what one can show a with partial dependence plot, but using a very simple hypothetical example, I got rather puzzled. In the following chunk of code I generate ...
1
vote
0answers
18 views

How to Obtain “Right” Parameters of Multinomial Logit Model (or Other Conditional Models) in R?

I started to use the function multinom of R package nnet in order to fit several conditional ...
0
votes
0answers
16 views

How to compare forecasting methods: based on ARIMA and curve fitting?

I'm making a project connected with identifying the dynamics of sales. My database concerns 26 weeks (so equally in 26 time-series observations) after launching the product. I want to make forecast ...
0
votes
1answer
110 views

Undefined real result in a zero-inflated negative binomial

I have run a zero-inflated Poisson model in WinBUGS without problems, and now I am trying to run its equivalent negative binomial. However, I get an "undefined real result" trap message over and over. ...
1
vote
2answers
43 views

Understanding dummy (manual or automated) variable creation in GLM

If a factor variable (e.g. gender with levels M and F) is used in the glm formula, dummy variable(s) are created, and can be found in the glm model summary along with their associated coefficients ...
4
votes
2answers
45 views

Absolute (i.e., not just relative) probabilities in chi-squared test for proportions

Why do the absolute probabilities affect the p-value of a chi-square test so much? For example: ...
1
vote
0answers
24 views

Plotting fitted values for an nlme model

I just got the output of my lme (nlme) model called shalit5 with syntax: ...
0
votes
0answers
22 views

Help interpreting R linear model fit [duplicate]

I have observed variables power$values. I am trying to model this process using a second set of observations, such that $P = M\cdot X + B$. $P$ is the function ...
0
votes
0answers
10 views

Construct matrix of stacked variables in VAR regression

I am trying to NOT use packages for the estimation of models in order to have a deeper understanding of how things work. Currently, I am trying to estimate a VAR(1) (vector autoregression of first ...
1
vote
0answers
11 views

lme / lmer - split-plot with Non orthogonal subdesign

I have an agricultural field experiment (testing a plant protection agent): Split plot design with: ...
3
votes
1answer
55 views

Understanding coefficients in summary output of logistic regression in R

This question is about understanding the logistic regression output using R. Here is my sample data frame: ...
0
votes
1answer
524 views

Simple interrupted time series analysis

I have a weekly time series representing costs for a cohort. I want to tell whether an intervention on the cohort (we can assume it happened in a single week) has decreased costs for the cohort. I ...
1
vote
1answer
51 views

Constants in a DLM Model R

Good afternoon, I am attempting to fit a state space model of the form: $$ (S_t- \mu) = G*(S_{t-1} - \mu) + E_t $$ $$ Y = F*S_t + v_t $$ Where $Y$ is nx1, $G$ is 3x3, $S_t$ is 3x1, $\mu$ is 3x1, and ...
1
vote
2answers
28 views

what does the correlation of Random forest regression tool in R represent

I've built a random forest model (regression model) using randomForest package in R, and I calculate the correlation between the predicted values and the actual ones in order to know how the trained ...
0
votes
0answers
14 views

Lsmeans: Is this what I did?

after doing the linear mixed model with lme4, I have used lsmeans for pairwise comparison with this command: lsmeans(lmer52, pairwise~color, adjust="tukey") I am ...
0
votes
0answers
29 views

How to do Regression Discontinuity Design in R [on hold]

I am having trouble with doing regression discontinuity design in R. Could anyone show me a syntax for R to do RDD? The exercise I have is y= wealth x=winning margin covarites= education, past ...