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
1answer
9 views

Non-Parametric Density estimation with a positive variable

I’m struggling to find a way to represent a kernel density estimation with a nonnegative random variable. I have read a couple of articles tackling this issue; however I couldn’t implement it in R. I ...
0
votes
0answers
2 views

model average predictions in MuMIn

This code is taken from the MuMIn package: ...
0
votes
3answers
32 views

Simulate data for 2 x 2 ANOVA with interaction

What is the best way to simulate ANOVA data for a 2 x 2 design with interaction using a regression approach? I want to generate the data so that I know the true regression coefficients of the model ...
-2
votes
1answer
76 views

GLM model explanation

Can anyone please tell me what kind of model is being run with the following R call: glm.fit(covar,pred,family = binomial()) I know what ...
3
votes
2answers
123 views

How to estimate model with both linear and exponential parameters?

I have a theoretical growth function that can be perturbed by events, and I'd like to estimate the growth parameters as well as the perturbation, and the rate of falloff after that perturbation. I'm ...
2
votes
1answer
45 views

How do I incorporate 2 peaks in a liquidity model using curve-fitting and nls

This is my first time at stack exchange, hence please pardon me if I miss something. I have multiple questions and I am tearing myself as curve-fitting and estimation is foreign land to me, I am ready ...
2
votes
1answer
27 views

nls curve fitting of shared parameters

I have data for 5 replicates that were drawn from the same model and I want to fit all 5 replicates together so that I can find out the shared parameters. Specifically, if I have the underlying ...
0
votes
0answers
6 views

Problem in creating neighbors,area and perimeter in spatial econometrics using R

I’m working on a spatial cross section model with R-programming-language. I’m running these codes which refers to ...
0
votes
1answer
461 views

Transfer functions in R (TSA package)

