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
3 views

lme4: Why won't lsmeans output my fixed effects?

I'm trying to plot confidence intervals for linear mixed effects models trained with lme4 and lmerTest in R. I am using this data file, which I've shared via Google Drive. Here is my trained model. ...
2
votes
0answers
15 views

What are the formulae used in R by predict.lm when interval= a) 'none', b) 'prediction', and c) 'confidence'?

The references provided in the R documentation for predict.lm, taken together, actually leave open a number of possibilities for the formulae for confidence and prediction intervals (including the ...
0
votes
0answers
17 views

Factor Analysis

I have following data regarding Voice traffic(dependent variable) and some 10-12 other variables which are my independent variables. So, to use factor analysis shall I use voice traffic as one of the ...
0
votes
0answers
8 views

Comparing performances of distributions

I have a Probability Distribution Function (PDF) of a new distribution given below, \begin{equation} g(x)=\frac{1}{\Gamma \left( \alpha ...
0
votes
1answer
16 views

Zooming in on tail of histogram plot in R [on hold]

First off I've been using the truehist() function in R instead of hist() mainly because it looks better (but I'm pretty sure this mainly just because it has a better bin allocation). Currently, I ...
0
votes
0answers
12 views

Finding the distribution of a pormanteau test

I am trying to find the distribution of a pormanteau test for lack of fit estimating an ARIMA(1,0,1) with white noises and fitting an ARIMA(1,0,1). I know this is not the best way to obtain a certain ...
0
votes
0answers
15 views

Analyzing a continuous by categorical interaction using R

I want to analyze a significant interaction effect of a continuous variable and a categorical variable which has 15 levels. My equation looks like this: rlm(z~X+Cat1+Cat2+Cat3+XCat2+XCat3) z is ...
0
votes
2answers
49 views

Weird Results in Newton Raphson

I am running a simple Newton-Raphson problem in R as given below. However I am getting very weird results. Can anyone tell me where I am going wrong? ...
0
votes
0answers
13 views

How to visualize the equation line in a scatterplot of a log-linear robust regression model in R? [on hold]

The data I'm working requires me to run a robust regression with a log transformation of the outcome variable. After running the following code, ...
1
vote
0answers
11 views

Backward selection (with fastbw) in penalized logistic regression

I have a dataset with more than 20 predictors and a single binary response variable. With only $n=181$ observations, I decided to apply penalized logistic regression to modeling, with all predictors ...
0
votes
0answers
19 views

pvalues for fixed effect using lme function in R

I am using the lme function from nlme to run a random coefficient model. Please see the output of summary(mod1) below. I need ...
1
vote
0answers
17 views

Large difference in parameter d using different estimators

I am trying to estimate parameter d for ARFIMA model using different method : Hurst, ML, fdSperio, fdGPH and the function arfima which selects the best fit automatically. The results shown are too ...
0
votes
0answers
5 views

R predict on xts object not generating dates for future forecasted points [migrated]

I have a data frame where one column represents my daily observed values and a date column formatted "2014-10-01" using the as.Dates function. I'm creating an xts object doing the following: ...
0
votes
0answers
7 views

What does the “terms” attribute of the object returned from the posterior method of topicmodels package mean in R?

I am using topicmodels in R and I understand how it works when it comes to fitting a topic model to a corpus of documents. When I take the fitted model and then call the posterior method on it with ...
0
votes
0answers
14 views

how to remove specific value in R? [on hold]

I have few Id's in my data set as '0.000000e+00' , which i want to remove from my data set ( i mean all records related with this id) please support with required code
2
votes
0answers
38 views

Is glm(A~B*C*D) the same as glm(A~C*B*D)?

When I run these two in R, I get different values. I thought that I should get the same values since it just includes their interaction terms.
0
votes
0answers
12 views

Clustering where intra-row sign matters but inter-row sign doesn't

I'm not sure how best to express this question except through an example. I have some data, let's say it represents the inputs from 2 partners on a task. From that, we can create a set of difference ...
0
votes
0answers
9 views

How to import R library when using JRI in java Eclipse? [migrated]

In my java project, I need to compute a confidence interval, which is too hard to write a code by myself. So I decided to use a method in R statistics, and transfer the computing result to my java ...
1
vote
1answer
17 views

Finding optimal lag order for an exogenous regressor in a VAR model

I can't use VARselect as it gives lags in a VAR model which considers all the variables to be endogenous. In my case, one of the variables is exogenous and affects dependent variable with a certain ...
1
vote
0answers
15 views

The effect of scale of predictor variables in regression techniques

In polynomial regression, it is recommended to center predictor input variables to break multi colinear relationships of x to x^2. From Wikipedia: The underlying monomials can be highly correlated ...
2
votes
1answer
17 views

What are the effects of continuity correction in binomial meta-analysis in the metafor package?

The metafor package in R can be used to fit the random effects model with the exact binomial likelihood as described in Stijnen et al. (2010). The ...
2
votes
0answers
23 views

How to forecast (extrapolate) within a (B-)Spline setting

Suppose I observe a random variable $Y$ for a co-variable $p\in\{70,90,100,...,170\}$. My goal is create a forecast of $\mathbb{E}(Y)$ for $p\in\{50,70,...,350\}$, i.e., a wider range of $p$ as ...
-1
votes
2answers
53 views

Regression analysis low R2 value - Result interpretation

When I run linear regression on my test data I get the following report: You can find the test data in here. The graph of actual vs predicted looks like: I would like to know if this is fairly a ...
0
votes
0answers
9 views

choose colors in plotcluster R function [on hold]

Can I chose colors for each cluster in the graph when using the 'plotcluster' R function for k means?
0
votes
0answers
25 views

logistic regression R and Stata [on hold]

I mostly use Stata for my regression analysis. I want to conduct a logistic regression on a proportion/number of success. Because I receive errors in Stata I did not expect nor understand (if there ...
2
votes
0answers
11 views

Check hazard proportional assuption in a large coxph

I would like to check hazard proportional assuption in a large coxph. Usually I check it with cox.zph but with large coxph my p-value are very small whereas the log(-log(S(t)) curves are almost ...
0
votes
0answers
6 views

Dispersion parameter in quasi-likelihood models in glm

Dispersion parameter given by glm.summary (when quasipoisson or quasibinomial is used) is different from overdisperson calculated by Pearson residuals or residual ...
0
votes
0answers
4 views

spike slab with R

in spike slab regresson, how do we understand the beta coefficients signicant in output in R? I mean, R gets "bma" and "gnet" solutions like below, these coefficients are the significant ones? So it ...
0
votes
0answers
7 views

JAGS equivalent to R's I() (Inhibit Interpretation of Objects) function?

I'm wondering if anyone has come across the JAGS/BUGS equivalent to R's I() function. I am interested in using this in a polynomial logistic regression, i.e.: mod1 <- glm(Employment ~ Density + ...
0
votes
0answers
12 views

What is the final equation used to produce new prediction using kknn on R

I have trained my data using kknn on R and was able to predict on a new data set. However, I'd like to know what the actual final equation is so I can reproduce the prediction manually. My training ...
1
vote
2answers
62 views

Plotting simulated data points from f(X)+e using R [on hold]

Below is a chart from An Introduction to Statistical Learning by Hastie and Tibshirani. The authors use the chart to explain overfitting. In the chart, Y is the response variable and X is the ...
-1
votes
0answers
14 views

Given a set of data, how can I know which distribution those follows? [on hold]

The data contains 2000 observations. I also want to know which R package could solve this problem.
0
votes
0answers
6 views

Lavaan - testing multiple mediators [on hold]

How can I add covariates into Lavaan to test multiple mediators simultaneously while using bootstrapping?
-2
votes
0answers
16 views

How to cluster in R when multivariate data distribution are non-normal? [on hold]

For example, there are 3 different continuous variables with 2000 observations. And all variables are skew distributions. Is there any R package able to solve this? Or can all variables transform to ...
0
votes
0answers
41 views

SVD and recommendations, Using R [on hold]

I am working on the Jester5k data set from the recommenderlab package in R. I have imputed missing values in the matrix as follows: ...
1
vote
0answers
28 views

propensity score matching and survival analysis

I am using the Matching R package to compute Average Treatment Effect within Propensity Score Matching (PSM). I have two groups: treatment and control. In ...
0
votes
0answers
19 views

Making R-Package: NAMESPACE [migrated]

I am creating a R-package and I am at the step where I BUILD the package. I have read the Writing R Extensions documentation about NAMESPACE (more specifically the ...
0
votes
0answers
10 views

Interpreting summary of ICC results in R package “psych”

I have a dataframe "all.st.icc", where 27 subjects have measures of social behavior for each of 8 different years. First four rows of data are as follows: ...
2
votes
3answers
37 views

finding p-value in pearson correlation in R

Is it possible to find the p-value in pearson correlation in R? To find the pearson correlation, I usually do this ...
3
votes
3answers
28 views

Hypothesis Tests for Non-linear least squares coefficients

I have a set of results that take the following form: ...
2
votes
0answers
7 views

R: Kernel discriminant analysis and how to get the kernel cumulative density estimate and prediction(package ks)

I use the R-package ks to do some kernel density estimation (the underlying kernel is the gaussian kernel and the default bin width selector is plug-in selection, ...
0
votes
0answers
20 views

Comparing r values for two groups in metafor [on hold]

I am trying to conduct a small meta analysis of 4 studies where I compare the r values of two different groups (male vs female). Ive been playing around with the syntax and have gotten: ...
1
vote
1answer
25 views

ggplot2 - geom_density(): how to change legend title and order [on hold]

i created a density diagram for a set of data, divided by the different weekdays. ggplot(template, aes(x=test, color=as.factor(Weekday))) + geom_density() Now i ...
1
vote
0answers
18 views

Text mining of machine logs to find correlation between errors in R [duplicate]

I've with me 50 MB data from a machine consisting of event logs such as device status, warning and error. I wish to perform text mining on the same to find correlation between errors i.e. one error ...
2
votes
2answers
28 views

Text mining of machine logs to find correlation between errors in R

I've with me 50 MB data from a machine consisting of event logs such as device status, warning and error. I wish to perform text mining on the same to find correlation between errors i.e. one error ...
1
vote
0answers
40 views

PCA Algorithm & Residual in R

I'm studying the PCA algorithm. But I have a problem with the residuals. I did the same as in the manual below until step 5. From step 6, I don't quite understand the idea, as the dimensions of $Y$ ...
0
votes
0answers
10 views

Quantifying importance of environmental variables in Canonical Correspondence Analysis using R? [on hold]

I currently have species abundance data for multiple lakes along with measurements of some environmental variables for each lake. I decided to do Canonical Correspondence Analysis of the data in R, as ...
5
votes
0answers
17 views

Kaplan Meier estimate for data with unequal numbers in treatments

Is it possible to estimate Kaplan-Meier medians, CIs and difference with unequal sample size in treatments or do I have to do coxph? For example, in my dataset, ...
1
vote
0answers
15 views

Specification of partially crossed longitudinal subjects in linear mixed effects model (lme4, lmer)

I am familiar with linear regression models, but I am in the process of learning about linear mixed effects models. My data consists of measurements for each month for a set of subjects over a long ...
0
votes
0answers
8 views

How to rescale “linear predictor” in drawing nomogram with “rms” package in R? [migrated]

I am trying to draw a nomogram from a logistic regression in R by using the rms package, but currently I have a problem: indeed, I can get the nomogram, but the "linear predictor" axis ranges from ...