search for: lrtest

Displaying 20 results from an estimated 24 matches for "lrtest".

Did you mean: latest
2012 Jan 10
1
importing S3 methods with importFrom
In my own package, I want to use the default S3 method of the generic function lrtest() from the lmtest package. Since I need only one function from lmtest, I tried to use importFrom in my NAMESPACE: importFrom(lmtest, lrtest) However, this fails R CMD check in the examples: Error in UseMethod("lrtest") : no applicable method for 'lrtest' applied to an objec...
2008 Mar 07
1
confused about CORREP cor.LRtest
After some struggling with the data format, non-standard in BioConductor, I have gotten cor.balance in package CORREP to work. My desire was to obtain maximum-likelihood p-values from the same data object using cor.LRtest, but it appears that this function wants something different, which I can't figure out from the documentation. Briefly, my dataset consists of 36 samples from 12 conditions and I have 497 genes of interest to be correlated. The following works: M <- cor.balance(stddata, m = 3, G=497)...
2009 Apr 03
1
Trouble extracting graphic results from a bootstrap
Hi, I'm trying to extract a histogram over the results from a bootstrap. However I keep receiving the error message "Error in hist.default(boot.lrtest$ll, breaks = "scott") : 'x' must be numeric". The bootstrap I'm running looks like: > boot.test <- function(data, indeces, maxit=20) { + y1 <- fit1+e1[indeces] + mod1 <- glm(y1 ~ X1-1, maxit=maxit) + y2 <- fit2+e2[indeces] + mod2 <- glm(y2~1, maxit=maxi...
2018 Feb 14
0
Unexpected behaviour in rms::lrtest
Hello. One of my teaching assistants was experimenting and encountered unexpected behaviour with the lrtest function in the rms package. It appears that when you have a pair of non-nested models that employ an RCS, the error checking for non-nested models appears not to work. Here is a reproducible example. > library(rms) Loading required package: Hmisc Loading required package: lattice Loading r...
2008 Jan 28
0
(no subject)
...lm <- rep(NA,R) sigmahatesq <- rep(NA,R) sigmahatbsq <- rep(NA,R) est.ICC <- rep(NA,R) all.fix.coef.lm <- rep(NA,R) all.se.fix.coef.lm <- rep(NA,R) all.se.fix.coef.glm <- rep(NA,R) all.se.fix.coef.adapt.lm <- rep(NA,R) F<- rep(NA,R) F1<- rep(NA,R) lrt <- rep(NA,R) lrtest <- rep(NA,R) yb <- rep(NA,R) varyb <- rep(NA,R) var <- rep(NA,R) var1 <- rep(NA,R) D<- rep(NA,R) Lrt <- function(k, R=250,m, c, stop=FALSE){ if(stop) browser() set.seed(421) options(digits = 3) for(case in 1:3){ if(case==1) c <- 1:3 if(case==2) c <- 5:15 if(cas...
2009 Jul 14
1
How does logLik(lm(...)) find the maximum log likelihoods
Hi. Thanks for your help with my previous question (comparing two lm() models with a maximum likelihood ratio test) I had a look at lrtest from the package lmtest as it has been suggested to me, but I am not 100% sure if that is the right thing to do ... lrtest uses the same log likelihoods as you can extract by hand from lm() with logLik - are this the maximum log likelihoods? How does R calculate them? I tried google to find inf...
2005 Jan 27
1
Is glm weird or am I?
...;m now trying to run a logistic regression on each pair (x,y) where y is a factor with 2 levels. I don't know how (or whether I want) to try to fathom what's up with glm. What I wrote is attached. Here's what I get. ***************************************************** source("lrtest.R") building model: Wgend ~ WAY construct_and_run_model: class of x: integer nlevels(x): 0 class of y: factor nlevels(y): 2 model built model ran -1.070886 0.01171153 building model: Wgend ~ WBWS construct_and_run_model: class of x: integer nlevels(x): 0 class of y: factor nlevels(y): 2...
2007 Apr 05
2
about systemfit
...quot;): Res.Df RSS Df Sum of Sq F Pr(>F) 1 127 7.3782 2 137 7.6848 -10 -0.3066 0.5277 0.868 As I said, the results of the chisquare test with linear.hypothesis and the waldtest.systemfit coincide. I have one more problem. This is the output of lrtest.systemfit: lrtest.systemfit(resultc=adfResc,resultu=adfResu) Likelihood-Ratio-test for parameter restrictions in equation systems LR-statistic: degrees of freedom: p-value: Why do I get empty values? In summary, I need to understand why the two ftests give different results; why lrtest.syste...
2017 Dec 14
0
permutation test for Cox proportional hazards regression model
I would like to perform a permutation test for Cox proportional hazards regression model. I only find it for t-test and other tests (e.g. comparing two medians). Is there a way that I can perform a Cox PH model in R or SAS for the LR-test? I am doing the following B <- 1000; LRtestx <- rep(NA,B); Srv <- Surv(Time, Event); for(j in 1:B){ LRtestx[j] <- cph(Srv~sample(x,length(x),replace=F))$stat[3]}; LRtest <- cph(Srv~x)$stat[3]; sum(LRtestx > LRtest)/B Many thanks Linda [[alternative HTML version deleted]]
2012 Oct 23
1
Testing proportional odds assumption in R
I want to test whether the proportional odds assumption for an ordered regression is met. The UCLA website points out that there is no mathematical way to test the proportional odds assumption (http://www.ats.ucla.edu/stat//R/dae/ologit.htm), and use graphical inspection ("We were unable to locate a facility in R to perform any of the tests commonly used to test the parallel slopes
2010 Jul 26
2
modelos mixtos con familia quasibinomial
Hola a tod en s, mi compañero y yo intentamos ver la correlación de nuestros datos mediante regresiones logísticas. Trabajamos con proporciones (1 variable dependiente y 1 independiente) mediante modelos mixtos (los datos están agrupados porque hay pseudoreplicación). Hemos usado el paquete "lme4" y la función "lmer". Encontramos "overdispersion" en el resultado
2013 Apr 19
2
NAMESPACE and imports
...,bootcov,bootplot,bplot,calibrate,cph,catg,combineRelatedPredictors,confplot,contrast,coxphFit,cph,cr.setup,datadist,effective.df,fastbw,formatNP,gendata,gIndex,GiniMd,Glm,Gls,groupkm,Hazard,hazard.ratio.plot,histdensity,"%ia%",ie.setup,interactions.containing,legend.nomabbrev,lm.pfit,lrm,lrtest,lsp,matinv,matrx,Newlabels,Newlevels,nomogram,num.intercepts,ols,ols.influence,oos.loglik,pantext,Penalty.matrix,Penalty.setup,pentrace,perimeter,perlcode,plot.xmean.ordinaly,pol,pphsm,predab.resample,Predict,psm,rcs,related.predictors,reVector,robcov,Rq,sascode,scored,sensuc,setPb,show.influence,s...
2009 May 17
2
Chow test(1960)/Structural change test
Hi,   A question on something which normally should be easy !   I perform a linear regression using lm function:   > reg1 <- lm (a b+c+d, data = database1)   Then I try to perform the Chow (1960) test (structural change test) on my regression. I know the breakpoint date. I try the following code like it is described in the “Examples” section of the “strucchange” package :   > sctest(reg1,
2012 Mar 12
1
Speeding up lots of calls to GLM
...= glm(PHENOTYPE~get(as.character(terms$V1[i]))+get(as.character(terms$V2[i])),family="binomial") fit2 = glm(PHENOTYPE~get(as.character(terms$V1[i]))+get(as.character(terms$V2[i]))+I(get(as.character(terms$V1[i]))*get(as.character(terms$V2[i]))),family="binomial") a = lrtest(fit1, fit2) pval = c(pval, a[2,"Pr(>Chisq)"]) } detach(data) results = cbind(terms,pval) return(results) } In the table below is the system.time results for increasing numbers of variables being passed through the function. n is the number of variables, and Ints is th...
2009 Apr 15
0
Cross-Validation for Zero-Inflated Models
Hi all I have developed a zero-inflated negative binomial model using the zeroinfl function from the pscl package, which I have carried out model selection based on AIC and have used likelihood ratio tests (lrtest from the lmtest package) to compare the nested models [My end model contains 2 factors and 4 continuous variables in the count model plus one continuous variable in the zero-inflated portion]. But for model assessment I would like to carry out some form of internal cross-validation along the lin...
2009 May 12
0
Trouble with parametric bootstrap
...or a linear model. The function at this point is given by boot.test.n01 <- function(data, indeces, maxit=20) { y1 <- fit1+se(e2)*rnorm(314) mod1 <- glm(y1 ~ X1-1, maxit=maxit) y2 <- fit2+se(e2)*rnorm(314) mod2 <- glm(y2~1, maxit=maxit) t <- 2*(logLik(mod1)-logLik(mod2)) t } boot.lrtest.n01 <- boot(data=M1, statistic=boot.test.n01, R=3999, maxit=100, sim="parametric", ran.gen=???, mle=???) fit1 & fit2 are vectors containing fitted values, the se() is the standard error of a residual vector, e2, which I'm using as an estimate of the variance. I'm not sure...
2014 Jun 19
1
Restrict a SVAR A-Model on Matrix A and Variance-Covariance-Matrix
...de so far is: # Prediction SVAR - A-Model (B-Matrix = NULL) # restrictions: # 1) Amat = A_Matrix # 2) ???? VAR.est <- VAR(data.ts, p = 4, type = "none") SVAR.A.est <- SVAR(x=VAR.est, estmethod = "direct", Amat = A_Matrix , Bmat = NULL, hessian = TRUE, lrtest = TRUE) #-------------------------------------------------------------------- I know, that {vars} restrict the Variance-Covariance-Matrix by default to an identity-matrix but I wondered if I can't restrict it by myself since the way I need (!) to do that is quite common. Thank you for any co...
2012 Jul 12
1
SVAR Restriction on AB-model
Hello! I'm doing a svar and when I make the estimation the next error message appears: In SVAR(x, Amat = amat, Bmat = bmat, start = NULL, max.iter = 1000, : The AB-model is just identified. No test possible. Could you help me to interpret it please. Also I have the identification assumption that one of my shocks is exogenous relative to the contemporaneous values of the other variables
2009 Jul 26
0
Version 0.7 of package tsDyn, nonlinear time series
...it roots tests: KapShinTest() and BBCTest() -new functions for estimating VAR and VECM: lineVar -new function for estimating TVECM: function TVECM() -new function for estimating TVAR: function TVAR() -new function to test for setar: function setarTest() -new function to test for TVAR: function TVAR.LRtest() -new function to test for TVECM: functions TVECM.SeoTest() and HanSeo_TVECM() -new function to simulate/bootstrap a TVAR: function TVAR.sim() -new function to simulate/bootstrap a TVECM: function TVECM.sim() -new function to simulate/bootstrap a setar: function setar.sim() -new function to estim...
2009 Jul 26
0
Version 0.7 of package tsDyn, nonlinear time series
...it roots tests: KapShinTest() and BBCTest() -new functions for estimating VAR and VECM: lineVar -new function for estimating TVECM: function TVECM() -new function for estimating TVAR: function TVAR() -new function to test for setar: function setarTest() -new function to test for TVAR: function TVAR.LRtest() -new function to test for TVECM: functions TVECM.SeoTest() and HanSeo_TVECM() -new function to simulate/bootstrap a TVAR: function TVAR.sim() -new function to simulate/bootstrap a TVECM: function TVECM.sim() -new function to simulate/bootstrap a setar: function setar.sim() -new function to estim...