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
0answers
23 views

How can I create a linear regression model with some negative coefficients in R?

What I'm trying to do is to construct a linear model in a form like $$ Y = \beta_0X_0-\beta_1X_1+\beta_2X_2 + \beta_3 $$ where $\beta_0$, $\beta_1$ and $\beta_2$ are coefficient of predictors $X_0$, ...
0
votes
0answers
13 views

faster alternatives to solve() in R

If chol2inv(chol(matrix)) is not applicable to my matrix (i.e. not positive-definite square matrix), is there any other alternative methods in R to do matrix inversion (or avoiding the inversion). I ...
0
votes
0answers
7 views

how can I block by location in r?

still new and learning how to use R, but I'd like to get some help with figuring out how to block my data by location. I found this, but I don't understand where to put my data into the code: ...
0
votes
1answer
40 views

R - Creating conditional variables with loop [on hold]

I have a dataset like this, where each data point has a person's gender, and whether they checked off a number of descriptors (1) or not (NA): ...
0
votes
0answers
5 views

Is there a minimum sample size for Besag's transformation of Ripley's K-function?

I am using Besag's L function to test complete spatial randomness for plant populations. Specifically, I am implementing the univariate L-function Lest in R on a ...
0
votes
0answers
11 views

Repeated measures with time varying covariates in R

