Use this tag for any *on-topic* question that (a) must have an `R`-based solution yet (b) is not *just* about how to program in `R`.

learn more… | top users | synonyms

3
votes
1answer
96 views

Omega H asymptotic

In the omega function in the psych package for R, we have several outputs including Hierarchical omega, Asymptotic omega and Total omega. I was reading about the outputs, but I find nothing about ...
3
votes
2answers
4k views

package R.basic

I would like to use the fuction weighted.median() in package R.basic (and some other ones too, although this one is most important). install.packages("R.basic") ...
1
vote
1answer
126 views

Is there a function in R that takes the centers of clusters that were found and assigns clusters to a new data set

I have two parts of a multidimensional data set, let's call them train and test. And I want to built a model based on the train data set and then validate it on the test data set. The number of ...
0
votes
0answers
4 views

what is the return value of predict in the fGarch package

I have a question about a quit sophisticated model for a time series. Suppose $ \{X_t:0\le t\le T\}$ is a time series. The plot of autocorrelation function and partialcorrelation function suggest and ...
2
votes
1answer
1k views

Binomial Distribution & t-Test

Starting with a Binomial Distribution with parameters $n=1000, p=0.5$ and measured successes of 300, I would like to test whether there is a significant difference between success and failure. The ...
0
votes
0answers
8 views

Error message when fitting 3-dimensional Copula [migrated]

I want to use a Gumbel Copula for a 3-dimensional data set. I use R and the Copula package. It gives me an error, though. This ...
0
votes
1answer
18 views

Compare two samples

similar questions have been asked but have not managed to get a conclusion from them. I am comparing two sets of samples, where ratios have been obtained for several analytes per sample. So the values ...
0
votes
0answers
19 views

Hidden Markov Models methods for selecting optimal number of states

Package RHmm (R) I have a vector which I fit into a hmm model in an attempt to select an optimal number of states for a hidden markov model. ...
0
votes
0answers
4 views

Optimum value of minlev in function combine.levels

I have a dataset of 306967 rows and 23 columns, and I am building a regression model for predicting a factor based upon 6 other iid variables. Doing this I encountered an issue of large no of levels ...
1
vote
0answers
13 views

Problem with visualising logistic regression using the effects package in R

I am using the effects package in R to plot the effects of categorical and numerical predictors in a binomial logistic regression estimated using the lme4 package. My dependent variable is the ...
0
votes
0answers
5 views

Balanced sampling in R

Currently I'm using "cube" function for balanced sampling in R. It works fine on moderate amount of data. However, if the entire population of 10,000,000+ is used, R hangs. Is there any alternative ...
2
votes
1answer
57 views

Remove effect of a factor on continuous proportion data using regression in R

I have a data set of continuous proportions which depend on a fixed-effect factor, e.g.: ...
0
votes
0answers
7 views

Simulating a bimodal biased IV estimator

How can I simulate a bimodal biased IV estimator? The common unimodal heavy-tailed biased estimator would be something like this: ...
6
votes
2answers
129 views

Variance-Covariance matrix interpretation

Assume we have a linear model Model1 and vcov(Model1) gives the following matrix: ...
2
votes
1answer
46 views

Plot graph with more than one value on x and y-axis in R

I have a dataset containing two columns and a total of 90 rows. The data is from my experiment where in the first column I have an integer representing the quantity, in the second column I have a ...
0
votes
1answer
20 views

Estimating finite sample bias for Instrumental Variables

Are there ways to estimate the finite sample bias with instrumental variables? I guess this would be conditional on assuming some structure to the problem and also would involve simulation, but, at ...
1
vote
4answers
1k views

Random forest and new factor levels in test set

I am trying to make predictions using a random forest model in R. However I get errors since some factors have different values in the test set than in the training set. For example, a factor ...
5
votes
0answers
22 views

Multivariant time series in R. How to find lagged correlation and build model for forecasting

I'm new in the page and pretty new in statistics and R. I'm working on a project for college with the objective of finding the correlation between rain and water flow level in rivers. Once the ...
1
vote
3answers
91 views

Sampling data to have specific mean and standard deviation

I have a data that I want to sample such the resultant distribution of values should have specified mean and standard deviation. I can think of rejection sampling to achieve this however that seems to ...
2
votes
2answers
122 views

Difference between regression methods

I have a set of data where the response is a proportion. For each event in the experiment, a system will correctly tag X of Y ...
0
votes
1answer
34 views

Power transformation using Box-Cox transformation

I have a dependent variable Cost and an independent variable VPT. I want to perform a power transformation on ...
0
votes
0answers
15 views

Cochran-Armitage test for trend in R

I have a 4x2 table that I want to do a Cochran-Armitage trend test for. Basically, I want to test for lack of independence as the dose (the rows) increase. I'm trying to figure out the R code but am ...
1
vote
0answers
17 views

How to predict cumulative hazard in survival analysis?

Suppose I have a survival model like this: ...
1
vote
1answer
58 views

Using Ltm package to calclate 3PL some lines of data seem to go missing

I am hoping someone can help with the following: I have been trying to use the ltm package in R to get person fit estimates using a 3PL model. The problem I have been having is that I start off ...
12
votes
2answers
3k views

Mode, Class and Type of R objects

I was wondering what are the differences between Mode, Class and Type of R objects? Type of a R object can be obtained by typeof() function, mode by mode(), and class by class(). Also any other ...
0
votes
0answers
10 views

