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

-2
votes
0answers
16 views

Multiplying coefficient to get yhat

I am trying to build a model using this equation equation: yhat = b0*b1(x1)*b2(x2)*b3(x3) Most of the data are dummy variables and I can't used interaction ...
1
vote
2answers
34 views

Need help with nested random/mixed effect model specification

I am a newbie in meta-analysis and I need your opinion on the design of my random-effect model. I have conducted an experiment on the performance of a provider who has around 30-40 data centres. I ...
2
votes
1answer
21 views

Bonferroni Correction for Post Hoc Analysis in ANOVA & Regression

As we know, if we are doing many tests or multiple comparison, we don't use the same $\alpha$ value and use some $\alpha$ correction methods like Bonferroni. This is done because when we do multiple ...
2
votes
1answer
38 views

calculating adjusted means from lmer

How can I calculate adjusted means for a regression model with fixed and random effects? I'd like to calculate the adjusted means for a lme regression with this formula ...
3
votes
0answers
29 views

Markov decision process in R for a song suggestion software?

We have a music player that has different playlists and automatically suggests songs from the current playlist I'm in. What I want the program to learn is, that if I skip the song, it should decrease ...
0
votes
0answers
13 views

create_WX() always creates NA [migrated]

Using spdep for R (a collection of tools for spatial econometrics), I wanted to build a regression matrix myself. The matrix is the combination of two matrices, one ...
0
votes
0answers
7 views

R Shiny Matrix Multiplication [migrated]

I am currently developing an Monte Carlo Simulation with R's shiny. Unfortunately, I am stuck at some and can't see the error right now. I tested the code for the simulation before and it works. What ...
0
votes
0answers
24 views

Question about histrogram in R-studio [on hold]

Here is my code in R-studio hist(NPV, breaks=40, main="Frequency Distribution of NPV", xlab="Net Present Value (NPV)", col="blue", ylim=c(0,1000)) I have some questions about histogram in R-studio ...
1
vote
0answers
9 views

Weighted kappa: kappa2 (irr) vs cohen.kappa (psych)

I want to calculate the weighted Kappa value with R. I compared two functions kappa2 and cohen.kappa but the two kappa values disagree. Is there an explanation for this or am I doing sth wrong? My ...
1
vote
0answers
13 views

“Multi-Task” Logistic regression with time series data [on hold]

I'm trying to create model for consumer loan defaults that incorporates individuals payment behavior as time series. Typically this kind of problem is modeled using Cox/Allen model. Then, the other ...
0
votes
1answer
12 views

How should I test for multivariate ARCH effects in R?

I want to test for conditional heteroskedasticity in the form of ARCH effects in a multivariate time series. In the univariate setting, an ARCH-LM test can be used. A natural extension for the ...
2
votes
0answers
25 views

Class probabilities in Neural networks

I use the caret package with multi-layer perception. My dataset consists of a labelled output value, which can be either A,B or C. The input vector consists of 4 ...
0
votes
0answers
12 views

Trying to understand xmeans (using R, RWeka)

In a project I want to use XMeans to estimate the 'optimal' number of clusters that are distinguishable in different datasets. The numbers I got seemed too low, so I experimented a bit with generated ...
0
votes
0answers
22 views

Fitting a GLM for binomial data in R

I am an R beginner and out of my depth! I am trying to build a model to analyse data regarding fertility in 2 populations of different levels of sexual selection(M and P), both of which have undergone ...
0
votes
0answers
17 views

Is ARIMA L-step forecasting the same as applying the model to values 1 to L?

My goal is to forecast sensor measurements (e.g. temperature, humidity) in a lightweight (and real-time) fashion. To this end I use ARIMA forecasting as implemented in R, where I retrain the model ...
0
votes
0answers
12 views

Weighted kappa: kappa2 (irr) vs cohen.kappa (psych)

