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
vote
1answer
13 views

Association rules (market basket analysis) - rules involving the absence of items?

I was wondering if associations rules can include the absence of an item, for example, in this simplified set of transactions: ...
4
votes
1answer
123 views

How to formulate linear mixed model to find out effects of continuous variables?

I have a dataset with growth rate as a response variable (resp in the example) and temperature, food availability, and salinity as predictor variables (...
0
votes
0answers
10 views

1-period rolling out of sample forecast for dynlm model

I have six monthly time series that span from January 2005 until June 2014. I'm trying to test two different dynamic linear models and compare how they perform in one period ahead forecasting. I have ...
1
vote
0answers
18 views

How to account for overdispersion in a glm with negative binomial distribution?

I'm analysing count data with a generalised linear model in R. I started with a Poisson family distribution, but then realized that data was clearly overdispersed. I then took the option of applying a ...
1
vote
1answer
13 views

HMMFit underlying algorithms

After reading article "Hidden Markov Models for Controlling False Discovery Rate in Genome-Wide Association Analysis" by Zhi Wei I am trying to use it in my project. I am using R and I have found out ...
0
votes
0answers
6 views

Classification under uncertainty in observations

I am tackling a multiclass classification problem where the values of the independent variables are not known with certainty. Instead, each observation is represented by a multivariate Gaussian pdf ...
0
votes
1answer
17 views

How to choose an appropriate maxdepth in rpart.conrol?

I'm using the boosting method in adabag library and trying to choose an appropriate maxdepth in rpart.control for building a 2-class classification model using my training dataset. I have noticed that ...
0
votes
0answers
13 views

Exponential distribution of interval censored data MLE using optim on R error

I have a set of data which is interval censored and I wish to calculate its maximum likelihood error using optim. This is my code: ...
1
vote
0answers
55 views

testing interaction terms in regression model [duplicate]

Based on domain knowledge and preliminary variable selection, we have decided a set of 10 variables as predictor variables for building regression models. What are the general approaches to identify ...
2
votes
1answer
48 views

Linear regression with an inequality constraint

I am looking for an efficient way of finding a linear fit $Mx = y$ subject to an inequality constraint: $\frac{|x_2|}{\sqrt{x_3^2 + x_4^2}} \geq a$, with $a \geq 1$. The rectangular matrix $M$ is ...
0
votes
0answers
13 views

Graphing GEE Models in R?

I am currently working on a biological dataset where I am attempting to fit a detection function (Detection probability as a function of distance). I have been using the package geepack (in R-studio) ...
0
votes
0answers
4 views

Splitting and iterative simple regression in r [migrated]

I am pretty much new to r and I have a dummy example of a bigger table underneath. I want to split the table based on id variable (a,b,c,d) and do iterative simple linear regression for every subset: ...
0
votes
0answers
28 views

Using lmer for random effect and nested interpreting model comparison

I'm trying to do a lmer in r. I did an experiment in which I manipulated the temperature. My dataframe contains the following factors: Site: 11 level, random Species: 2 levels, fixed Subject: 10, ...
1
vote
0answers
27 views

Forecast of spot electricity prices

I recently started a job in power trading. But due to a sudden change in employment I am required to work on econometric models to gauge the supply and demand side of national power markets. So ...
1
vote
1answer
24 views

comparison of forecasting models for daily data (frequecy=365)

I have 852 days of daily attendance data and need to use the first 800 days data to predict the next 52 days and match it with my actual values. How do i decide which is the best model to use for ...
0
votes
0answers
25 views

R gam() throws error: “Can't correct step size”

I am computing a GAM on a large set of data sets. Almost all of them work, just this one data set makes gam() throw an error. I paste a code that reproduces this error here: ...
0
votes
0answers
28 views

Meta-analysis: design mixed-effects model in R

this is an example of my dataset: ...
0
votes
1answer
31 views

Meta analysis: transform forest graph output to percentage effect in R {metafor}

I need the forest graph expressed as % effect. I have run the model with the log ratio, and I know I could back-transform using transf=exp, which would plot the forest graphs expressed as the ratio ...
0
votes
0answers
10 views

Include confounder into partial least squares regression

I am wondering, when using partial least squares regression to investigate a research question, there is predictor component (T) and response component (U), if I want to adjust for confounders (C), do ...
0
votes
0answers
17 views

Latent Class Analysis — 0.632+ Bootstrap vs. Bayesian LCA and Empirical Bootstrapping?

I am working on a project that involves the use of latent class analysis (LCA) and have been thinking about how best to perform variable selection (with relatively high-dimensional data [approximately ...
1
vote
1answer
60 views

Likelihood ratio test for comparing two exponential distributions

I am trying to use a likelihood ratio test to compare the parameters of two exponential distributions. by this thread Likelihood Ratio for two-sample Exponential distribution I found that I can use ...
0
votes
1answer
34 views

K means clustering of variable with multiple values

I have a sample data below that is from a large data set, where each participant is given multiple condition for scoring. ...
0
votes
1answer
43 views

What is a threshold for calculating correlation between two variables

I have an assignment where I need to write a function between two variables: Write a function that takes a directory of data files and a threshold for complete cases and calculates the correlation ...
3
votes
3answers
114 views

What are some popular choices for visualizing 4-dimensional data?

Say I have the following four dimensional data, where first three can be considered as coordinates, and the last one can be considered as values. ...
0
votes
0answers
13 views

Aggregation of Individual-Level Multinomial Probabilities in R

I have a multinom (multnomial) logit model in R which predicts the probability that a given individual prospective customer will ...
1
vote
1answer
40 views

How can I estimate a principal component from incomplete data?

I would like to know the best way to estimate a principal component's latest value, if I only have partial information about the latest variable data points: Assuming I have 5 variables: ...
1
vote
1answer
38 views

R caret package - number of principal components when preprocessing using PCA

I am using the caret package in R for training of binary SVM classifiers. For reduction of features I am preprocessing with PCA using the built in feature [preProc=c("pca")] when calling train(). How ...
0
votes
0answers
33 views

Formula behind forecast in R

Can anyone tell me the formula behind the forecast function in R? Preferably in the form easily understood by mathematicians (e.g x_t, θ etc) Here is my code in ...
2
votes
0answers
20 views

Calculation of Average run length in non-normal distribution

I want to calculate Average Run Length(ARL) in non-normal distribution. In a normal distribution, I can calculate the ARL for example, ...
0
votes
0answers
26 views

Posterior simulations in quantile regression

I'm fitting quantile regression models and would like to do posterior simulations from the fitted models, i.e. generating new random data which could arise from the model. I would know how to do this ...
0
votes
1answer
10 views

Clustering Data majority is 0

I am performing a cluster analysis with a 4K by 200+ table and my data mostly looks like this: ...
0
votes
0answers
15 views

red lines in R pairs function [migrated]

I am wondering what the red lines in R pairs function are. pairs(USJudgeRatings, lower.panel = panel.smooth, upper.panel = panel.cor) What I am actually looking ...
2
votes
1answer
41 views

Inconsistency between sample median and theoretical median for skewed normal using rsnorm in fGarch

I am using the rsnorm function within the R fGarch package to generate random samples from a skewed normal distribution. ...
0
votes
0answers
7 views

looping to make new variables R [migrated]

is there a cleaner way to do the following using a loop solution in R? As of now, I am resorting to cutting and pasting, which changing the reference column as I want to result to be attached to an ...
0
votes
1answer
26 views

Is it the correct usage of nnet in R

I have a dataset that looks like this : ...
0
votes
0answers
26 views

How does the R library “randomForest” order factor levels?

So my question is, which level gets number 1, which one gets 2.. etc. I speculated that it could be the order in which they appear in the input / alphabetically, but none of these seem to be correct. ...
0
votes
1answer
44 views

Gower distance with R functions; “gower.dist” and “daisy”

I have 9 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. I tried both daisy(cluster) and ...
0
votes
1answer
45 views

Exact two sample proportions binomial test in R (and some strange p-values)

I am trying to solve the following question: Player A won 17 out of 25 games while player B won 8 out of 20 - is there a significant difference between both ratios? The thing to do in R that ...
0
votes
0answers
6 views

How does one merge two cross-tabulated dataframes based on common species names? [migrated]

My dataframe (df) 1 has 38obs. of 40 variables My dataframe (df) 2 has 30obs. of 35 variables The first three columns of each df is the same thus I want to retain these headers common to both. Some ...
0
votes
0answers
17 views

ANOVA and Principal Component Regression

I Just need your valuable suggestions. ...
0
votes
0answers
10 views

Unique function leaves out column [migrated]

Say I use the UNIQUE function of R to create a script to pull out particular columns of a premade dataframe to make a new one: ...
0
votes
1answer
50 views

Assessing the effect of an intervention on a time series (in R): terrible Ljung-Box p-values

I am trying to test the effect on the heat flux between indoors and outdoors before and after removing insulation. Briefly, I have 26 sensors on a wall, measuring heat flow between indoors and ...
0
votes
0answers
23 views

Tuning a Maximum Liklehood estimation

This is a follow up question to this question on Cross Validated to which I unfortunately didn't get any replies. The context stayed the same but the method I want to use is completely different so I ...
0
votes
2answers
45 views

Multiple linear regression, backward selection : Normality of the residuals?

I need to create a Multiple Linear regression model on those data explaining max03 T9 T12 T15 Ne9 Ne12 Ne15 Vx9 Vx12 Vx15 maxO3v !My data 1 My first intuition was to make a backward selection : ...
0
votes
0answers
20 views

Explaining the methodology behind this ARIMA weighted code

I have a code that was given to me that runs an ARIMA model putting weight on more recent errors, it gives excellent results, much better than simple ARIMA, but i do not understand the methodology ...
5
votes
3answers
36 views
0
votes
0answers
22 views

“object 'logl.H0' not found” - Error in fitMeasures when calculating AIC for Lavaan model

EDIT: SOLVED The problem seems to have been an explanatory variable that was a factor. If it is made binary numeric insted, the values of BIC and AIC is calculated alright. However, the analyses give ...
2
votes
1answer
29 views

Finding the R squared value in Multilinear regression

I currently have 3 different models to run against a specific output. The data is stored in 4 columns: a, b, c, d where a is the actual value that b, c and d are trying to model. Columns b, c, and d ...
0
votes
1answer
38 views

Confidence interval for difference between predicted vs actual rates

I would like to generate a confidence interval for predicted vs actual rates. I am auditing my group of anaesthetists (aka anesthesiologists) to see how we compare on a number of potentially ...
0
votes
0answers
17 views

the approach of performing correlation analysis between categorical and numerical

What are the approaches to perform correlation analysis for the following pairs: ...