On this page (Model 5, http://www.ats.ucla.edu/stat/spss/faq/repeat_covar.htm), there is a description of how to carry out this type of analysis using SPSS. Does anyone know how to do the same thing ...
0
votes
0answers
13 views

Weight of Evidence(WoE)/Information Value(IV) in R [on hold]

I am building a credit scoring model in R. I have to run logistic regression. But my number of variables is too high, about 3000. I have both continuous and factor variables. And number of observation ...
1
vote
1answer
43 views

Negative Binomial Distribution R

This question was given in class and I was wondering how to do this in R: "Sixty percent of a large lot of old spark plugs are still usable, and they can be individually tested to determine this. Let ...
0
votes
1answer
20 views

How do I contrast code for a factor where one level is the application of both of two others?

I have a factor 'Music' that has four levels: none, piano, guitar, and mixed. Subjects gave a response hearing no music, piano only, guitar only, or piano and guitar, so I want to create an lmer model ...
1
vote
0answers
11 views

CBC analysis using choicemodelr - interpretation of the output attribute values

I finished a choice-based conjoint (CBC) survey. Now i am evaluating my results with the R-Package "ChoiceModelR". With this i get Beta Values, with which i can, for example, compute attribute ...
0
votes
1answer
10 views

Calculating sample size of a mixed ANOVA in R (2 between, 1 within variable)?

I'm searching for a built-in function in R for calculating the required sample size (given certain power, alpha,..) of a mixed ANOVA (2 between, 1 within variable, 2x2x2 design). Does this function ...
0
votes
0answers
7 views

density estimate for continuous support with continuous frequency

I have data with continuous frequency and a continuous support which I'd like to analyze and plot using a kernel density estimate in R. I can create the basic plot in JMP fairly easily using the ...
0
votes
0answers
13 views

Machine Learning Predictors Evaluation Using R

I've bee using R for predicitve analytics and here is issue: I'm trying to predict the species (categorical variables E1, E2, E3 and E4) of an animal using as predictors a set of nominal (NO1, NO2, ...
0
votes
0answers
32 views

How to Calculate π In R [on hold]

This GLM From My Data How To Calculate π With R. I Need R Code.
2
votes
1answer
17 views

Interaction effect of 2x2 ANOVA in meta-analysis

I want to meta-analyze the interaction effect of a 2x2 ANOVA. (I am not talking about an interaction in the meta-regression, as in this question but about an interaction as the focal effect that ...
1
vote
0answers
11 views

Checking the proportional odds assumption holds in an ordinal logistic regression using polr function

I have used the ‘polr’ function in the MASS package to run an ordinal logistic regression for an ordinal categorical response variable with 15 continuous explanatory variables. I have used the code ...
1
vote
1answer
25 views

Bootstrap glm and extract pvalue

I am running a glm model using bootstrap, I can extract the coefficient mean and the confidence intervals for all the factors in my model. But how can I get the pvalue from there? Model: ...
-1
votes
0answers
5 views

Using googleVis api in java [migrated]

I have used googleVis api in R for dynamic map.Now i am trying to make a small webapp in which servlet access this api and the result is displayed in jsp.But i am not able to access googleVis api from ...
0
votes
0answers
6 views

Determing goodness of fit at data with few and sometimes heavy change

Currently, I happen to analyze data where I do have a data matrix for two time points each. Each of these matrices is of dimension nxm, where n is the number of samples and m is the number of ...
0
votes
0answers
30 views

Can I use the correlation value to measure the correlation between two variables when observations in each variable have auto-correlation?

I have two variables: urban areas farm areas. My observations are urban areas and farm areas in each year. But these observations are the cumulative ones, so observations in each variable have ...
0
votes
0answers
13 views

Is it correct or not I applied PERMANOVA-test and interpreted results?

I want to associate nutrients with microbiota bacteria composition. My data consist of two tables: nutrient table (row - patients, column - some of nutrients, e.g. protein, calorage); bacterial ...
0
votes
0answers
12 views

How does one do a Post-hoc test for a Poisson glm in R?

My data consists of the following categories: Site - 3 sites - Boulder, Rubble and Cul-de-Sac Season - 4 types - warm1, warm2, cold1 and cold2 Behaviour - 6 behaviours scored - Basking, ...
0
votes
0answers
23 views

Calculate probability of consecutive event from R simulations

he problem is to calculate the PMF of consecutive flips of head (M) in N number of coin flips. Consecutive heads, k=0, 1, 2,...,N, the PMF is P(M=k). I use $sample(0:1,N,rep=T,prob=(0.25,0.75))$ to ...
1
vote
1answer
28 views

Calculate probability of consecutive event from R simulations

The problem is to calculate the PMF of consecutive flips of head (M) in N number of coin flips. Consecutive heads, k=0, 1, 2,...,N, the PMF is P(M=k). I use ...
2
votes
0answers
17 views

Maximum likelihood of multivariate t-distributed variable with scaled covariance

I am trying to estimate the covariance of a iid multivariate t-distributed random variable, where I define the multivariate density as in the Statlect textbok, which is the same as the wikipedia page. ...
0
votes
0answers
19 views

lowess: R (& python-statsmodels) vs MATLAB (& biopython)

There seems to be two different interpretations of what LOWESS really means: one from R (also used by python-statsmodels), and one from MATLAB (also used by biopython), see comparison below. Could ...
3
votes
1answer
26 views

Selecting variables using SAS and R - all effects are significant even when shuffling the data

Dear all: I need to test which effects I should include in my model for genetic evaluation of cows. I was using the following code in R: ...
0
votes
1answer
17 views

Full effects from Poisson GLM

I am running a Poisson GLM with count data as response variable and both continuous and categorical variables as predictors. I made use of the following (dispersion is OK): ...
0
votes
0answers
17 views

One Step Ahead Forecasts Using Predict() in R

I just fit a model to a time series. I am now required to generate a 10-year extrapolation forecast of my model. My model includes a time term, a time^2 term, 12 seasonal dummies, and 4 lagged ...
2
votes
0answers
27 views

Meta-analyses for variance rather than means

What are the main complications / differences when conducting a meta-analyses where the metric of focus is not effect size (i.e., means) per se, but instead estimates of variances from models? Nods ...
2
votes
0answers
34 views

Is There A Machine Learning Algorithm For Textual Data With Thousands Of Classifiers?

I've been asked to migrate this from StackOverflow to CrossValidated. I have a problem that I think Machine Learning can solve but am having a very hard time determining which ML Algorithm to use and ...
0
votes
0answers
16 views

Regression Analysis with String values in column of DataFrame

I have a dataset which is having multiple columns where some column has string values with comma seperated ...
0
votes
2answers
42 views

Why does the linear SVM give a lot of support vectors?

I simulate a simple linear setup: n = 1000 X = runif(n) Y = runif(n) ind = X + 2*Y < 1 ind[ind == TRUE] = runif(sum(ind)) < 1 plot(X,Y,col = ind + 1) ...
0
votes
0answers
25 views

Handling Sparse Data Frames - algorithm selection

I am new to machine learning/statistical modelling. I am trying to run a classification on a highly sparse dataset with 100 features, most of which are categorical (TRUE/FALSE) with the remaining ...
0
votes
0answers
22 views

What does muhaz return?

A pretty basic question. I have read somewhere that the muhaz function in muhaz package will return the baseline hazard rate for COX model. The muhaz document states that it "Estimates the hazard ...
1
vote
0answers
17 views

How to simulate a random variable from a matrix variate distribution?

I am trying to simulate a random variable from the matrix variate normal distribution but have not seen any literature on it. If somebody could point me in the right direction for that or if they ...
0
votes
1answer
27 views

Optimization failure in HoltWinters [on hold]

I am using HoltWintersto fit the exponential model on the data. The data shows trend as well as seasonal pattern.Getting the following error message: ...
0
votes
0answers
12 views

R: Error with mlogit Conjoint modelling - system singularity

I am building choice models on a dates about coffee preferences. I have 5 alternatives: Brand, Cup, Price, Certification and Local Community Support. The data looks like this: ...
1
vote
0answers
24 views

R - Number of days since last occurrence [migrated]

I have a data frame that looks like this: ...
-1
votes
0answers
17 views

Adding number of observations in a histogram using gglpot [on hold]

My dataset looks as follows: ...
2
votes
1answer
122 views

How to implement model in R?

i would like your help to implement this model in R or more explicity where yt = monthly mean values μi = mean value in month i, i = 1 . . . 12 . I1;t = Indicator series for month i of the ...
-1
votes
1answer
21 views

Rearrange boxplot with ggplot [on hold]

My data looks as follows: X=cbind(var1=rbinom(100,1,0.26),var2=rbinom(100,1,0.01), var3=rbinom(100,1,0.07),var4=rbinom(100,1,0.09),var5=rbinom(100,1,0.004)) If ...
0
votes
1answer
9 views

Permutation on multiple Pairwise Comparison with least square means in R 3.1.2

I'm working on a study where I employed an analysis of covariance (Ancova) with unbalanced factors. I used permutation tests to obtain p-values for my estimates since my observation does not come from ...
2
votes
1answer
44 views

How to use a linear model with two factors and repeated measures?

Suppose I have a date set of the form: ...
0
votes
1answer
19 views

define prior probabilities in naive bayes with unbalanced classes and asymetric cost

I'm trying to apply Naive bayes to the following supervised problem: It's a binary classification problem The classes are unbalanced. The target class represents the 0.004266432 of the total and the ...
1
vote
0answers
20 views

Survival Analysis on Telecom Churn in R

I am working on Telecom Churn problem and here is my dataset. http://www.sgi.com/tech/mlc/db/churn.data Names - http://www.sgi.com/tech/mlc/db/churn.names I'm new to survival analysis.Given the ...
0
votes
0answers
7 views

Error: could not find function “rxGetOption” in Revolution R Open [on hold]

I downloaded and installed Revolution R Open. Current Version of R is 3.1.1 (2014-07-10) -- "Sock it to Me" and version of Revolution R Open is 8.0 beta. I have started basic tutorial from converting ...
0
votes
0answers
6 views

In R, using glm to model call counts in treated/not treated forests [on hold]

Ok, so I'm new to using R and trying to learn this on my own because my uni doesn't have a prof who uses R. I've tried googling for answers, and I feel like I'm sort of getting answers, but I'm still ...
1
vote
0answers
32 views

Comparison and testing multinomial coefficients

Straight to the problem I want to test the hypothesis that two coefficients of multinomial regression model are equal between them. For example, considering a model where Y is 3 level categorical ...
0
votes
0answers
26 views

Forecasting a solar data using arima in R [on hold]

I have a solar data collected from a PV plant for the period 2009.the method for forecasting as suggested for me is to use a training set for instance from 01/01/2009 to 30/04/2009 and a test period ...