I want to calculate the weighted Kappa value with R. I compared two functions kappa2 and cohen.kappa but the two kappa values disagree. Is there an explanation for this or am I doing sth wrong? My ...
0
votes
0answers
18 views

How to subset all rows from data frame for repeated measures [migrated]

The background for my question is: I have a dataset consisting of repeated measures, one data point per row. These data are from a longitudinal study and therefore at the moment not every subject has ...
6
votes
3answers
691 views

How to avoid log(0) term in regression

I have following simple X and Y vectors: > X [1] 1.000 0.063 0.031 0.012 0.005 0.000 > Y [1] 1.000 1.000 1.000 0.961 0.884 0.000 > > plot(X,Y) I ...
1
vote
0answers
24 views

What is the best way to present rank survey data?

I have a survey data where I've asked a local community to rank 6 different issues they face on a scale of 1 to 6. For example, ...
0
votes
0answers
14 views

R: How to choose the height parameter in cutree, or: how to find the optimal number of clusters in UPGMA clustering?

I am using hclust() to carry out a UPGMA clustering (method="average") in R. Then, I'm using ...
0
votes
0answers
18 views

Rank Deficiency?

What can I do about rank deficiency? Can I just ignore it? I have an unbalanced dataset and using logistic regression (caret glm). I get 50 errors saying that my data is rank deficient and the results ...
1
vote
0answers
85 views

Bayesian modelling, measurement error & carrying-over posterior distributions

I have a (fairly convoluted, but well-inentioned) model in my head, and am trying to figure out if it's possible to code (I am currently getting to grips with R2WinBUGS). The final model is basically ...
0
votes
0answers
18 views

variance-covariance matrix in R for Weibull survival curve

A simple doubt: Can I use values from vcov(ajust) directly? Or do I need some kind of transformation? I mean, for a Weibull model, does ...
1
vote
2answers
42 views

ANOVA with three IVs

I have a following problem: I have some research data that need to be analysed. There are three randomized independent variables (binary) and one dependent variable (reaction time). The data consists ...
1
vote
1answer
42 views

Proving similarity between two rankings

We are seeking a comparison of two different rankings of the same 3 systems Background: We have conducted a test of 3 different systems. Participants experienced a system and rated it on a 7-point ...
2
votes
0answers
31 views

What is the phi matrix in SEM? [on hold]

How is it found in the output? I am trying to do confirmatory factor analysis using sem function in R. Everything works fine, except I don't know how to obtain phi matrix. Below is my model ...
0
votes
0answers
51 views

ROC curve cut off and weights

I have a dependent variable distinguishing between patients that should go to treatment A or treatment B. I want to develop a questionnaire containing binary variables that should decide if the ...
0
votes
0answers
10 views

Calculated predicted probabilities for multilevel model don't seem to be right

I have an administrative database with hospital readmissions (binomial: yes/no) and a couple of predictors. I've fitted a multilevel model with the function glmer ...
1
vote
0answers
24 views

Fit ARIMA model to new data, preserving some coefficients in R

I create a demand forecast for a company that sells, say, toasters. We have one old standby model that's just finally stocked out, and a series of much newer models with shorter time series of sales ...
1
vote
1answer
48 views

R formulas: difference between ~A+B+A:B, ~0+paste0(A,B), ~paste0(A,B)? What is the mathematical meaning of those formulas please? [on hold]