Degrees of freedom correction to pooled regression of demeaned data in R

Is there a canonical way to do degrees of freedom (DF) correction to ols objects from the rms package (and to ...
0
votes
0answers
65 views

Data Visualization with R, not possible by excel 2007 [on hold]

Can you please suggest me some good data visualizations using R which are very tedious to do using Excel 2007? For example, I found treemap in R which I can't able ...
2
votes
1answer
102 views

R: power calculation for beta coefficient

I am interested in calculating the power for the beta effect size, for example ...
0
votes
3answers
47 views

Problem with PCA

I am trying to do some PC analysis on my data coming from lipids measurements in different samples. I only have one factor: if samples are diabetic or non-dibetic. Here is the PCA graph I get: As ...
0
votes
0answers
9 views

Probabilities of predicted classes for a bayesnet using bnlearn R package [on hold]

I have been trying to use a Bayesian network to predict a target node. I want to find the probabilities of each class instead of the class labels when I use the corresponding predict method. I am ...
3
votes
2answers
101 views

Efficiency of beta estimates with heteroscedasticity

I need something clarified and that is when you have non-constant variance, estimates won't be biased but will be a problem when it comes to the S.E. formulas and efficiency. Therefore OLS estimates ...
2
votes
0answers
18 views

Evaluate deviation from negative binomial model

I'm trying to figure out how to determine to what extent a sample deviates from a negative binomial model fitted to a larger population. As an example, I generated counts of doctor visits for a ...
3
votes
1answer
205 views

Newton's algorithm for a Minimax Procedure

In order to find the minimax solution of a certain problem I have to determine the constant $c$ that provides the root for the following equation: $$l(c)=3\times \left [ 1-\Phi \left( c-75 \right) ...
0
votes
0answers
30 views

avoid for loop in R [migrated]

I am basic level in R. It's said better to rewrite loops by apply. But for the following problem, I've no idea how to achieve that. Can anyone help? Or recommend some similar examples? ...
3
votes
0answers
161 views

Random Forest Regression - Coping with extreme values

I'm not sure if I used the concept "extreme values" right. Anyhow, I'm trying to produce a model that estimates maximum tree heights / $\text{km}^2$. I have a database of around 24000 points ...
3
votes
1answer
279 views

Cluster analysis in R produces reversals on dendrogram

I'm attempting to perform hierarchical agglomerative cluster analysis in R. However, when I use particular clustering methods, I get reversals (upward branching) in the resulting tree, which ...
0
votes
1answer
126 views

Outlier detection in ARIMA model with R

After fitting my time series with an ARIMA model, I want to test outliers in the residuals' series. Are there any functions in R that could do this test and furtherly test whether the outlier is ...
0
votes
0answers
8 views

Minimum Distance Estimator in r

I am running a regression to estimate the relationship between a dependent variable and some regressors. Let's say I have two alternative models based on two different assumptions about the exogeneity ...
2
votes
1answer
31 views

What exactly does the 'boxcox' function in R do?

I am familiar with the power transform family and I know how to estimate the MLE for $\lambda$ for given samples of a random variable. I have been using the 'boxcox' function in R for a sample of a ...
0
votes
1answer
26 views

What do the coefficients of the crossproduct of regression mean?

How can I interpret the coefficients of the crossproduct of each of the following codes? What do they mean? How can I deduce that they correspond to our expectation? ...
1
vote
1answer
44 views

How to produce the minimum forecast error using R?

Considering that we want to use optimize() on the interval [0,1] how can I write an R code for finding the value of β that produces the minimum forecast error without using external packages like ...
0
votes
0answers
6 views

Using a Decision Tree Algorithm such as C4.5 to understand population Partition

I have multivariate data about a certain population with more than 1000 attributes per exemplar. Some of the variables are basic demographics attributes including: gender, age, race, ethnicity, ...
1
vote
0answers
36 views

Stata's xtlogit (fe, re) equivalent in R?

Stata allows for fixed effects and random effects specification of the logistic regression through the xtlogit fe and xtlogit re ...
0
votes
0answers
3 views

Plotting the overlay using an exponential smoothing of a time-series using `lines()` [migrated]

I have the following code so far but I am not sure which function I should use for plotting the yearly average measurements of temperature for New Hampshire, from 1912 to 1971, and overlay an ...
6
votes
1answer
362 views

How can I generate uniformly distributed points on a circle?

I am looking to generate 450 data points in R. There are three distinct sets 150 of each distributed in a circular band with different radii (at 1, 2.8 and 5). In particular, I'm looking to reproduce ...
2
votes
0answers
23 views

Plot and interpret ordinal logistic regression

I have a ordinal dependendent variable, easiness, that ranges from 1 (not easy) to 5 (very easy). Increases in the values of the independent factors are associated with an increased easiness rating. ...
0
votes
0answers
8 views

How to insert output into command line / function [migrated]

I have output ("1b" "2b" "3b" ... "40b") The values are then inserted into a function for further calculations. I am prepping the values with the following code. ...
0
votes
0answers
14 views

Model matrix of a mixed model

Suppose I have a mixed model like this: ...
0
votes
1answer
85 views

NMDS: why is the r-squared for a factor variable so low

I am doing an NMDS ordination. The data come from a number of sites scattered around two lakes. In the plots, I coloured the samples from the two lakes blue and green. There seems to be some pretty ...
0
votes
0answers
16 views

How to obtain the complete model matrix of a mixed model?

Suppose I have a mixed model like this: ...