In Time Series models’ transfer functions there is a decay parameter in the formula (let’s call it b). In TSA package that decay parameter is not mentioned. When I used other software before (such as ...
0
votes
1answer
17 views

Difference in rules via apriori() with target “frequent itemsets” and ruleInduction() and via apriori() with target “rules”

Regarding R package arules: To my understanding the Apriori algorithm works by first finding all frequent itemsets that meet the support threshold and then generate strong association rules from the ...
0
votes
0answers
9 views

Covariance Matrix using Delta Method

I am trying to get the variance-covariance matrix of a transformation using the Delta Method. Originally, I have coefficients (let's call them X1, X2, etc...) and their variance-covariance matrix. ...
1
vote
1answer
11 views

How to compute RMSE for TBATS

Some forecasting models in R give error terms as their output. But for TBATS, I couldnt find out that how I can see what the RMSE for my data set is. Is there any specific command that I have to use ...
0
votes
0answers
9 views

How to apply a set of statistical methods to each of the clusters obtained using a specific clustering method

Suppose I have generated 2 to 10 clustering solutions and found that 4 is the optimum number of clustering solution for hierarchical clustering. Now I wanted to apply a variable selection method ...
0
votes
0answers
7 views

Storing a kd-tree

I am trying to create a kd-tree using FNN package in R. get.knnx() usually computes kd_tree whenever a new search point is encountered. My problem statement is to store the kd tree for a set of ...
0
votes
1answer
73 views

ANOVA and post-hoc analysis using R when we only have means and SD of three populations

I want to perform an ANOVA using R. I have three populations, represented by their respective means and SD: Pop.1: 5.5 +- 0.4 (n=100) Pop.2: 5.9 +- 0.3 (n=150) Pop.3: 6.2 +- 0.5 (n=200) Which is the ...
0
votes
0answers
9 views

About Hypothesis Test In Spatial Regression

I'm doing estimation of spatial lag/error model using R package "spreg"/"spdep". But I can't find any method to do hypothesis test after regression. For example, I want to test whether two ...
0
votes
1answer
50 views

Error with syntax for BayesGLM in R with Gaussian family

I am trying to fit a Bayes glm model with an inverse Gaussian family and link="identity". However, I'm getting the following messsage: ...
0
votes
0answers
33 views

R: Prediction using glm() [migrated]

I am using glm() function in R with link= log to fit my model. I read on various websites that fitted() returns the value which we can compare with the original data as compared to the predict(). I ...
1
vote
1answer
2k views

Anova from R output interpretation

I have a question on how a statistician would normally interpret an anova output. Say I have anova output from R. ...
2
votes
1answer
149 views

Objective function in linked prediction models

I would like to use R “optimize” function to estimate the model: $\hat{Y_{t}}=a\cdot \hat{Y}_{t-1}+b\cdot X_{t}+c\cdot X_{t-1}$ Important thing is that the predition $\hat{Y_{t}}$ (let’s say ...
4
votes
1answer
145 views

Exponent for non-linear regression (in R)?

I have a non-linear reglationship and I want to find the best way to determine the value for the exponent $\gamma$ in the following regression: $y = \beta x ^ \gamma$ I would preferably like to do ...
0
votes
1answer
18 views

Post-hoc tests for 2x2 ANOVAs (Type II & III) with interactions in R

I am trying to analyze data from an experiment using R and ran across a problem regarding the use of post-hoc tests with Type II & III ANOVAs. I only know of R functions that perform post-hoc ...
0
votes
1answer
19 views

backward selection multivariate analysis usind R

I want to perform an exploratory Cox regression analysis of medical data using R. I am practicing using the pbc data from the survival function. How would you recommand performing a backward ...
2
votes
0answers
123 views

Mixed effect linear regression model output interpretation

I just fitted the following linear mixed effects model: ...
0
votes
1answer
94 views

mixed effects model output

Let's say we have this: ...
3
votes
1answer
82 views

Comparing estimators in Cauchy distribution

Given $n$ observations with a Cauchy distribution (location=t,scale=1), I would like to compare estimators such as the mean and median by simulating sample means and mean square errors. This is an ...
1
vote
1answer
15 views

HR of a continuous variable and manipulation of its interval

I am a medical intern trying to understand Cox regression modelling using R. I am using the pbc data of the survival package with the following code: ...
0
votes
1answer
48 views

Partial least squares regression for categorical factor in R

I adjust the partial least squares regression for one categorical factor (2 levels – be or nottobe) with with the ...
1
vote
1answer
65 views

Mixed Model Analysis of Experiment Data using lmer() Function (lme4 package in R) where Levels in Stimulus Grouping Factor equal Observations

I am running a post-hoc analysis on the data collected during an experiment in which 15 unique stimuli were presented to participants. Having run a least squares regression using the lm() function in ...
2
votes
0answers
32 views

Confidence interval for $\eta^{2}$ for MANOVA in R

I have to report the Confidence Intervals for the $\eta^{2}$ obtained in a MANOVA in R. I use the function etasq of the package heplots to obtain the $\eta^{2}$. ...
0
votes
1answer
37 views

Machine learning - curve categorisation

I have curves of the following structure (it is the blue one I am interested in) These curves reflect the volume of blood (actually gamma ray counts) in the left ventricle as a function of time ...
0
votes
0answers
13 views

Plot 2D view of 3D joint ecdf with isolines

I have this matrix, histDict, which is a dictionary of data of variable X for each value of variable ...
0
votes
0answers
33 views

R- Improving linear regression fit

I am trying to construct a predictive model in R. I am using the glm() in R to fit the model. I am getting a very high residual error after fitting the model. My target values are in the range of ...
0
votes
2answers
27 views

ROC (Epi library) how to calculate TP, FN,TN, FP

I'm trying to find how to compute the true negative (TN), false negative (FN), true positive (TP), and false positive (FP) if I have a cutpoint like in the following picture: ...
0
votes
1answer
18 views

java.lang.OutOfMemoryError using bartMachine package in R

I ran a BART model with 11000 samples and 20 features(half of them are categorical variable). My mac has 8G ram. At first, I set memory to 5000 MB via function set_bart_machine_memory(5000). Then I ...
1
vote
1answer
15 views

Correct specification of HLM in lmer

I originally learned about random effects models when taking a course on Hierarchical Linear Models, which was taught using Raudenbush and Bryk's HLM book and software, and it sort of indoctrinated me ...
0
votes
0answers
10 views

Selecting variables in an SPSS-file (*.sav) using R [on hold]

I'd like to use a SPSS file (European Values Survey, to be more precise) in R. Specifically, I want to select certain variables (a country, a certain question [trust in armed forces] and the ...
4
votes
0answers
54 views
+50

Calculate incidence rates using poisson model: relation to hazard ratio from Cox PH model

I want to calculate incidence rates to present along hazard ratio's in order to present both relative and absolute measures of risk. I saw in other studies that such incidence rates can be calculated ...
0
votes
0answers
16 views

Testing the accuracy of transformed data

I have run my data through a model in r, i ran ARIMA to forecast. The model forces a log transformation to be applied to the data. To test the accuracy of the fitted model formed by ARIMA would i need ...
0
votes
2answers
32 views

Problem in ARIMA Model in R

I am running ARIMA model in R and I used auto.arima(X) function to decide appropriate model.After using this function I found that the order of my model is ARIMA(2,1,0). The problem is I run the same ...
3
votes
1answer
38 views

Difference between the forecast and simulate functions in the {forecast} package in R

I have been using the forecast package in R to make forecasts based on an ARIMA model and have noticed a difference in the output of the forecast and simulate functions when calculating confidence ...
0
votes
0answers
38 views

Mann-Whitney U-test in R

I'm doing a Mann Whitney U test in R but it won't run the code: downstream<-subset(mydata,Direction=="D") Wilcox.test(Date, Species, data="downstream") ...
3
votes
1answer
269 views

R: Anova and Linear Regression

I am new to statistics and I am trying to understand the difference between ANOVA and linear regression. I am using R to explore this. I read various articles about why ANOVA and regression are ...
0
votes
0answers
9 views

Getting different results for 'class()' method [migrated]

Here's the smallest piece of code which displays how i am getting different results for class() when called directly for columns vs when called using apply. data.frame looks like this. ...
4
votes
1answer
521 views

What does it mean that random effects are highly correlated?

What does it mean when two random effects are highly or perfectly correlated? That is, in R when you call summary on a mixed model object, under "Random effects" "corr" is 1 or -1. ...
0
votes
1answer
764 views

Optimization of multiple objective functions with constraints

I have a number of objective functions like: y1 = a11* x11 + a12*x11*x11+ a13*x12+....... y2 = a21* x21 + a22*x21*x21+ a23*x22+....... ::::: ::::: ::::: These ...
0
votes
0answers
20 views

find group of rows in a matrix with pattern similar to another matrix

I've been scratching my head about this problem for some time: I have a big gene expression dataset (20k genes x 200 samples) in matrix A and i have a subset of this dataset (i.e. 40 genes x 200 ...
0
votes
0answers
16 views

Simulate KM curves with assumptions in R

I am looking to simulate 2 survival curves under different assumptions on the mean / median process underlying the 2 arms. Has anyone done this in R?
0
votes
2answers
211 views

How to generate Normal variables parts of which are correlated (in R)?

My second attempt to explain the question. Start with a vector of numbers V1 of length M. The elements of V1 form a Normal distribution. Take (any) N elements from this vector. Generate a replica of ...