I am trying to get my head around R formulas for statistical tests. I have read this page (http://cran.r-project.org/doc/manuals/R-intro.html#Formulae-for-statistical-models) which is really helpful. ...
0
votes
0answers
30 views

nlminb package in R

I have 5 parameters, can I use the nlminb package to solve the likelihood? The likelihood: ...
0
votes
0answers
23 views

Compare factor levels in R [migrated]

I have a question regarding factors in R. Is there a way to compare the levels of each factor? I am interested in whether a level of one factor is a subset of a level of another factor. For example, ...
0
votes
0answers
17 views

Advice on ANOVA formula for nested random design

I have read "Design and Analysis of Experiments" 8th Edition by D.C. Montagomery. In Chapter 14, there is a nested experiment with two factor A and B. Both factors are random. Then the ANOVA test ...
0
votes
0answers
9 views

Combining Date and Time columns in R [migrated]

I have a dataset that Im readying for some time series regression analyses and I have a specific question about merging two columns in R. I have the following two columns: and I need to combine ...
0
votes
0answers
19 views

QQPlot against Gram Charlier density function [on hold]

I have a residual series now and want to have a QQ plot of the series against the Gram Charlier generalized normal distribution, which means that the theoretical quantile function is the pdf of Gram ...
0
votes
0answers
16 views

Integrated Classification Likelihood computation for R package HDclassif

I'm in the process of fitting some mixture models to some data I have. As this data is high-dimensional, I used the subspace clustering package HDclassif. As the package has no option for the Akaike ...
0
votes
0answers
46 views

Timeseries Regression - threshold value, regular and time-series covariates

i am trying to find a time-series regression or machine learning package that allows the following analysis: Lets assume that ice-cream sales are a function of: a) a threshold value on outside ...
0
votes
0answers
17 views

Unbalanced mixed design ANOVA in R [closed]

I've tried looking for the answer to my question, but unfortunately I couldn't make sense of a lot of it. Hope you can help. I have a dataset with Distance (numeric) as dependent variable. I have two ...
0
votes
0answers
12 views

Two Different Interaction Terms for Mixed Factorial ANOVA in R?

I have the following R output from a mixed factorial ANOVA: ...
0
votes
1answer
35 views

Heckman two-step regression estimated covariance matrix in R

While using R for estimating the Heckman 2-stages model a friend stumbled on a problem. the selection() funtion from the package sampleSelection estimates everything just fine. The code is as follows. ...
0
votes
0answers
13 views

How to use sapply function (or similar) for a matrix, not a vector? [migrated]

To speed up the following: ...
1
vote
0answers
33 views

Is my Sales growth dependent on Commissions/Discounts and how do I analyze this in R?

We are capturing sales data by time series (Month by month). Some of the items have commissions and some have discounts and others have both commissions and discounts. Is it commissions or discounts ...
0
votes
0answers
19 views

TIC criterion for normal regression model

I'm looking for the application of the TIC criterion in r. The TIC is an adaptation of the AIC criterion where the penalty term is replaced by the trace of the score and the Fisher information matrix ...
1
vote
0answers
23 views

Meta-analysis in R using SE and weights based on number of years of the experiments

I have a dataset with this format, containing different experiments and mean and SE values for two treatments (amb and elev), to ...
0
votes
0answers
29 views

Get data examples with answer form randomForest in R [closed]

When I call predict(rf , testExample) function returns result (number for regression , category for classification). How I can retrieve from predict not only ...
0
votes
0answers
15 views

Subset dataframe has lm residuals of length == original dataframe [closed]

I have a dataframe which I apply a subset operation to. I've tried both methods ...
0
votes
0answers
24 views

How to return score vector after glm in R? [migrated]

I am trying to get the score vector (first order derivative of log likelihood) from probit in R. Here is my sample code: ...
0
votes
1answer
11 views

What is the equivalent of the complexity parameter ( rpart in R ) in python for regression trees (sklearn)?

The complexity parameter decides when to stop splitting. what is its equivalent in python. As decreasing the cp tends to increase the accuracy in the prediction, so is there a similar parameter in ...
1
vote
0answers
13 views

Effective number of independent tests, M(eff), to FDR adjusted p-values

I am trying to adjust a set of raw p-values with FDR method (BH). One of the assumptions in BH method is test independence. I know that some tests are clones and another ones are testing a very ...
0
votes
2answers
31 views

Can we use weights in lme as a covariable?

This question might be a duplicate, but a colleague and I have trouble understanding previous answers about the use of weights in lme. So in simple terms: We have an experimental design with 2 ...